Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CBitmapContext Class Referenceabstract

An abstract, device-independent, interface to bitmapped graphics contexts. More...

#include <gdi.h>

Inheritance diagram for CBitmapContext:
CGraphicsContext CBase CWindowGc

Public Member Functions

virtual void Clear ()=0
 Clears the whole bitmap.
 
virtual void Clear (const TRect &aRect)=0
 Clears a rectangular area of a bitmap.
 
virtual void CopyRect (const TPoint &aOffset, const TRect &aRect)=0
 Copies a rectangle.
 
virtual void BitBlt (const TPoint &aPoint, const CFbsBitmap *aBitmap)=0
 Performs a bitmap block transfer.
 
virtual void BitBlt (const TPoint &aPoint, const CFbsBitmap *aBitmap, const TRect &aRect)=0
 Performs a bitmap block transfer of a rectangular piece of a bitmap.
 
virtual void BitBltMasked (const TPoint &aPoint, const CFbsBitmap *aBitmap, const TRect &aSourceRect, const CFbsBitmap *aMaskBitmap, TBool aInvertMask)=0
 Performs a masked bitmap block transfer.
 
virtual void SetFaded (TBool aFaded)=0
 Sets whether the graphics context is faded.
 
virtual void SetFadingParameters (TUint8 aBlackMap, TUint8 aWhiteMap)=0
 Sets the fading parameters.
 
virtual TInt AlphaBlendBitmaps (const TPoint &aDestPt, const CFbsBitmap *aSrcBmp, const TRect &aSrcRect, const CFbsBitmap *aAlphaBmp, const TPoint &aAlphaPt)=0
 Performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using the data from aAlphaBmp as an alpha blending factor.
 
virtual TInt AlphaBlendBitmaps (const TPoint &aDestPt, const CWsBitmap *aSrcBmp, const TRect &aSrcRect, const CWsBitmap *aAlphaBmp, const TPoint &aAlphaPt)=0
 The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using the data from aAlphaBmp as an alpha blending factor.
 
- Public Member Functions inherited from CGraphicsContext
virtual CGraphicsDevice * Device () const =0
 Gets a pointer to the graphics context's graphics device.
 
virtual void SetOrigin (const TPoint &aPos=TPoint(0, 0))=0
 Sets the position of the co-ordinate origin.
 
virtual void SetDrawMode (TDrawMode aDrawingMode)=0
 Sets the drawing mode.
 
virtual void SetClippingRect (const TRect &aRect)=0
 Sets the clipping rectangle.
 
virtual void CancelClippingRect ()=0
 Cancels any clipping rectangle.
 
virtual void Reset ()=0
 Resets the graphics context to its default settings:
 
virtual void UseFont (const CFont *aFont)=0
 Sets the device font to be used for text drawing.
 
virtual void DiscardFont ()=0
 Discards a font.
 
virtual void SetUnderlineStyle (TFontUnderline aUnderlineStyle)=0
 Sets the underline style.
 
virtual void SetStrikethroughStyle (TFontStrikethrough aStrikethroughStyle)=0
 Sets the strikethrough style.
 
virtual void SetWordJustification (TInt aExcessWidth, TInt aNumGaps)=0
 Adjusts the spaces between words to stretch or squeeze to a certain width.
 
virtual void SetCharJustification (TInt aExcessWidth, TInt aNumChars)=0
 Sets character justification.
 
virtual void SetPenColor (const TRgb &aColor)=0
 Sets the pen colour.
 
virtual void SetPenStyle (TPenStyle aPenStyle)=0
 Sets the line drawing style for the pen.
 
virtual void SetPenSize (const TSize &aSize)=0
 Sets the line drawing size for the pen.
 
virtual void SetBrushColor (const TRgb &aColor)=0
 Sets the brush colour.
 
virtual void SetBrushStyle (TBrushStyle aBrushStyle)=0
 Sets the brush style.
 
virtual void SetBrushOrigin (const TPoint &aOrigin)=0
 Sets the brush pattern origin.
 
virtual void UseBrushPattern (const CFbsBitmap *aBitmap)=0
 Sets the brush pattern to the specified bitmap.
 
virtual void DiscardBrushPattern ()=0
 Discards a non-built-in brush pattern.
 
virtual void MoveTo (const TPoint &aPoint)=0
 Sets the drawing point relative to the co-ordinate origin.
 
virtual void MoveBy (const TPoint &aVector)=0
 Sets the drawing point relative to the current co-ordinates.
 
virtual void Plot (const TPoint &aPoint)=0
 Draws a single point.
 
virtual void DrawArc (const TRect &aRect, const TPoint &aStart, const TPoint &aEnd)=0
 Draws an arc.
 
virtual void DrawLine (const TPoint &aPoint1, const TPoint &aPoint2)=0
 Draws a straight line between two points.
 
virtual void DrawLineTo (const TPoint &aPoint)=0
 Draws a straight line from the current drawing point to a specified point.
 
virtual void DrawLineBy (const TPoint &aVector)=0
 Draws a straight line relative to the current drawing point, using a vector.
 
virtual void DrawPolyLine (const CArrayFix< TPoint > *aPointList)=0
 Draws a polyline from a set of points in an array.
 
virtual void DrawPolyLine (const TPoint *aPointList, TInt aNumPoints)=0
 Draws a polyline from a set of points in a list.
 
virtual void DrawPie (const TRect &aRect, const TPoint &aStart, const TPoint &aEnd)=0
 Draws and fills a pie slice.
 
virtual void DrawEllipse (const TRect &aRect)=0
 Draws and fills an ellipse.
 
virtual void DrawRect (const TRect &aRect)=0
 Draws and fills a rectangle.
 
virtual void DrawRoundRect (const TRect &aRect, const TSize &aCornerSize)=0
 Draws and fills a rectangle with rounded corners.
 
virtual TInt DrawPolygon (const CArrayFix< TPoint > *aPointList, TFillRule aFillRule=EAlternate)=0
 Draws and fills a polygon defined using an array of points.
 
virtual TInt DrawPolygon (const TPoint *aPointList, TInt aNumPoints, TFillRule aFillRule=EAlternate)=0
 Draws and fills a polygon defined using a list of points.
 
virtual void DrawBitmap (const TPoint &aTopLeft, const CFbsBitmap *aSource)=0
 Draws a bitmap at the specified point.
 
virtual void DrawBitmap (const TRect &aDestRect, const CFbsBitmap *aSource)=0
 Draws a bitmap to fit a given rectangle.
 
virtual void DrawBitmap (const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSourceRect)=0
 Draws a specified rectangle of a source bitmap to fit into a given destination rectangle.
 
virtual void DrawBitmapMasked (const TRect &aDestRect, const CFbsBitmap *aBitmap, const TRect &aSourceRect, const CFbsBitmap *aMaskBitmap, TBool aInvertMask)=0
 Draws a specified rectangle of a source bitmap to fit into a given rectangle using a given mask.
 
virtual void DrawBitmapMasked (const TRect &aDestRect, const CWsBitmap *aBitmap, const TRect &aSourceRect, const CWsBitmap *aMaskBitmap, TBool aInvertMask)=0
 Draws a specified rectangle from a wserv bitmap and its mask into another rectangle.
 
virtual void DrawText (const TDesC &aText, const TPoint &aPosition)=0
 Draws text without a surrounding box.
 
virtual void DrawText (const TDesC &aText, const TRect &aBox, TInt aBaselineOffset, TTextAlign aAlignment=ELeft, TInt aLeftMargin=0)=0
 Draws text inside a box.
 
virtual IMPORT_C void DrawText (const TDesC &aText, const TPoint &aPosition, const TDrawTextParam &aParam)
 Draws the specified text at the given position using the parameters supplied.
 
virtual IMPORT_C void Reserved ()
 Reserved function for future use.
 
IMPORT_C TInt DrawTextExtended (const TDesC &aText, const TPoint &aPosition, const TDrawTextExtendedParam &aParam)
 Draws text, optionally changing its direction (right-to-left / left-to-right).
 
virtual void MapColors (const TRect &aRect, const TRgb *aColors, TInt aNumPairs, TBool aMapForwards)=0
 Maps pixels in the specified rectangle.
 
virtual TInt SetClippingRegion (const TRegion &aRegion)=0
 Sets the clipping region, any items that fall outside the extent of the clipping region will not be drawn.
 
virtual void CancelClippingRegion ()=0
 Cancels the current clipping region.
 
virtual void DrawTextVertical (const TDesC &aText, const TPoint &aPos, TBool aUp)=0
 Draws vertical text in the specified direction.
 
virtual void DrawTextVertical (const TDesC &aText, const TRect &aBox, TInt aBaselineOffset, TBool aUp, TTextAlign aVert=ELeft, TInt aMargin=0)=0
 Draws text vertically in the specified direction, within a box of the specified size.
 
IMPORT_C TInt GetUnderlineMetrics (TInt &aTop, TInt &aBottom)
 
IMPORT_C TInt SetShadowColor (const TRgb &aShadowColor)
 Set the font's shadow colour.
 
IMPORT_C TInt GetShadowColor (TRgb &aShadowColor)
 Get the font's shadow colour.
 
IMPORT_C TBool IsFbsBitGc () const
 Determine if the Gc is a CFbsBitGc.
 
IMPORT_C void DrawText (const TDesC &aText, const TTextParameters *iParam, const TPoint &aPosition)
 
IMPORT_C void DrawText (const TDesC &aText, const TTextParameters *iParam, const TRect &aBox, TInt aBaselineOffset, TTextAlign aHrz=ELeft, TInt aMargin=0)
 
IMPORT_C void DrawText (const TDesC &aText, const TTextParameters *iParam, const TPoint &aPosition, const TDrawTextParam &aParam)
 
IMPORT_C void DrawTextVertical (const TDesC &aText, const TTextParameters *iParam, const TPoint &aPos, TBool aUp)
 
IMPORT_C void DrawTextVertical (const TDesC &aText, const TTextParameters *iParam, const TRect &aBox, TInt aBaselineOffset, TBool aUp, TTextAlign aVert=ELeft, TInt aMargin=0)
 
IMPORT_C TInt DrawTextExtended (const TDesC &aText, const TTextParameters *iParam, const TPoint &aPosition, const TDrawTextExtendedParam &aParam)
 Draws text, optionally changing its direction (right-to-left / left-to-right).
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Protected Member Functions

IMPORT_C TInt APIExtension (TUid aUid, TAny *&aOutput, TAny *aInput)
 
IMPORT_C void Reserved_CGraphicsContext_2 ()
 A reserved virtual function for future use.
 
virtual IMPORT_C void Reserved_CBitmapContext_1 ()
 
virtual IMPORT_C void Reserved_CBitmapContext_2 ()
 
virtual IMPORT_C void Reserved_CBitmapContext_3 ()
 
- Protected Member Functions inherited from CBase
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 

Additional Inherited Members

- Public Types inherited from CGraphicsContext
enum  TTextAlign { ELeft , ECenter , ERight }
 Text alignment. More...
 
enum  TDrawModeComponents {
  EInvertScreen =1 , EXor =2 , EOr =4 , EAnd =8 ,
  ELogicalOp =14 , EInvertPen =16 , EPenmode =32 , EWriteAlpha =64
}
 
enum  TDrawMode {
  EDrawModeAND =EAnd , EDrawModeNOTAND =EInvertScreen|EAnd , EDrawModePEN =EPenmode , EDrawModeANDNOT =EAnd|EInvertPen ,
  EDrawModeXOR =EXor , EDrawModeOR =EOr , EDrawModeNOTANDNOT =EInvertScreen|EAnd|EInvertPen , EDrawModeNOTXOR =EInvertScreen|EXor ,
  EDrawModeNOTSCREEN =EInvertScreen , EDrawModeNOTOR =EInvertScreen|EOr , EDrawModeNOTPEN =EInvertPen|EPenmode , EDrawModeORNOT =EOr|EInvertPen ,
  EDrawModeNOTORNOT =EInvertScreen|EOr|EInvertPen , EDrawModeWriteAlpha =EWriteAlpha
}
 
enum  TPenStyle {
  ENullPen , ESolidPen , EDottedPen , EDashedPen ,
  EDotDashPen , EDotDotDashPen
}
 
enum  TBrushStyle {
  ENullBrush , ESolidBrush , EPatternedBrush , EVerticalHatchBrush ,
  EForwardDiagonalHatchBrush , EHorizontalHatchBrush , ERearwardDiagonalHatchBrush , ESquareCrossHatchBrush ,
  EDiamondCrossHatchBrush
}
 
enum  TFillRule { EAlternate , EWinding }
 
- Static Public Member Functions inherited from CGraphicsContext
static IMPORT_C TInt JustificationInPixels (TInt aExcessPixels, TInt aTotalUnits, TInt aFirstUnit, TInt aNumUnits)
 Gets the amount of space in pixels by which to adjust letter or word spacing, given the total number of words and spaces, a start space, and the number of units to be adjusted.
 
static IMPORT_C TInt JustificationInPixels (TInt &aExcessPixels, TInt &aTotalUnits)
 Gets the amount of space in pixels by which to adjust the current letter or word spacing, and also retrieves the number of excess pixels and word spaces remaining after the adjustment is performed.
 
- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 

Detailed Description

An abstract, device-independent, interface to bitmapped graphics contexts.

This holds the setting used to draw to a CBitmapDevice.

The default settings of a CBitmapContext object immediately after construction are:

drawing mode is EDrawModePen (pen and brush colours used as they are)

no clipping rectangle

pen settings are: black, solid, single pixel width

brush style is null

no text font selected

The classes CFbsBitGc and CWindowGc are derived from this class.

See also
CFbsBitGc
API status
Published to all clients. Released API.

Definition at line 3180 of file gdi.h.

Member Function Documentation

◆ AlphaBlendBitmaps() [1/2]

virtual TInt CBitmapContext::AlphaBlendBitmaps ( const TPoint &  aDestPt,
const CFbsBitmap *  aSrcBmp,
const TRect &  aSrcRect,
const CFbsBitmap *  aAlphaBmp,
const TPoint &  aAlphaPt 
)
pure virtual

Performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using the data from aAlphaBmp as an alpha blending factor.

The formula used is: (S * A + W * (255 - A)) / 255, where:

  • S - a pixel from aSrcBmp;
  • W - a pixel from the window;
  • A - a pixel from aAlphaBmp; The contents of source and alpha bitmap are preserved. The calculated alpha blended pixels are written to the destination CBitmapContext.
    Parameters
    aDestPtPosition in the target the result should be drawn to.
    aSrcBmpA pointer to the source bitmap.
    aSrcRectThe part of the source bitmap that should be used.
    aAlphaBmpA pointer to the bitmap used as an alpha blending factor.
    aAlphaPtPosition of the first pixel in the alpha bitmap that should be used as a source for the alpha blending. The size of the area is the same as the source bitmap area - aSrcRect parameter.

Implemented in CWindowGc.

◆ AlphaBlendBitmaps() [2/2]

virtual TInt CBitmapContext::AlphaBlendBitmaps ( const TPoint &  aDestPt,
const CWsBitmap *  aSrcBmp,
const TRect &  aSrcRect,
const CWsBitmap *  aAlphaBmp,
const TPoint &  aAlphaPt 
)
pure virtual

The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using the data from aAlphaBmp as an alpha blending factor.

For information on how this function works, see the other overload.

Parameters
aDestPtPosition in the target the result should be drawn to.
aSrcBmpA pointer to the source bitmap.
aSrcRectThe part of the source bitmap that should be used.
aAlphaBmpA pointer to the bitmap used as an alpha blending factor.
aAlphaPtPosition of the first pixel in the alpha bitmap that should be used as a source for the alpha blending. The size of the area is the same as the source bitmap area - aSrcRect parameter.

Implemented in CWindowGc.

◆ APIExtension()

IMPORT_C TInt CBitmapContext::APIExtension ( TUid  aUid,
TAny *&  aOutput,
TAny *  aInput 
)
protectedvirtual
Parameters
aOutputis for output
aInputis for input

(generated from Symbian Developer Library)

Reimplemented from CGraphicsContext.

Reimplemented in CWindowGc.

◆ BitBlt() [1/2]

virtual void CBitmapContext::BitBlt ( const TPoint &  aPoint,
const CFbsBitmap *  aBitmap 
)
pure virtual

Performs a bitmap block transfer.

This pure virtual function is implemented in derived classes.

Parameters
aPointThe destination for the top left corner of the transferred bitmap. It is relative to the top left corner of the destination bitmap, which may be the screen.
aBitmapA memory-resident bitmap.

Implemented in CWindowGc.

◆ BitBlt() [2/2]

virtual void CBitmapContext::BitBlt ( const TPoint &  aPoint,
const CFbsBitmap *  aBitmap,
const TRect &  aRect 
)
pure virtual

Performs a bitmap block transfer of a rectangular piece of a bitmap.

If the specified rectangle is larger than the bitmap then the bitmap is padded with white.

This pure virtual function is implemented in derived classes.

Parameters
aPointThe destination for the top left corner of the transferred bitmap. It is relative to the top left corner of the destination bitmap, which may be the screen.
aBitmapA memory-resident bitmap
aRectA rectangle defining the portion of the bitmap to transfer. Its coordinates are relative to the top left corner of the source bitmap.

Implemented in CWindowGc.

◆ BitBltMasked()

virtual void CBitmapContext::BitBltMasked ( const TPoint &  aPoint,
const CFbsBitmap *  aBitmap,
const TRect &  aSourceRect,
const CFbsBitmap *  aMaskBitmap,
TBool  aInvertMask 
)
pure virtual

Performs a masked bitmap block transfer.

The mask bitmap can be used as either a positive or negative mask. Masked pixels are not mapped to the destination rectangle.

This function uses either a black and white (binary) mask bitmap, or if aMaskBitmap's display mode is EGray256, alpha blending is used. Use of any other mode may result in unpredictable results

With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle. With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle.

Note that if the mask bitmap is smaller than the source bitmap, then it is tiled across the bitmap. Note that the mask is applied before the piece of the bitmap is defined - the mask is tiled relative to the top left of the original source bitmap rather than the top left of the bitmap piece.

This pure virtual function is implemented in derived classes.

Parameters
aPointThe destination for the top left corner of the transferred bitmap. It is relative to the top left corner of the destination bitmap, which may be the screen.
aBitmapA memory-resident source bitmap.
aSourceRectA rectangle defining the piece of the bitmap to be drawn, with co-ordinates relative to the top left corner of the bitmap.
aMaskBitmapA mask bitmap
aInvertMaskIf EFalse, a source pixel that is masked by a black pixel is not transferred to the destination rectangle. If ETrue, then a source pixel that is masked by a white pixel is not transferred to the destination rectangle.

Implemented in CWindowGc.

◆ Clear() [1/2]

virtual void CBitmapContext::Clear ( )
pure virtual

Clears the whole bitmap.

The cleared area is filled with the current brush colour.

This pure virtual function is implemented in derived classes.

Implemented in CWindowGc.

◆ Clear() [2/2]

virtual void CBitmapContext::Clear ( const TRect &  aRect)
pure virtual

Clears a rectangular area of a bitmap.

The cleared area is filled with the current brush colour.

This pure virtual function is implemented in derived classes.

Parameters
aRectThe rectangle to clear.

Implemented in CWindowGc.

◆ CopyRect()

virtual void CBitmapContext::CopyRect ( const TPoint &  aOffset,
const TRect &  aRect 
)
pure virtual

Copies a rectangle.

This pure virtual function is implemented in derived classes.

Parameters
aOffsetThe offset from the top left corner of the rectangle to be copied to the top left corner of the copy.
aRectThe rectangular area to be copied.

Implemented in CWindowGc.

◆ Reserved_CBitmapContext_1()

virtual IMPORT_C void CBitmapContext::Reserved_CBitmapContext_1 ( )
protectedvirtual

◆ Reserved_CBitmapContext_2()

virtual IMPORT_C void CBitmapContext::Reserved_CBitmapContext_2 ( )
protectedvirtual

◆ Reserved_CBitmapContext_3()

virtual IMPORT_C void CBitmapContext::Reserved_CBitmapContext_3 ( )
protectedvirtual

◆ Reserved_CGraphicsContext_2()

IMPORT_C void CBitmapContext::Reserved_CGraphicsContext_2 ( )
protectedvirtual

A reserved virtual function for future use.

Reimplemented from CGraphicsContext.

◆ SetFaded()

virtual void CBitmapContext::SetFaded ( TBool  aFaded)
pure virtual

Sets whether the graphics context is faded.

Parameters
aFadedETrue to fade the GC; EFalse to unfade it.

Implemented in CWindowGc.

◆ SetFadingParameters()

virtual void CBitmapContext::SetFadingParameters ( TUint8  aBlackMap,
TUint8  aWhiteMap 
)
pure virtual

Sets the fading parameters.

This function allows you to override the map used when drawing with a faded graphics context (GC). However if you draw to a faded window with a faded GC, then fading on the GC is ignored and the fading of the window is used.

Fading is used to change the colour of a window to make other windows stand out. Fading can either make a faded window closer to white or closer to black.

Fading re-maps colours in the faded GC to fall between the specified black and white map values. If aBlackMap=0 and aWhiteMap=255 then the colours are mapped unchanged. As the values converge the colours are mapped to a smaller range - so the differences between colours in the faded GC decrease. If the values are reversed then the colours are inverted (i.e. where the GC would be black, it is now white).

Parameters
aBlackMapBlack map fading parameter. Unfaded this is 0.
aWhiteMapWhite map fading parameter. Unfaded this is 255.

Implemented in CWindowGc.


The documentation for this class was generated from the following files: