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

VCF::GraphicsContext Class Reference

A GraphicsContext provides the lowest level graphics interface to the native systems 2D drawing operations. More...

#include <vcf/GraphicsKit/GraphicsContext.h>

Inheritance diagram for VCF::GraphicsContext:

VCF::Object VCF::ControlGraphicsContext VCF::PrintContext VCF::OpenGLControlContext List of all members.

Public Types

typedef std::vector< GraphicsState * > GraphicsStateCollection
typedef GraphicsStateCollection::iterator GraphicsStateIterator
typedef GraphicsStateCollection::const_iterator GraphicsStateConstIterator
enum  DrawingOperation { doStroke, doFill, doText, doImage }
 represents what kind of high level drawing operation we are performing. More...
enum  GraphicsDrawingState { gsNone = 0, gsAddingGraphicsOps, gsExecutingGraphicsOps }
enum  TextDrawingOptions {
  tdoNone = 0, tdoWordWrap = 1, tdoLeftAlign = 2, tdoCenterHorzAlign = 4,
  tdoRightAlign = 8, tdoBottomAlign = 16, tdoCenterVertAlign = 32, tdoTopAlign = 64
}
 text drawing options More...
enum  EdgeType {
  etNoSides = 0x000, etLeftSide = 0x001, etRightSide = 0x002, etTopSide = 0x004,
  etBottomSide = 0x008, etAllSides = 0x00F, etRecessed = 0x010, etEtched = 0x020,
  etRaised = 0x030, etSunken = 0x040
}
enum  ThemeTextType {
  ttMenuItemFont = 0, ttSelectedMenuItemFont, ttSystemFont, ttSystemSmallFont,
  ttControlFont, ttMessageFont, ttToolTipFont
}
enum  CompositingMode {
  cmNone = 0xFF, cmClear = 0, cmSource, cmDestination,
  cmSrcOver, cmDestOver, cmSrcIn, cmDestIn,
  cmSrcOut, cmDestOut, cmSrcATop, cmDestATop,
  cmXOR, cmPlus, cmMinus, cmMultiply,
  cmScreen, cmOverlay, cmDarken, cmLighten,
  cmColorDodge, cmColorBurn, cmHardLight, cmSoftLight,
  cmExclusion, cmDifference, cmContrast, cmCustom
}
 These are the set of standard compositing or "blend" modes that the GraphicsContext supports. More...
enum  LineCapStyle { lcsButtCap = 0, lcsRoundCap, lcsSquareCap }
 The set of enum values define the standard line cap style. More...
enum  LineJoinStyle { ljsMiterJoin = 0, ljsRoundJoin, ljsBevelJoin }
 The set of enum values for defining the line join style. More...
enum  RenderAreaAlphaState { rasDefault = 0, rasNonDefaultAlphaVals, rasDirty }
 Describes the state of the alpha channel. More...

Public Member Functions

 GraphicsContext ()
 GraphicsContext (const uint32 &width, const uint32 &height)
 Creates a new blank graphics context of the specified width and height.
 GraphicsContext (OSHandleID contextID)
 Create a new context based on a context ID.
virtual ~GraphicsContext ()
void init ()
 This is going to be removed from the bext release.
ContextPeergetPeer ()
bool isAntiAliasingOn ()
void setAntiAliasingOn (bool antiAliasingOn)
void setCurrentFont (Font *font)
 sets the current font A copy of the Font is made when this is set
void setCurrentFont (const Font *font)
 sets the current font A copy of the Font is made when this is set
FontgetCurrentFont ()
 returns the current Font
void setCurrentFill (Fill *fill)
 sets the current fill
void setCurrentStroke (Stroke *stroke)
 sets the current stroke
void setClippingRect (Rect *rect)
void setClippingPath (Path *clippingPath)
Rect getClippingRect ()
PathgetClippingPath ()
Rect getViewableBounds ()
void setViewableBounds (const Rect &bounds)
void setRenderArea (Rect bounds)
 This method sets the image bounds for the drawing area image.
void deleteRenderArea ()
 This deletes the drawing area, and frees any resources associated with it.
void flushRenderArea ()
 Draws the drawing area image on to the graphics context.
void cacheRenderAreaAlpha ()
void resetRenderAreaAlpha ()
bool hasRenderArea ()
void renderAreaAlphaOverwritten ()
void setRenderAreaAlphaSize (bool usingNonDefaultAlpha)
ImagegetRenderArea ()
agg::rendering_buffer * getRenderingBuffer ()
void setRenderingBuffer (agg::rendering_buffer *buffer)
agg::scanline_u8 & internal_getRenderAreaScanline ()
int saveState ()
 saves the state of a Graphics context after the paint operations are done.
void restoreState (int state)
 Restores the state of a Graphics context after the paint operations are done.
LineCapStyle getLineCapStyle ()
 Returns the current line cap style.
void setLineCapStyle (LineCapStyle val)
 Sets the line cap style.
LineJoinStyle getLineJoinStyle ()
void setLineJoinStyle (LineJoinStyle val)
double getMiterLimit ()
 Returns the current miter limit.
void setMiterLimit (double val)
 Sets the current miter limit.
void setCompositingMode (CompositingMode compositeMode)
 Sets the current compositing mode.
CompositingMode getCompositingMode ()
 Returns the current composite mode.
void setColor (Color *color)
 Sets the current color of the graphics context to use for filling or stroking paths.
void setColor (const Color *color)
 Sets the current color of the graphics context to use for filling or stroking paths.
ColorgetColor ()
ImagegetAlphaMask ()
void setAlphaMask (Image *alphaMask)
void setOrigin (const double &x, const double &y)
 Sets the context's origin for drawing.
void setOrigin (const Point &pt)
Point getOrigin ()
void setRotation (const double &theta)
 sets the current rotation value of the transformation matrix.
void setTranslation (const double transX, const double &transY)
 Set the x and y translation values for the transformation matrix.
void setShear (const double &shearX, const double &shearY)
 Sets the x and y shear values, in degrees, for the transformation matrix.
void setScale (const double &scaleX, const double &scaleY)
 Sets the x and y scale values for the transformation matrix.
void concatRotation (const double &theta)
void concatTranslation (const double transX, const double &transY)
void concatShear (const double &shearX, const double &shearY)
void concatScale (const double &scaleX, const double &scaleY)
bool isDefaultTransform ()
 This test to see if the current rotation translation, scale, and shear values are all at their default values.
void makeDefaultTransform ()
 This (re)sets the current values for rotation, shear, scale, and translation to their default values.
double getRotation ()
double getTranslationX ()
double getTranslationY ()
double getShearX ()
double getShearY ()
double getScaleX ()
double getScaleY ()
bool isXORModeOn ()
void setXORModeOn (const bool &XORModeOn)
void setAlpha (const double &alpha)
double getAlpha ()
void copyContext (const Rect &sourceRect, const Rect &destRect, GraphicsContext *context)
void fillPath ()
void strokePath ()
void draw (Path *path)
 draws a path.
void drawImage (const double &x, const double &y, Image *image, const bool &renderImmediately=true)
 draws an image at the x,y, coordinates
void drawImage (const Point &pt, Image *image, const bool &renderImmediately=true)
void bitBlit (const double &x, const double &y, Image *image)
 "Blits" the image to the underlying graphics context.
void bitBlit (const Point &pt, Image *image)
void bitBlit (const double &x, const double &y, Rect *imageBounds, Image *image)
void bitBlit (const Point &pt, Rect *imageBounds, Image *image)
void drawImageWithState (const double &x, const double &y, Image *image, const bool &enabled, const bool &renderImmediately=true)
 draws an image at the x,y, coordinates, with state
void drawImageWithState (const Point &pt, Image *image, const bool &enabled, const bool &renderImmediately=true)
void drawImageWithinBounds (Rect *bounds, Image *image, const bool &renderImmediately=true)
 draws a portion of the image.
void drawPartialImage (const double &x, const double &y, Rect *imageBounds, Image *image, const bool &renderImmediately=true)
 draws a partial image at the x,y, coordinates specified
void drawPartialImage (const Point &pt, Rect *imageBounds, Image *image, const bool &renderImmediately=true)
void renderImages (bool freeImages=true)
void setCurrentTransform (const Matrix2D &transform)
Matrix2DgetCurrentTransform ()
void setStrokeWidth (const double &width)
 End of high level gaphics functions.
double getStrokeWidth ()
void textAt (const double &x, const double &y, const String &text)
void textAt (const Point &pt, const String &text)
void textAt (const double &x, const double &y, const String &text, const int32 drawOptions)
void textAt (const Point &pt, const String &text, const int32 drawOptions)
void textWithStateAt (const double &x, const double &y, const String &text, const bool &enabled)
void textWithStateAt (const Point &pt, const String &text, const bool &enabled)
void textBoundedBy (Rect *bounds, const String &text, const bool &wordWrap=true)
 draws text within the bounds specified.
void textBoundedBy (Rect *bounds, const String &text, const int32 drawOptions)
double getTextWidth (const String &text)
double getTextHeight (const String &text)
void rectangle (const double &x1, const double &y1, const double &x2, const double &y2)
void rectangle (const Rect &rc)
void rectangle (const Point &pt1, const Point &pt2)
void rectangle (Rect *r)
void lineTo (const double &x, const double &y)
void lineTo (const Point &pt)
void moveTo (const double &x, const double &y)
void moveTo (const Point &pt)
void closePath (const double &x, const double &y)
void closePath (const Point &pt)
void roundRect (const double &x1, const double &y1, const double &x2, const double &y2, const double &xc, const double &yc)
void roundRect (const Rect &rc, const Point &ptc)
void roundRect (const Point &pt1, const Point &pt2, const Point &ptc)
void roundRect (Rect *r, Point *p)
void circle (const double &x, const double &y, const double &radius)
void circle (const Point &pt, const double &radius)
void ellipse (const double &x1, const double &y1, const double &x2, const double &y2)
void ellipse (const Point &pt1, const Point &pt2)
void arc (const double &centerX, const double &centerY, const double &radiusWidth, const double &radiusHeight, const double &startAngle, const double &endAngle)
void arc (const Point &centerPt, const Size &radius, const double &startAngle, const double &endAngle)
void pie (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3, const double &x4, const double &y4)
void pie (const Point &pt1, const Point &pt2, const Point &pt3, const Point &pt4)
void chord (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3, const double &x4, const double &y4)
void chord (const Point &pt1, const Point &pt2, const Point &pt3, const Point &pt4)
void polyline (const std::vector< Point > &pts)
void curve (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3, const double &y3, const double &x4, const double &y4)
void curve (const Point &pt1, const Point &pt2, const Point &pt3, const Point &pt4)
void drawThemeSelectionRect (Rect *rect, DrawUIState &state)
 The following functions are related to theme compliant drawing.
void drawThemeFocusRect (Rect *rect, DrawUIState &state)
void drawThemeButtonRect (Rect *rect, ButtonState &state, Rect *captionRect=NULL)
void drawThemeButtonFocusRect (Rect *rect)
void drawThemeCheckboxRect (Rect *rect, ButtonState &state)
void drawThemeRadioButtonRect (Rect *rect, ButtonState &state)
void drawThemeComboboxRect (Rect *rect, ButtonState &state)
void drawThemeScrollButtonRect (Rect *rect, ScrollBarState &state)
void drawThemeDisclosureButton (Rect *rect, DisclosureButtonState &state)
 Draws a button that is used to open up more details, for example the button that opens up a tree node to reveal it's children, that is compliant with the native windowing systems default look and feel.
void drawThemeTab (Rect *rect, TabState &state)
 Draws a tab, the part of the TabbedPages control that acts like a little button to activate a page, that is compliant with the native windowing systems default look and feel.
void drawThemeTabPage (Rect *rect, DrawUIState &state)
 Draws a tab page - the page on which other controls for the page are parented to, that is compliant with the native windowing systems default look and feel.
void drawThemeTabContent (Rect *rect, DrawUIState &state)
void drawThemeTabs (Rect *rect, DrawUIState &paneState, TabState &selectedTabState, TabState &otherTabs, const std::vector< String > &tabNames, int selectedTabIndex)
void drawThemeTickMarks (Rect *rect, SliderState &state)
 Draws tick marks, like that used for a slider control, that is compliant with the native windowing systems default look and feel.
void drawThemeSlider (Rect *rect, SliderState &state)
 Draws a slider control, like that used for a slider control, that is compliant with the native windowing systems default look and feel.
void drawThemeProgress (Rect *rect, ProgressState &state)
 Draws a progress bar control, that is compliant with the native windowing systems default look and feel.
void drawThemeImage (Rect *rect, Image *image, DrawUIState &state)
void drawThemeHeader (Rect *rect, ButtonState &state)
 Draws a header control that is compliant with the native windowing systems default look and feel.
void drawThemeEdge (Rect *rect, DrawUIState &state, const int32 &edgeSides, const int32 &edgeStyle)
 draws edges, useful for separators, that is compliant with the native windowing systems default look and feel.
void drawThemeSizeGripper (Rect *rect, DrawUIState &state)
 Draws a size gripper for resizing a control/window that is compliant with the native windowing systems default look and feel.
void drawThemeBackground (Rect *rect, BackgroundState &state)
 Draws a them compliant background.
void drawThemeMenuItem (Rect *rect, MenuState &state)
 Draws the background appropriate for a menu item that is compliant with the native windowing systems default look and feel.
void drawThemeMenuItemText (Rect *rect, MenuState &state)
 Draws the menu items text such that it's compliant with the native windowing platform look and feel.
void drawThemeText (Rect *rect, TextState &state)

Protected Member Functions

void buildArc (double centerX, double centerY, double radiusWidth, double radiusHeight, double startAngle, double endAngle, std::vector< Point > &pts, const Matrix2D &transform)
void buildRoundRect (double x1, double y1, double x2, double y2, double cornerArcWidth, double cornerArcHeight, std::vector< Point > &pts, const Matrix2D &transform)
void buildEllipse (double x1, double y1, double x2, double y2, std::vector< Point > &pts, const Matrix2D &transform)
void checkPathOperations ()
void execPathOperations ()
void renderImage (agg::rendering_buffer &destBuffer, Rect &destRect, ImageOperation &imgOp)
Rect getRenderDestRect ()
Rect getTransformedImageRect (ImageOperation &imgOp)
Point getTransformedImagePoint (ImageOperation &imgOp)

Protected Attributes

ContextPeercontextPeer_
GraphicsDrawingState currentDrawingState_
std::vector< PointOperationpathOperations_
std::vector< ImageOperationimageOperations_
Rect viewableBounds_
RenderArea * renderArea_
GraphicsStateCollection stateCollection_
 the collection of all the saved Graphics states.
int graphicsStateIndex_
 the index of the current state in the collection of all the saved Graphics states.
GraphicsState * currentGraphicsState_
 the current Graphics state that has been saved.

Classes

struct  ImageOperation
struct  PointOperation

Detailed Description

A GraphicsContext provides the lowest level graphics interface to the native systems 2D drawing operations.

Based loosely on PostScript, a Context takes a series of of drawing operations, or commands (lineTo, moveTo, etc), and then executes them by either filling or strokeing the path(s) that result from the commands. Thus calling ellipse() will not draw anything till the strokePath() or fillPath() methods have been called. All path commands should add their information to a stack of some sort that is then looped through and executed using the appropriate native graphics calls. At each path command a test should be made as to whether the buffer should be cleared. The buffer should be cleared only after the stroke of fill methods have been called. For example:

    ellipse(23,23,45,67) //added to buffer
    moveTo(89,100) //add to buffer
    lineTo(300,40) //add to buffer
    strokePath()
    fillPath()
    rectangle(200,300,400,400)//buffer cleared, then add to buffer

Version:
1.0
Author:
Jim Crafton


Member Typedef Documentation

typedef std::vector<GraphicsState*> VCF::GraphicsContext::GraphicsStateCollection
 

typedef GraphicsStateCollection::const_iterator VCF::GraphicsContext::GraphicsStateConstIterator
 

typedef GraphicsStateCollection::iterator VCF::GraphicsContext::GraphicsStateIterator
 


Member Enumeration Documentation

enum VCF::GraphicsContext::CompositingMode
 

These are the set of standard compositing or "blend" modes that the GraphicsContext supports.

The last mode, cmCustom, is for future use, and will allow some custom compositing function to be used. The blend/compositing modes below are the same as used in AGG and in the PDF specification. [todo] We should have some little pictures of what each blend mode looks like... [/todo]

Enumerator:
cmNone 
cmClear 
cmSource 
cmDestination 
cmSrcOver 
cmDestOver 
cmSrcIn 
cmDestIn 
cmSrcOut 
cmDestOut 
cmSrcATop 
cmDestATop 
cmXOR 
cmPlus 
cmMinus 
cmMultiply 
cmScreen 
cmOverlay 
cmDarken 
cmLighten 
cmColorDodge 
cmColorBurn 
cmHardLight 
cmSoftLight 
cmExclusion 
cmDifference 
cmContrast 
cmCustom 

enum VCF::GraphicsContext::DrawingOperation
 

represents what kind of high level drawing operation we are performing.

We can stroke a path, fill a path, draw an image, or draw text. This is used by the ConextPeer's prepareForDrawing() so it know's how best to prepare the low level graphics resources. For example strokePath() would call the ConextPeer's prepareForDrawing() and pass in GraphicsContext::doStroke, indicating that any upcoming calls to moveTo, lineTo, rectangle, etc will be drawn using the attributes of the GraphicsContext's stroke.

Enumerator:
doStroke 
doFill 
doText 
doImage 

enum VCF::GraphicsContext::EdgeType
 

Enumerator:
etNoSides 
etLeftSide 
etRightSide 
etTopSide 
etBottomSide 
etAllSides 
etRecessed 
etEtched 
etRaised 
etSunken 

enum VCF::GraphicsContext::GraphicsDrawingState
 

Enumerator:
gsNone 
gsAddingGraphicsOps 
gsExecutingGraphicsOps 

enum VCF::GraphicsContext::LineCapStyle
 

The set of enum values define the standard line cap style.

These are the same line cap styles that the PDF spec and Win32 uses.

Enumerator:
lcsButtCap 
lcsRoundCap 
lcsSquareCap 

enum VCF::GraphicsContext::LineJoinStyle
 

The set of enum values for defining the line join style.

These values are the same as those found in the PDF spec and Win32.

Enumerator:
ljsMiterJoin 
ljsRoundJoin 
ljsBevelJoin 

enum VCF::GraphicsContext::RenderAreaAlphaState
 

Describes the state of the alpha channel.

The state is used to check whether or not the render area's alpha values have been accidentally overwritten by native GDI calls. If they have, we can then reset them back to 255, which is the default value.

The default state is rasDefault, which means that all the render area's alpha values are at 0xFF (255).

When the graphics context's drawing routine's are called they may, depending on the platform, overwrite the render area's alpha values. If this happens then the state must be set to rasDirty, indicating that the graphics context needs to reset the alpha values back to the original state before any drawing gets done that depends on accurate alpha values being present in the render area's buffer.

If the alpha values of the render area have been modified by the programmer and need to be retained, then the default state should be changed from rasDefault to rasNonDefaultAlphaVals.

Enumerator:
rasDefault 
rasNonDefaultAlphaVals 
rasDirty 

enum VCF::GraphicsContext::TextDrawingOptions
 

text drawing options

Enumerator:
tdoNone 
tdoWordWrap 
tdoLeftAlign 
tdoCenterHorzAlign 
tdoRightAlign 
tdoBottomAlign 
tdoCenterVertAlign 
tdoTopAlign 

enum VCF::GraphicsContext::ThemeTextType
 

Enumerator:
ttMenuItemFont 
ttSelectedMenuItemFont 
ttSystemFont 
ttSystemSmallFont 
ttControlFont 
ttMessageFont 
ttToolTipFont 


Constructor & Destructor Documentation

VCF::GraphicsContext::GraphicsContext  ) 
 

VCF::GraphicsContext::GraphicsContext const uint32 width,
const uint32 height
 

Creates a new blank graphics context of the specified width and height.

VCF::GraphicsContext::GraphicsContext OSHandleID  contextID  ) 
 

Create a new context based on a context ID.

See ContextPeer getContextID() Doing this should caryy over any of the current settings of the context that the contextID represents.

virtual VCF::GraphicsContext::~GraphicsContext  )  [virtual]
 


Member Function Documentation

void VCF::GraphicsContext::arc const Point centerPt,
const Size radius,
const double &  startAngle,
const double &  endAngle
[inline]
 

void VCF::GraphicsContext::arc const double &  centerX,
const double &  centerY,
const double &  radiusWidth,
const double &  radiusHeight,
const double &  startAngle,
const double &  endAngle
 

void VCF::GraphicsContext::bitBlit const Point pt,
Rect imageBounds,
Image image
[inline]
 

void VCF::GraphicsContext::bitBlit const double &  x,
const double &  y,
Rect imageBounds,
Image image
 

void VCF::GraphicsContext::bitBlit const Point pt,
Image image
[inline]
 

void VCF::GraphicsContext::bitBlit const double &  x,
const double &  y,
Image image
 

"Blits" the image to the underlying graphics context.

No attempt is made to transform the image. The image is blitted to the coordinates specified by the x and y arguments, and the image's width and height are used to determine the bounds.

void VCF::GraphicsContext::buildArc double  centerX,
double  centerY,
double  radiusWidth,
double  radiusHeight,
double  startAngle,
double  endAngle,
std::vector< Point > &  pts,
const Matrix2D transform
[protected]
 

void VCF::GraphicsContext::buildEllipse double  x1,
double  y1,
double  x2,
double  y2,
std::vector< Point > &  pts,
const Matrix2D transform
[protected]
 

void VCF::GraphicsContext::buildRoundRect double  x1,
double  y1,
double  x2,
double  y2,
double  cornerArcWidth,
double  cornerArcHeight,
std::vector< Point > &  pts,
const Matrix2D transform
[protected]
 

void VCF::GraphicsContext::cacheRenderAreaAlpha  ) 
 

void VCF::GraphicsContext::checkPathOperations  )  [protected]
 

void VCF::GraphicsContext::chord const Point pt1,
const Point pt2,
const Point pt3,
const Point pt4
[inline]
 

void VCF::GraphicsContext::chord const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  x3,
const double &  y3,
const double &  x4,
const double &  y4
 

void VCF::GraphicsContext::circle const Point pt,
const double &  radius
[inline]
 

void VCF::GraphicsContext::circle const double &  x,
const double &  y,
const double &  radius
 

void VCF::GraphicsContext::closePath const Point pt  )  [inline]
 

void VCF::GraphicsContext::closePath const double &  x,
const double &  y
 

void VCF::GraphicsContext::concatRotation const double &  theta  ) 
 

void VCF::GraphicsContext::concatScale const double &  scaleX,
const double &  scaleY
 

void VCF::GraphicsContext::concatShear const double &  shearX,
const double &  shearY
 

void VCF::GraphicsContext::concatTranslation const double  transX,
const double &  transY
 

void VCF::GraphicsContext::copyContext const Rect sourceRect,
const Rect destRect,
GraphicsContext context
 

void VCF::GraphicsContext::curve const Point pt1,
const Point pt2,
const Point pt3,
const Point pt4
[inline]
 

void VCF::GraphicsContext::curve const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  x3,
const double &  y3,
const double &  x4,
const double &  y4
 

void VCF::GraphicsContext::deleteRenderArea  ) 
 

This deletes the drawing area, and frees any resources associated with it.

void VCF::GraphicsContext::draw Path path  ) 
 

draws a path.

See Path for more info. Basically this simple enumerates all the path points and uses the current stroke and fill to render the shape

void VCF::GraphicsContext::drawImage const Point pt,
Image image,
const bool &  renderImmediately = true
[inline]
 

void VCF::GraphicsContext::drawImage const double &  x,
const double &  y,
Image image,
const bool &  renderImmediately = true
 

draws an image at the x,y, coordinates

void VCF::GraphicsContext::drawImageWithinBounds Rect bounds,
Image image,
const bool &  renderImmediately = true
 

draws a portion of the image.

Parameters:
Rect boudns - the left_, top_ members of the bounds rect describe where on the GraphicsContext the image will be drawn, while the height and width of the bounds tells how much of the image to draw. A height or width greater than the Image is ignored, and the whole image is draw. A height or width less than the image results in only a portion of the image getting drawn, or the top, left of the image to the specified height and width.
Image the image to draw

void VCF::GraphicsContext::drawImageWithState const Point pt,
Image image,
const bool &  enabled,
const bool &  renderImmediately = true
[inline]
 

void VCF::GraphicsContext::drawImageWithState const double &  x,
const double &  y,
Image image,
const bool &  enabled,
const bool &  renderImmediately = true
 

draws an image at the x,y, coordinates, with state

Parameters:
double x coordinate
double y coordinate
Image the image to draw
bool the state of the image, if true then draws the image normally, if false draws a grayed out and embossed version Note: as of 8/4/2001 not implemented yet

void VCF::GraphicsContext::drawPartialImage const Point pt,
Rect imageBounds,
Image image,
const bool &  renderImmediately = true
[inline]
 

void VCF::GraphicsContext::drawPartialImage const double &  x,
const double &  y,
Rect imageBounds,
Image image,
const bool &  renderImmediately = true
 

draws a partial image at the x,y, coordinates specified

Parameters:
double x - the x coordinate on the GraphicsContext
double y - the y coordinate on the GraphicsContext
Rect* imageBounds - a rectangle in the coordinate space of the image that specifies which rectangular portion of the image to draw
Image image - the image to draw

void VCF::GraphicsContext::drawThemeBackground Rect rect,
BackgroundState state
 

Draws a them compliant background.

void VCF::GraphicsContext::drawThemeButtonFocusRect Rect rect  ) 
 

void VCF::GraphicsContext::drawThemeButtonRect Rect rect,
ButtonState state,
Rect captionRect = NULL
 

void VCF::GraphicsContext::drawThemeCheckboxRect Rect rect,
ButtonState state
 

void VCF::GraphicsContext::drawThemeComboboxRect Rect rect,
ButtonState state
 

void VCF::GraphicsContext::drawThemeDisclosureButton Rect rect,
DisclosureButtonState state
 

Draws a button that is used to open up more details, for example the button that opens up a tree node to reveal it's children, that is compliant with the native windowing systems default look and feel.

On Win32 this is usually represented by the "+" and "-" look as found on the tree controls, while on OSX it is the little triangles

void VCF::GraphicsContext::drawThemeEdge Rect rect,
DrawUIState state,
const int32 edgeSides,
const int32 edgeStyle
 

draws edges, useful for separators, that is compliant with the native windowing systems default look and feel.

use a mask or 1 or more values of type ContextPeer::EdgeType to indicate which sides of the rect to draw an edge on

void VCF::GraphicsContext::drawThemeFocusRect Rect rect,
DrawUIState state
 

void VCF::GraphicsContext::drawThemeHeader Rect rect,
ButtonState state
 

Draws a header control that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeImage Rect rect,
Image image,
DrawUIState state
 

void VCF::GraphicsContext::drawThemeMenuItem Rect rect,
MenuState state
 

Draws the background appropriate for a menu item that is compliant with the native windowing systems default look and feel.

This is typically called first by a menu item to give it a standard look and feel in it's background before drawing any thing else

void VCF::GraphicsContext::drawThemeMenuItemText Rect rect,
MenuState state
 

Draws the menu items text such that it's compliant with the native windowing platform look and feel.

This will take into consideration the accelerator values if present.

void VCF::GraphicsContext::drawThemeProgress Rect rect,
ProgressState state
 

Draws a progress bar control, that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeRadioButtonRect Rect rect,
ButtonState state
 

void VCF::GraphicsContext::drawThemeScrollButtonRect Rect rect,
ScrollBarState state
 

void VCF::GraphicsContext::drawThemeSelectionRect Rect rect,
DrawUIState state
 

The following functions are related to theme compliant drawing.

These allow the VCF to properly draw various "parts" of the windowing system that are compliant with the windowing system's "theme" or visual style.

void VCF::GraphicsContext::drawThemeSizeGripper Rect rect,
DrawUIState state
 

Draws a size gripper for resizing a control/window that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeSlider Rect rect,
SliderState state
 

Draws a slider control, like that used for a slider control, that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeTab Rect rect,
TabState state
 

Draws a tab, the part of the TabbedPages control that acts like a little button to activate a page, that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeTabContent Rect rect,
DrawUIState state
 

void VCF::GraphicsContext::drawThemeTabPage Rect rect,
DrawUIState state
 

Draws a tab page - the page on which other controls for the page are parented to, that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::drawThemeTabs Rect rect,
DrawUIState paneState,
TabState selectedTabState,
TabState otherTabs,
const std::vector< String > &  tabNames,
int  selectedTabIndex
 

void VCF::GraphicsContext::drawThemeText Rect rect,
TextState state
 

void VCF::GraphicsContext::drawThemeTickMarks Rect rect,
SliderState state
 

Draws tick marks, like that used for a slider control, that is compliant with the native windowing systems default look and feel.

void VCF::GraphicsContext::ellipse const Point pt1,
const Point pt2
[inline]
 

void VCF::GraphicsContext::ellipse const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2
 

void VCF::GraphicsContext::execPathOperations  )  [protected]
 

void VCF::GraphicsContext::fillPath  ) 
 

void VCF::GraphicsContext::flushRenderArea  ) 
 

Draws the drawing area image on to the graphics context.

double VCF::GraphicsContext::getAlpha  ) 
 

Image* VCF::GraphicsContext::getAlphaMask  ) 
 

Path* VCF::GraphicsContext::getClippingPath  ) 
 

Rect VCF::GraphicsContext::getClippingRect  ) 
 

Color* VCF::GraphicsContext::getColor  ) 
 

CompositingMode VCF::GraphicsContext::getCompositingMode  ) 
 

Returns the current composite mode.

Font* VCF::GraphicsContext::getCurrentFont  ) 
 

returns the current Font

Matrix2D* VCF::GraphicsContext::getCurrentTransform  ) 
 

LineCapStyle VCF::GraphicsContext::getLineCapStyle  ) 
 

Returns the current line cap style.

LineJoinStyle VCF::GraphicsContext::getLineJoinStyle  ) 
 

double VCF::GraphicsContext::getMiterLimit  ) 
 

Returns the current miter limit.

The default value for this is 1.0 (for now).

Point VCF::GraphicsContext::getOrigin  ) 
 

ContextPeer* VCF::GraphicsContext::getPeer  ) 
 

Image* VCF::GraphicsContext::getRenderArea  ) 
 

Rect VCF::GraphicsContext::getRenderDestRect  )  [protected]
 

agg::rendering_buffer* VCF::GraphicsContext::getRenderingBuffer  ) 
 

double VCF::GraphicsContext::getRotation  ) 
 

double VCF::GraphicsContext::getScaleX  ) 
 

double VCF::GraphicsContext::getScaleY  ) 
 

double VCF::GraphicsContext::getShearX  ) 
 

double VCF::GraphicsContext::getShearY  ) 
 

double VCF::GraphicsContext::getStrokeWidth  ) 
 

double VCF::GraphicsContext::getTextHeight const String text  ) 
 

double VCF::GraphicsContext::getTextWidth const String text  ) 
 

Point VCF::GraphicsContext::getTransformedImagePoint ImageOperation imgOp  )  [protected]
 

Rect VCF::GraphicsContext::getTransformedImageRect ImageOperation imgOp  )  [protected]
 

double VCF::GraphicsContext::getTranslationX  ) 
 

double VCF::GraphicsContext::getTranslationY  ) 
 

Rect VCF::GraphicsContext::getViewableBounds  )  [inline]
 

bool VCF::GraphicsContext::hasRenderArea  ) 
 

void VCF::GraphicsContext::init  ) 
 

This is going to be removed from the bext release.

Deprecated:

Reimplemented from VCF::Object.

Reimplemented in VCF::ControlGraphicsContext, and VCF::OpenGLControlContext.

agg::scanline_u8& VCF::GraphicsContext::internal_getRenderAreaScanline  ) 
 

bool VCF::GraphicsContext::isAntiAliasingOn  ) 
 

bool VCF::GraphicsContext::isDefaultTransform  ) 
 

This test to see if the current rotation translation, scale, and shear values are all at their default values.

bool VCF::GraphicsContext::isXORModeOn  ) 
 

Deprecated:
use getCompositingMode and check to see if the GraphicsContext::cmXOR is the current composite mode.

void VCF::GraphicsContext::lineTo const Point pt  )  [inline]
 

void VCF::GraphicsContext::lineTo const double &  x,
const double &  y
 

void VCF::GraphicsContext::makeDefaultTransform  ) 
 

This (re)sets the current values for rotation, shear, scale, and translation to their default values.

void VCF::GraphicsContext::moveTo const Point pt  )  [inline]
 

void VCF::GraphicsContext::moveTo const double &  x,
const double &  y
 

void VCF::GraphicsContext::pie const Point pt1,
const Point pt2,
const Point pt3,
const Point pt4
[inline]
 

void VCF::GraphicsContext::pie const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  x3,
const double &  y3,
const double &  x4,
const double &  y4
 

void VCF::GraphicsContext::polyline const std::vector< Point > &  pts  ) 
 

void VCF::GraphicsContext::rectangle Rect r  )  [inline]
 

void VCF::GraphicsContext::rectangle const Point pt1,
const Point pt2
[inline]
 

void VCF::GraphicsContext::rectangle const Rect rc  )  [inline]
 

void VCF::GraphicsContext::rectangle const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2
 

void VCF::GraphicsContext::renderAreaAlphaOverwritten  ) 
 

void VCF::GraphicsContext::renderImage agg::rendering_buffer &  destBuffer,
Rect destRect,
ImageOperation imgOp
[protected]
 

void VCF::GraphicsContext::renderImages bool  freeImages = true  ) 
 

void VCF::GraphicsContext::resetRenderAreaAlpha  ) 
 

void VCF::GraphicsContext::restoreState int  state  ) 
 

Restores the state of a Graphics context after the paint operations are done.

Parameters:
int state, the index of the graphics state we want to restore. All the graphics states saved after this index are lost as they have lost meaning, and the current graphics state index is set to the state just restored.
See also:
GraphicsContext::saveState()

void VCF::GraphicsContext::roundRect Rect r,
Point p
[inline]
 

void VCF::GraphicsContext::roundRect const Point pt1,
const Point pt2,
const Point ptc
[inline]
 

void VCF::GraphicsContext::roundRect const Rect rc,
const Point ptc
[inline]
 

void VCF::GraphicsContext::roundRect const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  xc,
const double &  yc
 

int VCF::GraphicsContext::saveState  ) 
 

saves the state of a Graphics context after the paint operations are done.

The save/restore idea idea is the same as for Win32 SaveDC and RestoreDC. It allows you to save the state of the DC (device context) at a given point in time, and then make a whole bunch of changes to it, and when you're all done just call RestoreDC() and everything is set back.

This prevents all sorts of extra SelectObject() calls and is more efficent.

Similarly this makes it easy to guarantee that the state of the GraphicsContext is reset correctly.

Returns:
int, the index of the newly saved graphics state.
See also:
GraphicsContext::restoreState()

void VCF::GraphicsContext::setAlpha const double &  alpha  ) 
 

void VCF::GraphicsContext::setAlphaMask Image alphaMask  ) 
 

void VCF::GraphicsContext::setAntiAliasingOn bool  antiAliasingOn  ) 
 

void VCF::GraphicsContext::setClippingPath Path clippingPath  ) 
 

void VCF::GraphicsContext::setClippingRect Rect rect  ) 
 

void VCF::GraphicsContext::setColor const Color color  ) 
 

Sets the current color of the graphics context to use for filling or stroking paths.

void VCF::GraphicsContext::setColor Color color  ) 
 

Sets the current color of the graphics context to use for filling or stroking paths.

Deprecated:

void VCF::GraphicsContext::setCompositingMode CompositingMode  compositeMode  ) 
 

Sets the current compositing mode.

The default value for the compositing mode is cmSource. When drawing without anti-aliasing support, most of these modes will be ignored with the exception of cmXOR. Setting the composite mode to cmXOR takes the place of calling setXORModeOn(true), while setting the composite mode to cmSource is the same as setXORModeOn( false ).

When anti-aliased drawing is used, then the compositing value is checked when drawing with a Stroke or Fill class.

The composite value effects how colors for new graphic elements are blended with colors of existing graphic elements.

void VCF::GraphicsContext::setCurrentFill Fill fill  ) 
 

sets the current fill

See also:
Fill

void VCF::GraphicsContext::setCurrentFont const Font font  ) 
 

sets the current font A copy of the Font is made when this is set

void VCF::GraphicsContext::setCurrentFont Font font  ) 
 

sets the current font A copy of the Font is made when this is set

Deprecated:

void VCF::GraphicsContext::setCurrentStroke Stroke stroke  ) 
 

sets the current stroke

See also:
Stroke

void VCF::GraphicsContext::setCurrentTransform const Matrix2D transform  ) 
 

void VCF::GraphicsContext::setLineCapStyle LineCapStyle  val  ) 
 

Sets the line cap style.

void VCF::GraphicsContext::setLineJoinStyle LineJoinStyle  val  ) 
 

void VCF::GraphicsContext::setMiterLimit double  val  ) 
 

Sets the current miter limit.

The miter limit is the amount to extend a miter join between two angled lines.

void VCF::GraphicsContext::setOrigin const Point pt  )  [inline]
 

void VCF::GraphicsContext::setOrigin const double &  x,
const double &  y
 

Sets the context's origin for drawing.

The default is 0,0 in the top, left of the corner of screen real estate the context represents

void VCF::GraphicsContext::setRenderArea Rect  bounds  ) 
 

This method sets the image bounds for the drawing area image.

This gets called by the framework to designate an image that should be used to draw on, essectially a "back buffer" that can be used to draw on, and then blitted back onto the GraphicsContext. This is used to draw on for anti-aliased graphics.

void VCF::GraphicsContext::setRenderAreaAlphaSize bool  usingNonDefaultAlpha  ) 
 

void VCF::GraphicsContext::setRenderingBuffer agg::rendering_buffer *  buffer  ) 
 

void VCF::GraphicsContext::setRotation const double &  theta  ) 
 

sets the current rotation value of the transformation matrix.

The theta argument is in degrees.

void VCF::GraphicsContext::setScale const double &  scaleX,
const double &  scaleY
 

Sets the x and y scale values for the transformation matrix.

To double the size of drawn elements use a scaleX value of 2.0 and a scaleY value of 2.0. To flip the y coordinates use a scaleY of -1.0.

void VCF::GraphicsContext::setShear const double &  shearX,
const double &  shearY
 

Sets the x and y shear values, in degrees, for the transformation matrix.

void VCF::GraphicsContext::setStrokeWidth const double &  width  ) 
 

End of high level gaphics functions.

The funtions below are lower level See ContextPeer for more information on the functions below

void VCF::GraphicsContext::setTranslation const double  transX,
const double &  transY
 

Set the x and y translation values for the transformation matrix.

void VCF::GraphicsContext::setViewableBounds const Rect bounds  )  [inline]
 

void VCF::GraphicsContext::setXORModeOn const bool &  XORModeOn  ) 
 

Deprecated:
use setCompositingMode and pass in GraphicsContext::cmXOR for the current composite mode.

void VCF::GraphicsContext::strokePath  ) 
 

void VCF::GraphicsContext::textAt const Point pt,
const String text,
const int32  drawOptions
[inline]
 

void VCF::GraphicsContext::textAt const double &  x,
const double &  y,
const String text,
const int32  drawOptions
 

void VCF::GraphicsContext::textAt const Point pt,
const String text
[inline]
 

void VCF::GraphicsContext::textAt const double &  x,
const double &  y,
const String text
 

void VCF::GraphicsContext::textBoundedBy Rect bounds,
const String text,
const int32  drawOptions
 

void VCF::GraphicsContext::textBoundedBy Rect bounds,
const String text,
const bool &  wordWrap = true
 

draws text within the bounds specified.

If specified the text will be word wrapped within the bounds.

Parameters:
Rect bounds - the left, top, right, and bottom of the rectangle to draw the text within
String the text to draw
bool wordWrap whether or not wrap the text to bounds specified. If wordWrap is false, then the text is treated as a single line, and any text extending past the right coordinate value will be clipped using an ellipsis. So if "Hello World" is passed in and the bounds only fits "Hello W", then the string will be drawn as "Hello..."

void VCF::GraphicsContext::textWithStateAt const Point pt,
const String text,
const bool &  enabled
[inline]
 

void VCF::GraphicsContext::textWithStateAt const double &  x,
const double &  y,
const String text,
const bool &  enabled
 


Member Data Documentation

ContextPeer* VCF::GraphicsContext::contextPeer_ [protected]
 

GraphicsDrawingState VCF::GraphicsContext::currentDrawingState_ [protected]
 

GraphicsState* VCF::GraphicsContext::currentGraphicsState_ [protected]
 

the current Graphics state that has been saved.

See also:
GraphicsContext::saveState()

int VCF::GraphicsContext::graphicsStateIndex_ [protected]
 

the index of the current state in the collection of all the saved Graphics states.

See also:
GraphicsContext::saveState()

std::vector<ImageOperation> VCF::GraphicsContext::imageOperations_ [protected]
 

std::vector<PointOperation> VCF::GraphicsContext::pathOperations_ [protected]
 

RenderArea* VCF::GraphicsContext::renderArea_ [protected]
 

GraphicsStateCollection VCF::GraphicsContext::stateCollection_ [protected]
 

the collection of all the saved Graphics states.

See also:
GraphicsContext::saveState()

Rect VCF::GraphicsContext::viewableBounds_ [protected]
 


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