Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::GraphicsToolkit Class Reference

The GraphicsToolkit serves as a way to retreive basic system information and as a factory for creating various graphics peers, like the ContextPeer, FontPeer, and the system implementation the Image class. More...

#include <vcf/GraphicsKit/GraphicsToolKit.h>

Inheritance diagram for VCF::GraphicsToolkit:

VCF::Object VCF::OSXGraphicsToolkit VCF::Win32GraphicsToolkit VCF::XCBGraphicsToolkit List of all members.

Public Types

typedef std::map< String,
Color * > 
MapStringColor
typedef std::map< Color, VCF::StringMapStringColorName

Public Member Functions

 GraphicsToolkit ()
virtual ~GraphicsToolkit ()

Static Public Member Functions

static ContextPeercreateContextPeer (const uint32 &width, const uint32 &height)
static ContextPeercreateContextPeer (OSHandleID contextID)
static FontPeercreateFontPeer (const String &fontName)
static FontPeercreateFontPeer (const String &fontName, const double &pointSize)
static ImagecreateImage (const uint32 &width, const uint32 &height, const Image::ImageType &imageType=Image::itColor)
static ImagecreateImage (GraphicsContext *context, Rect *rect, const Image::ImageType &imageType=Image::itColor)
static PrintSessionPeercreatePrintSessionPeer ()
static GraphicsResourceBundlePeercreateGraphicsResourceBundlePeer ()
static GraphicsResourceBundlegetResourceBundle ()
static ImagecreateImage (const String &fileName)
 Create a image from a filename.
static ImagecreateImage (const MIMEType &type, const unsigned char *imageData, const uint64 &dataLength)
static ImagecreateImage (const MIMEType &type, InputStream *stream)
static void saveImage (const String &fileName, Image *image)
static void registerImageLoader (const String &name, ImageLoader *imageLoader)
static ImageLoadergetImageLoader (const String &contentType)
static ImageLoadergetImageLoaderForFileName (const String &fileName)
static ColorgetSystemColor (const uint32 &systemColor)
static String getSystemColorNameFromMap (Color &color)
static String getColorNameFromMap (const Color &color)
static ColorgetColorFromColormap (const int &gray)
static ColorgetColorFromColormap (const String &colorName)
static ColorgetColorMatchFromColormap (const Color &color)
 finds the named color closest to another given one.
static void printColorNameMap ()
static Enumerator< FontInfo > * getAvailableSystemFonts ()
static FontgetDefaultSystemFont ()
static double getDPI (GraphicsContext *context=NULL)
 Returns the crurent DPI for the screen if the context parameter is NULL, otherwise returns the dpi that is used by the graphics context.
static void initGraphicsToolkit ()
static void terminate ()
static bool getAvailableImageTypes (std::vector< std::pair< String, String > > &contentTypes)
static GraphicsToolkitinternal_getDefaultGraphicsToolkit ()
static void systemSettingsChanged ()
 Call this function if you need to reload various toolkit resoruces due to a systems settings changes, for example teh user enabling or disabling themes.

Protected Member Functions

virtual ContextPeerinternal_createContextPeer (const uint32 &width, const uint32 &height)=0
virtual ContextPeerinternal_createContextPeer (OSHandleID contextID)=0
virtual FontPeerinternal_createFontPeer (const String &fontName)=0
virtual FontPeerinternal_createFontPeer (const String &fontName, const double &pointSize)=0
virtual Imageinternal_createImage (const uint32 &width, const uint32 &height, const Image::ImageType &imageType)=0
virtual Imageinternal_createImage (GraphicsContext *context, Rect *rect, const Image::ImageType &imageType)=0
virtual PrintSessionPeerinternal_createPrintSessionPeer ()=0
virtual GraphicsResourceBundlePeerinternal_createGraphicsResourceBundlePeer ()=0
virtual double internal_getDPI (GraphicsContext *context)=0
virtual void internal_systemSettingsChanged ()=0
virtual Imageinternal_createImage (const String &fileName)
 Create a image from a filename.
virtual Imageinternal_createImage (const MIMEType &type, const unsigned char *imageData, const uint64 &dataLength)
virtual Imageinternal_createImage (const MIMEType &type, InputStream *stream)
virtual void internal_saveImage (const String &fileName, Image *image)
void internal_registerImageLoader (const String &name, ImageLoader *imageLoader)
virtual Colorinternal_getSystemColor (const uint32 &systemColor)
virtual String internal_getSystemColorNameFromMap (Color &color) const
virtual String internal_getColorNameFromMap (const Color &color) const
virtual Fontinternal_getDefaultSystemFont ()
ImageLoaderinternal_getImageLoader (const String &contentType)
ImageLoaderinternal_getImageLoaderForFileName (const String &fileName)
Colorinternal_getColorFromColormap (const int &gray)
Colorinternal_getColorFromColormap (const String &colorName)
Colorinternal_getColorMatchFromColormap (const Color &color)
 finds the named color closest to a color with a given RGB value
void internal_printColorNameMap () const
 helper function to print the color map.
Enumerator< FontInfo > * internal_getAvailableSystemFonts ()
void initColorMap ()
void initColorNameMapItem (const VCF::String &colorName, const uint8 &r, const uint8 &g, const uint8 &b)
void destroyColorMaps ()
void destroySystemColorNameMap ()
virtual void initSystemFontNames ()
 this method should be overridden by implementers of the graphics toolkit and should initialize the availableSystemFonts_ vector with a series of FontInfo instances.
void initContentTypes ()

Protected Attributes

MapStringColor colorMap_
 maps for colors
MapStringColorNamecolorNameMap_
std::map< uint32, Color * > systemColors_
MapStringColorNamesystemColorNameMap_
std::vector< FontInfoavailableSystemFonts_
EnumeratorContainer< std::vector<
FontInfo >, FontInfo
fontInfoContainer_
std::map< String, StringcontentTypes_
std::map< String, ImageLoader * > imageLoaders_
 ImageLoaders are stored in a map, keyed by the MIME content type Thus JPEG loaders are stored under the key:.

Static Protected Attributes

static GraphicsToolkitgraphicsToolkitInstance

Detailed Description

The GraphicsToolkit serves as a way to retreive basic system information and as a factory for creating various graphics peers, like the ContextPeer, FontPeer, and the system implementation the Image class.


Member Typedef Documentation

typedef std::map<String,Color*> VCF::GraphicsToolkit::MapStringColor
 

typedef std::map<Color, VCF::String> VCF::GraphicsToolkit::MapStringColorName
 


Constructor & Destructor Documentation

VCF::GraphicsToolkit::GraphicsToolkit  ) 
 

virtual VCF::GraphicsToolkit::~GraphicsToolkit  )  [virtual]
 


Member Function Documentation

static ContextPeer* VCF::GraphicsToolkit::createContextPeer OSHandleID  contextID  )  [static]
 

static ContextPeer* VCF::GraphicsToolkit::createContextPeer const uint32 width,
const uint32 height
[static]
 

static FontPeer* VCF::GraphicsToolkit::createFontPeer const String fontName,
const double &  pointSize
[static]
 

static FontPeer* VCF::GraphicsToolkit::createFontPeer const String fontName  )  [static]
 

static GraphicsResourceBundlePeer* VCF::GraphicsToolkit::createGraphicsResourceBundlePeer  )  [static]
 

static Image* VCF::GraphicsToolkit::createImage const MIMEType type,
InputStream stream
[static]
 

static Image* VCF::GraphicsToolkit::createImage const MIMEType type,
const unsigned char *  imageData,
const uint64 dataLength
[static]
 

static Image* VCF::GraphicsToolkit::createImage const String fileName  )  [static]
 

Create a image from a filename.

The file is loaded into a Bitmap instance. The toolkit looks up the file extension and matches the type to an ImageLoader instance. The ImageLoader does the work of actually decoding the image

static Image* VCF::GraphicsToolkit::createImage GraphicsContext context,
Rect rect,
const Image::ImageType imageType = Image::itColor
[static]
 

static Image* VCF::GraphicsToolkit::createImage const uint32 width,
const uint32 height,
const Image::ImageType imageType = Image::itColor
[static]
 

static PrintSessionPeer* VCF::GraphicsToolkit::createPrintSessionPeer  )  [static]
 

void VCF::GraphicsToolkit::destroyColorMaps  )  [protected]
 

void VCF::GraphicsToolkit::destroySystemColorNameMap  )  [protected]
 

static bool VCF::GraphicsToolkit::getAvailableImageTypes std::vector< std::pair< String, String > > &  contentTypes  )  [static]
 

static Enumerator<FontInfo>* VCF::GraphicsToolkit::getAvailableSystemFonts  )  [static]
 

static Color* VCF::GraphicsToolkit::getColorFromColormap const String colorName  )  [static]
 

static Color* VCF::GraphicsToolkit::getColorFromColormap const int &  gray  )  [static]
 

static Color* VCF::GraphicsToolkit::getColorMatchFromColormap const Color color  )  [static]
 

finds the named color closest to another given one.

Parameters:
const Color& color, the given color.
Returns:
Color*, the closest color found. The color itself if it is in the map.

static String VCF::GraphicsToolkit::getColorNameFromMap const Color color  )  [static]
 

static Font* VCF::GraphicsToolkit::getDefaultSystemFont  )  [static]
 

Reimplemented in VCF::OSXGraphicsToolkit.

static double VCF::GraphicsToolkit::getDPI GraphicsContext context = NULL  )  [static]
 

Returns the crurent DPI for the screen if the context parameter is NULL, otherwise returns the dpi that is used by the graphics context.

static ImageLoader* VCF::GraphicsToolkit::getImageLoader const String contentType  )  [static]
 

static ImageLoader* VCF::GraphicsToolkit::getImageLoaderForFileName const String fileName  )  [static]
 

static GraphicsResourceBundle* VCF::GraphicsToolkit::getResourceBundle  )  [static]
 

static Color* VCF::GraphicsToolkit::getSystemColor const uint32 systemColor  )  [static]
 

static String VCF::GraphicsToolkit::getSystemColorNameFromMap Color color  )  [static]
 

void VCF::GraphicsToolkit::initColorMap  )  [protected]
 

void VCF::GraphicsToolkit::initColorNameMapItem const VCF::String colorName,
const uint8 r,
const uint8 g,
const uint8 b
[protected]
 

void VCF::GraphicsToolkit::initContentTypes  )  [protected]
 

static void VCF::GraphicsToolkit::initGraphicsToolkit  )  [static]
 

virtual void VCF::GraphicsToolkit::initSystemFontNames  )  [inline, protected, virtual]
 

this method should be overridden by implementers of the graphics toolkit and should initialize the availableSystemFonts_ vector with a series of FontInfo instances.

virtual ContextPeer* VCF::GraphicsToolkit::internal_createContextPeer OSHandleID  contextID  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual ContextPeer* VCF::GraphicsToolkit::internal_createContextPeer const uint32 width,
const uint32 height
[protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual FontPeer* VCF::GraphicsToolkit::internal_createFontPeer const String fontName,
const double &  pointSize
[protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual FontPeer* VCF::GraphicsToolkit::internal_createFontPeer const String fontName  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual GraphicsResourceBundlePeer* VCF::GraphicsToolkit::internal_createGraphicsResourceBundlePeer  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual Image* VCF::GraphicsToolkit::internal_createImage const MIMEType type,
InputStream stream
[protected, virtual]
 

virtual Image* VCF::GraphicsToolkit::internal_createImage const MIMEType type,
const unsigned char *  imageData,
const uint64 dataLength
[protected, virtual]
 

virtual Image* VCF::GraphicsToolkit::internal_createImage const String fileName  )  [protected, virtual]
 

Create a image from a filename.

The file is loaded into a Bitmap instance. The toolkit looks up the file extension and matches the type to an ImageLoader instance. The ImageLoader does the work of actually decoding the image

virtual Image* VCF::GraphicsToolkit::internal_createImage GraphicsContext context,
Rect rect,
const Image::ImageType imageType
[protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual Image* VCF::GraphicsToolkit::internal_createImage const uint32 width,
const uint32 height,
const Image::ImageType imageType
[protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

virtual PrintSessionPeer* VCF::GraphicsToolkit::internal_createPrintSessionPeer  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

Enumerator<FontInfo>* VCF::GraphicsToolkit::internal_getAvailableSystemFonts  )  [inline, protected]
 

Color* VCF::GraphicsToolkit::internal_getColorFromColormap const String colorName  )  [protected]
 

Color* VCF::GraphicsToolkit::internal_getColorFromColormap const int &  gray  )  [protected]
 

Color* VCF::GraphicsToolkit::internal_getColorMatchFromColormap const Color color  )  [protected]
 

finds the named color closest to a color with a given RGB value

virtual String VCF::GraphicsToolkit::internal_getColorNameFromMap const Color color  )  const [protected, virtual]
 

static GraphicsToolkit* VCF::GraphicsToolkit::internal_getDefaultGraphicsToolkit  )  [static]
 

virtual Font* VCF::GraphicsToolkit::internal_getDefaultSystemFont  )  [inline, protected, virtual]
 

Reimplemented in VCF::Win32GraphicsToolkit.

virtual double VCF::GraphicsToolkit::internal_getDPI GraphicsContext context  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

ImageLoader* VCF::GraphicsToolkit::internal_getImageLoader const String contentType  )  [protected]
 

ImageLoader* VCF::GraphicsToolkit::internal_getImageLoaderForFileName const String fileName  )  [protected]
 

virtual Color* VCF::GraphicsToolkit::internal_getSystemColor const uint32 systemColor  )  [protected, virtual]
 

virtual String VCF::GraphicsToolkit::internal_getSystemColorNameFromMap Color color  )  const [protected, virtual]
 

void VCF::GraphicsToolkit::internal_printColorNameMap  )  const [protected]
 

helper function to print the color map.

Used for debugging purposes.

void VCF::GraphicsToolkit::internal_registerImageLoader const String name,
ImageLoader imageLoader
[protected]
 

virtual void VCF::GraphicsToolkit::internal_saveImage const String fileName,
Image image
[protected, virtual]
 

virtual void VCF::GraphicsToolkit::internal_systemSettingsChanged  )  [protected, pure virtual]
 

Implemented in VCF::OSXGraphicsToolkit, VCF::Win32GraphicsToolkit, and VCF::XCBGraphicsToolkit.

static void VCF::GraphicsToolkit::printColorNameMap  )  [static]
 

static void VCF::GraphicsToolkit::registerImageLoader const String name,
ImageLoader imageLoader
[static]
 

static void VCF::GraphicsToolkit::saveImage const String fileName,
Image image
[static]
 

static void VCF::GraphicsToolkit::systemSettingsChanged  )  [static]
 

Call this function if you need to reload various toolkit resoruces due to a systems settings changes, for example teh user enabling or disabling themes.

static void VCF::GraphicsToolkit::terminate  )  [static]
 


Member Data Documentation

std::vector<FontInfo> VCF::GraphicsToolkit::availableSystemFonts_ [protected]
 

MapStringColor VCF::GraphicsToolkit::colorMap_ [protected]
 

maps for colors

MapStringColorName* VCF::GraphicsToolkit::colorNameMap_ [protected]
 

std::map<String,String> VCF::GraphicsToolkit::contentTypes_ [protected]
 

EnumeratorContainer<std::vector<FontInfo>,FontInfo> VCF::GraphicsToolkit::fontInfoContainer_ [protected]
 

GraphicsToolkit* VCF::GraphicsToolkit::graphicsToolkitInstance [static, protected]
 

std::map<String, ImageLoader*> VCF::GraphicsToolkit::imageLoaders_ [protected]
 

ImageLoaders are stored in a map, keyed by the MIME content type Thus JPEG loaders are stored under the key:.

        "image/jpeg"

MapStringColorName* VCF::GraphicsToolkit::systemColorNameMap_ [protected]
 

std::map<uint32,Color*> VCF::GraphicsToolkit::systemColors_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information