|
CartoType API
|
#include <cartotype_graphics.h>
Public Types | |
| enum | { EDrawShapeAntiAlias = 1, EDrawShape6BitFractionalPixels = 2, EDrawShapeEvenOddFill = 4 } |
Public Member Functions | |
| virtual void | Sync ()=0 |
| virtual TResult | DrawBitmap (const TBitmap &aBitmap, const TPoint &aTopLeft)=0 |
| virtual TResult | DrawShape (const MPath &aPath, uint32 aFlags)=0 |
| virtual void | Clear ()=0 |
| virtual CT_IMPORT TResult | DrawRect (const TRect &aRect) |
| virtual CT_IMPORT bool | TransformsPoints () |
| virtual CT_IMPORT TResult | Transform (TPoint &aPoint, int32 aFractionalBits) |
| virtual CT_IMPORT void | InverseTransform (TPoint &aPoint, int32 aFractionalBits) |
| virtual CT_IMPORT bool | EnableTransform (bool aEnable) |
| virtual CT_IMPORT void | OnViewResize (int32 aWidth, int32 aHeight) |
| virtual CT_IMPORT TBitmap * | Bitmap () |
| virtual CT_IMPORT TBitmap * | PushBitmap (TResult &aError) |
| virtual CT_IMPORT TResult | PopBitmap (TBitmap *aBitmap) |
| virtual CT_IMPORT TBitmap * | DeleteButKeepBitmap (CGraphicsContext *&aGc) |
| virtual CT_IMPORT TResult | DrawTexture (const CTexture &aTexture, const TPointFP &aTopLeft, const TTransformFP &aTransform) |
| virtual CT_IMPORT TResult | DrawStroke (const MPath &aPath, uint32 aFlags, const TTransform *aTransform=NULL) |
| CT_IMPORT TResult | DrawShapeAndStroke (const MPath &aPath, uint32 aFlags, const TPaint &aStrokePaint, const TTransform *aTransform=NULL) |
| CT_IMPORT void | SetClip (const TRect &aClip) |
| CT_IMPORT void | SetColor (TColor aColor) |
| CT_IMPORT void | SetPaintServer (MPaintServer *aPaintServer) |
| CT_IMPORT void | SetPaint (const TPaint &aPaint) |
| CT_IMPORT void | SetAlpha (int32 aAlpha) |
| CT_IMPORT void | SetCompositingOp (TCompositingOp aOp) |
| CT_IMPORT void | SetTextureMask (TColor aColor) |
| CT_IMPORT void | SetParam (TGraphicsParam &aParam) |
| CT_IMPORT void | SetPen (const TCircularPen &aPen) |
| CT_IMPORT TResult | DrawLoggedText (int32 aIndex) |
| CT_IMPORT void | InverseTransformRect (TRect &aRect, int32 aFractionalBits) |
| CEngine & | Engine () |
| const TRect & | Clip () const |
| const TPaint & | Paint () const |
| TColor | Color () const |
| int32 | Alpha () const |
| const TRect & | Bounds () const |
| MPaintServer * | PaintServer () const |
| void | SetPalette (const MPalette *aPalette) |
| const MPalette * | Palette () const |
| const TCircularPen & | Pen () const |
| void | SetDashArray (const CDashArray *aDashArray) |
| const CDashArray * | DashArray () const |
| const TGraphicsParam & | Param () const |
Static Public Member Functions | |
| static uint8 | MultiplyIntensities (int aIntensity1, int aIntensity2) |
| static uint8 | AlphaBlend (int aForeground, int aBackground, int aAlpha) |
Protected Types | |
| enum | { EClipChanged = 1, EPaintChanged = 2, EGlowColorChanged = 4, ECompositingOpChanged = 8, ETextureMaskChanged = 16, EAllChanged = -1 } |
Protected Member Functions | |
| TResult | DrawDashedStroke (const MPath &aPath, uint32 aFlags, const TTransform *aTransform) |
| CGraphicsContext (CEngine &aEngine, const TRect &aBounds) | |
Protected Attributes | |
| CEngine & | iEngine |
| TGraphicsParam | iParam |
| TRect | iBounds |
| int32 | iChangeFlags |
The base graphics context class. A graphics context draws to a raster drawing surface with square pixels.
| anonymous enum |
Flags used when drawing shapes.
anonymous enum [protected] |
Bit values for iChangeFlags.
| CartoType::CGraphicsContext::CGraphicsContext | ( | CEngine & | aEngine, |
| const TRect & | aBounds | ||
| ) | [inline, protected] |
Construct a graphics context to draw into aBounds.
| int32 CartoType::CGraphicsContext::Alpha | ( | ) | const [inline] |
Return the current alpha (opacity) level as a number in the range 0 ... 255.
| static uint8 CartoType::CGraphicsContext::AlphaBlend | ( | int | aForeground, |
| int | aBackground, | ||
| int | aAlpha | ||
| ) | [inline, static] |
Blend aForeground and aBackground in the proportion aAlpha. All three numbers are intensities in the range 0...255.
| CT_EXPORT TBitmap * CGraphicsContext::Bitmap | ( | ) | [virtual] |
Return the bitmap drawn to by the graphics context, if any. If the graphics context does not draw to a bitmap return NULL. The default implementation returns null.
Reimplemented in CartoType::CBitmapGraphicsContext, and CartoType::CPerspectiveGraphicsContext.
| const TRect& CartoType::CGraphicsContext::Bounds | ( | ) | const [inline] |
Return the rectangle that the graphics context draws to if no clipping is done.
| virtual void CartoType::CGraphicsContext::Clear | ( | ) | [pure virtual] |
Clear the drawing area to transparent black. If colors are not stored set all pixels to zero intensity. If transparency levels are not stored set all pixels to black.
Implemented in CartoType::C8BitTwinBitmapGraphicsContext, CartoType::C8BitMonoBitmapGraphicsContext, CartoType::C32BitColorBitmapGraphicsContext, CartoType::C24BitColorBitmapGraphicsContext, CartoType::C16BitColorBitmapGraphicsContext, CartoType::TTestZGraphicsContext, CartoType::TTestLabelGraphicsContext, CartoType::CPerspectiveGraphicsContext, and CartoType::COpenGlGraphicsContext.
| const TRect& CartoType::CGraphicsContext::Clip | ( | ) | const [inline] |
Return the clipping rectangle.
| TColor CartoType::CGraphicsContext::Color | ( | ) | const [inline] |
Return the current color as an RGBA value including the alpha channel.
| const CDashArray* CartoType::CGraphicsContext::DashArray | ( | ) | const [inline] |
Return the current dash array.
| CT_EXPORT TBitmap * CGraphicsContext::DeleteButKeepBitmap | ( | CGraphicsContext *& | aGc | ) | [virtual] |
Delete the graphics context, setting the pointer aGc to null, but preserve and return its bitmap. Do nothing if the operation is impossible. The base implementation does nothing.
Reimplemented in CartoType::CBitmapGraphicsContext.
| virtual TResult CartoType::CGraphicsContext::DrawBitmap | ( | const TBitmap & | aBitmap, |
| const TPoint & | aTopLeft | ||
| ) | [pure virtual] |
Draw a bitmap. If the bitmap has no color information use the current color. Combine any alpha information from the bitmap with the current alpha level. The coordinates are whole pixels.
Implemented in CartoType::C8BitTwinBitmapGraphicsContext, CartoType::C8BitMonoBitmapGraphicsContext, CartoType::C32BitColorBitmapGraphicsContext, CartoType::C24BitColorBitmapGraphicsContext, CartoType::C16BitColorBitmapGraphicsContext, CartoType::TTestZGraphicsContext, CartoType::TTestLabelGraphicsContext, CartoType::CPerspectiveGraphicsContext, and CartoType::COpenGlGraphicsContext.
| CT_EXPORT TResult CGraphicsContext::DrawLoggedText | ( | int32 | aIndex | ) |
Redraw previous characters at identical positions, starting at logged character aIndex.
Draw a filled rectangle in the current color. The coordinates are whole pixels.
Reimplemented in CartoType::C8BitTwinBitmapGraphicsContext, CartoType::C8BitMonoBitmapGraphicsContext, CartoType::C32BitColorBitmapGraphicsContext, CartoType::C24BitColorBitmapGraphicsContext, CartoType::C16BitColorBitmapGraphicsContext, CartoType::TTestZGraphicsContext, CartoType::TTestLabelGraphicsContext, and CartoType::CPerspectiveGraphicsContext.
| virtual TResult CartoType::CGraphicsContext::DrawShape | ( | const MPath & | aPath, |
| uint32 | aFlags | ||
| ) | [pure virtual] |
Draw a filled shape in the current color.
Implemented in CartoType::C8BitTwinBitmapGraphicsContext, CartoType::C8BitMonoBitmapGraphicsContext, CartoType::C32BitColorBitmapGraphicsContext, CartoType::C24BitColorBitmapGraphicsContext, CartoType::C16BitColorBitmapGraphicsContext, CartoType::TTestZGraphicsContext, CartoType::TTestLabelGraphicsContext, CartoType::CPerspectiveGraphicsContext, and CartoType::COpenGlGraphicsContext.
| CT_EXPORT TResult CGraphicsContext::DrawShapeAndStroke | ( | const MPath & | aPath, |
| uint32 | aFlags, | ||
| const TPaint & | aStrokePaint, | ||
| const TTransform * | aTransform = NULL |
||
| ) |
Fill and outline a shape. The shape is filled if the current paint is non-null, and outlined if aStrokePaint is non-null. Optionally apply a transform to the shape and the stroke envelope.
| CT_EXPORT TResult CGraphicsContext::DrawStroke | ( | const MPath & | aPath, |
| uint32 | aFlags, | ||
| const TTransform * | aTransform = NULL |
||
| ) | [virtual] |
Draw a stroke using the current circular pen.
Optionally apply a transform to the stroke envelope before drawing it. The offsets in the transform (the Tx and Ty components) are always in pixels, whether or not (aFlags & EDrawShape6BitFractionalPixels) is true.
| CT_EXPORT TResult CGraphicsContext::DrawTexture | ( | const CTexture & | aTexture, |
| const TPointFP & | aTopLeft, | ||
| const TTransformFP & | aTransform | ||
| ) | [virtual] |
Draw a texture at aTopLeft, transforming it by aTransform. The baseimplementation returns KErrorUnimplemented.
Reimplemented in CartoType::C32BitColorBitmapGraphicsContext, and CartoType::TTestLabelGraphicsContext.
| CT_EXPORT bool CGraphicsContext::EnableTransform | ( | bool | aEnable | ) | [virtual] |
Enable or disable any transformation applied by the graphics context. Return the previous state. The base implementation does nothing and returns false.
Reimplemented in CartoType::CPerspectiveGraphicsContext.
| CEngine& CartoType::CGraphicsContext::Engine | ( | ) | [inline] |
Return a reference to the singleton graphics engine.
| CT_EXPORT void CGraphicsContext::InverseTransform | ( | TPoint & | aPoint, |
| int32 | aFractionalBits | ||
| ) | [virtual] |
Apply the inverse of the graphics context's current transformation to a point. See CGraphicsContext::Transform function for details.
Reimplemented in CartoType::CPerspectiveGraphicsContext.
| CT_EXPORT void CGraphicsContext::InverseTransformRect | ( | TRect & | aRect, |
| int32 | aFractionalBits | ||
| ) |
Apply the inverse of the graphics context's current transformation to a rectangle and normalise the rectangle so that left < right and top < bottom.
| static uint8 CartoType::CGraphicsContext::MultiplyIntensities | ( | int | aIntensity1, |
| int | aIntensity2 | ||
| ) | [inline, static] |
Multiply two intensities, treated as fractions in the range 0...255.
| CT_EXPORT void CGraphicsContext::OnViewResize | ( | int32 | aWidth, |
| int32 | aHeight | ||
| ) | [virtual] |
Do anything that is needed when the output view size is initially set or changed. For instance, the OpenGL graphics context needs to change its viewport and projection. The base implementation does nothing.
Reimplemented in CartoType::CPerspectiveGraphicsContext, and CartoType::COpenGlGraphicsContext.
| const TPaint& CartoType::CGraphicsContext::Paint | ( | ) | const [inline] |
Return the current paint.
| MPaintServer* CartoType::CGraphicsContext::PaintServer | ( | ) | const [inline] |
Return the current paint server, or null if no paint server is in use.
| const MPalette* CartoType::CGraphicsContext::Palette | ( | ) | const [inline] |
Return the current palette, or null if no palette is in use. Palettes are used only when drawing bitmaps requiring them.
| const TGraphicsParam& CartoType::CGraphicsContext::Param | ( | ) | const [inline] |
Return the current graphics parameters.
| const TCircularPen& CartoType::CGraphicsContext::Pen | ( | ) | const [inline] |
Return the pen used for drawing strokes.
Draw the current bitmap on top of aBitmap before deleting it and restoring aBitmap as the current bitmap. The base implementation does nothing.
Reimplemented in CartoType::CBitmapGraphicsContext, and CartoType::CPerspectiveGraphicsContext.
Replace the current bitmap with a new one of the same type and size, returning the original one. The base implementation does nothing.
Reimplemented in CartoType::CBitmapGraphicsContext, and CartoType::CPerspectiveGraphicsContext.
| CT_EXPORT void CGraphicsContext::SetAlpha | ( | int32 | aAlpha | ) |
Set the alpha (transparency) level, where 0 = transparent and 255 = opaque.
| CT_EXPORT void CGraphicsContext::SetColor | ( | TColor | aColor | ) |
Set the color used for painting and set the paint server to null.
| CT_EXPORT void CGraphicsContext::SetCompositingOp | ( | TCompositingOp | aOp | ) |
Set the compositing op. Note that most graphics contexts support only one compositing op, 'over' (EOverCompositingOp).
| void CartoType::CGraphicsContext::SetDashArray | ( | const CDashArray * | aDashArray | ) | [inline] |
Set the array of dash and gap sizes used for dashed strokes.
| CT_EXPORT void CGraphicsContext::SetPaint | ( | const TPaint & | aPaint | ) |
Set the color and the paint server.
| CT_EXPORT void CGraphicsContext::SetPaintServer | ( | MPaintServer * | aPaintServer | ) |
Set the paint server. A value of null tells the graphics context not to use a paint server but to use the current color.
| void CartoType::CGraphicsContext::SetPalette | ( | const MPalette * | aPalette | ) | [inline] |
Set the palette. A value of null tells the graphics context not to use a palette, in which case bitmaps requiring palettes cannot be drawn.
| CT_EXPORT void CGraphicsContext::SetParam | ( | TGraphicsParam & | aParam | ) |
Set the graphics parameters to the values in aParam.
| CT_EXPORT void CGraphicsContext::SetPen | ( | const TCircularPen & | aPen | ) |
Set the pen used for drawing strokes.
| CT_EXPORT void CGraphicsContext::SetTextureMask | ( | TColor | aColor | ) |
Set the texture mask color: the color that prevents texture pixels from being drawn in unwanted areas like the sea.
| virtual void CartoType::CGraphicsContext::Sync | ( | ) | [pure virtual] |
Synchronize the private graphics state to take account of any changes in iChangeFlags.
Implemented in CartoType::C8BitTwinBitmapGraphicsContext, CartoType::C8BitMonoBitmapGraphicsContext, CartoType::C32BitColorBitmapGraphicsContext, CartoType::C24BitColorBitmapGraphicsContext, CartoType::C16BitColorBitmapGraphicsContext, CartoType::TTestZGraphicsContext, CartoType::TTestLabelGraphicsContext, CartoType::CPerspectiveGraphicsContext, and CartoType::COpenGlGraphicsContext.
Apply the graphics context's current transformation to a point. Graphics contexts that provide a non-identity overriding implementation of this function must also override TransformsPoints to return true. The base implementation is identity and thus does nothing. Although the transform does not change the points' representation, the number of fractional bits must be supplied so that the transform can use actual pixels consistently, as in a perpective transform.
Reimplemented in CartoType::CPerspectiveGraphicsContext.
| CT_EXPORT bool CGraphicsContext::TransformsPoints | ( | ) | [virtual] |
Return true if the GC applies a further transformation to points before drawing them, as for example the perspective transformation. The base implementation returns false.
Reimplemented in CartoType::CPerspectiveGraphicsContext.
TRect CartoType::CGraphicsContext::iBounds [protected] |
The bounds, in pixels, of the device drawn into.
int32 CartoType::CGraphicsContext::iChangeFlags [protected] |
Flags that are set when graphics parameters are changed, allowing derived classes to synchronize their internal states if necessary.
CEngine& CartoType::CGraphicsContext::iEngine [protected] |
A reference to the engine object, which provides the shape rendering engines and other shared resources.
TGraphicsParam CartoType::CGraphicsContext::iParam [protected] |
The drawing parameters such as the color and clip rectangle.
1.7.5.1