PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFBBitmap
Wrapper Class for the IBitmap interface.
#include <SFBBitmap.h.hpp>
class SFBBitmap : public SFBQuery;
SFMTYPEDEFWRAPPER(SFBBitmap)

Inheritance diagram

 Inheritance diagram of SFBBitmapClass

Version

BREW 2.0 BREW 2.1 BREW 3.1 BREW 4.0
O O O O

Reference

BREW API IBitmap

Member

Public Functions
SFCError BltIn( SInt32 xDest , SInt32 yDest , SInt32 dx , SInt32 dy , SFBBitmapSmpConstRef bmpSrc , SInt32 xSrc , SInt32 ySrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer of the data corresponding to a rectangle of pixels from the specified source bitmap into this bitmap.
SFCError BltIn( SFXRectangleConstRef rcDest , SFBBitmapSmpConstRef bmpSrc , SFXGridConstRef gridSrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer of the data corresponding to a rectangle of pixels from the specified source bitmap into this bitmap.
SFCError BltIn( SFXGridConstRef gridDest , SFXSizeConstRef sizeDest , SFBBitmapSmpConstRef bmpSrc , SFXGridConstRef gridSrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer of the data corresponding to a rectangle of pixels from the specified source bitmap into this bitmap.
SFCError BltOut( SInt32 xDest , SInt32 yDest , SInt32 dx , SInt32 dy , SFBBitmapSmpConstRef bmpDest , SInt32 xSrc , SInt32 ySrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer from this bitmap into the specified destination bitmap.
SFCError BltOut( SFXRectangleConstRef rcDest , SFBBitmapSmpConstRef bmpDest , SFXGridConstRef gridSrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer from this bitmap into the specified destination bitmap.
SFCError BltOut( SFXGridConstRef gridDest , SFXSizeConstRef sizeDest , SFBBitmapSmpConstRef bmpDest , SFXGridConstRef gridSrc , AEERasterOp rop = AEE_RO_COPY )
Perform a bit-block transfer from this bitmap into the specified destination bitmap.
NativeColor ColorToNative( SFXRGBColorConstRef color )
Convert RGB value into Native value.
SFCError CreateCompatibleBitmap( SFBBitmapSmpPtr cloneBmp , UInt16 width , UInt16 height )
Create a new bitmap compatible with this bitmap interface.
SFBBitmapSmp CreateCompatibleBitmap( SFXSizeConstRef size )
Create a new bitmap compatible with this bitmap interface.
SFCError DrawHScanline( UInt32 y , UInt32 xMin , UInt32 xMax , NativeColor color , AEERasterOp rop = AEE_RO_COPY )
Draw horizon scan line.
SFCError DrawPixel( UInt32 x , UInt32 y , NativeColor color , AEERasterOp rop = AEE_RO_COPY )
Draws a single pixel in the bitamp.
SFCError DrawPixel( SFXPixelConstRef pixel , NativeColor color , AEERasterOp rop = AEE_RO_COPY )
Draws a single pixel in the bitamp.
SFCError FillRect( SFXRectangleConstRef rect , NativeColor color , AEERasterOp rop = AEE_RO_COPY )
Draw a solid rectangle of the specified color.
SFCError GetInfo( AEEBitmapInfo* bmpInfo , SInt32 size = sizeof(AEEBitmapInfo) )
Retrieve the dimension of the bitmap.
SFCError GetPixel( UInt32 x , UInt32 y , NativeColor* color )
Retrieves the value of the specified pixel.
SFCError GetPixel( SFXPixelConstRef pixel , NativeColor* color )
Retrieves the value of the specified pixel.
NativeColor GetPixel( SFXPixelConstRef pixel )
Retrieves the value of the specified pixel.
SFCError GetTransparencyColor( NativeColor* color )
Get the current transparency color of the bitmap. This is used when this bitmap is the source bitmap of a transparent bit blit operation.
NativeColor GetTransparencyColor( Void )
Get the current transparency color of the bitmap. This is used when this bitmap is the source bitmap of a transparent bit blit operation.
SFCError Invalidate( SFXRectangleConstRef rect )
Expand the bitmap's dirty rectangle to include the rectangle passed in the rect parameter.
Void NativeToColor( NativeColor nativeColor , SFXRGBColorPtr sfxColor )
Convert Native value into the RGB value.
SFXRGBColor NativeToColor( NativeColor color )
Convert Native value into the RGB value.
RGBVAL NativeToRGB( NativeColor color )
Convert Native color into RGB color.
SFBBitmapRotSmp QueryBitmapRotation( Void )
Query a SFBBitmapRot instance (This function is SophiaFramework Extension).
NativeColor RGBToNative( RGBVAL color )
Convert RGB color into Native color.
SFCError SetPixels( UInt32 count , SFXPixelPtr pixels , NativeColor color , AEERasterOp rop = AEE_RO_COPY )
Draws multiple pixels with the same color.
SFCError SetTransparencyColor( NativeColor color )
Set the transparency color of the bitmap.
SFCError QueryInterface( AEECLSID clsid , VoidHandle handle ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
SFCError QueryInterface( AEECLSID clsid , SFBBaseSmpPtr handle ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
SFBBaseSmp QueryInterface( AEECLSID clsid ) (inherits from SFBQuery)
Ask an object for another API contract from the object in question.
Void Self( AEECLSID clsidReq , SFBQuerySmpPtr clone , AEECLSID clsidImp ) (inherits from SFBQuery)
Helper macro for those implementing an object with a single interface.
SFBQuerySmp Self( AEECLSID clsidReq , AEECLSID clsidImp ) (inherits from SFBQuery)
Helper macro for those implementing an object with a single interface.
Protected Functions
static
SFBBaseSmp
FactoryByCreate( AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface.
static
SFBBaseSmp
FactoryByQuery( SFBQuerySmpConstRef query , AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface using the SFBQuery instance.

SFBBitmap::BltIn
Perform a bit-block transfer of the data corresponding to a rectangle of pixels from the specified source bitmap into this bitmap.
[ public ]
SFCError BltIn(
    SInt32 xDest                    // specifies the X coordinates of the upper left corner of the destination rectangular area
    SInt32 yDest                    // specifies the Y coordinates of the upper left corner of the destination rectangular area
    SInt32 dx                       // specifies the width of the destination and source rectangles. Negative values will be treated as zero.
    SInt32 dy                       // specifies the height of the destination and source rectangles. Negative values will be treated as zero.
    SFBBitmapSmpConstRef bmpSrc     // specifies the Source bitmap
    SInt32 xSrc                     // specifies the X coordinate of the upper left corner of the source bitmap from where the bit-block transfer must begin
    SInt32 ySrc                     // specifies the Y coordinate of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);
[ public ]
SFCError BltIn(
    SFXRectangleConstRef rcDest     // specifies the destination rectangular area
    SFBBitmapSmpConstRef bmpSrc     // specifies the Source bitmap
    SFXGridConstRef gridSrc         // specifies the coordinate of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);
[ public ]
SFCError BltIn(
    SFXGridConstRef gridDest        // specifies the grid of the upper left corner of the destination rectangular area
    SFXSizeConstRef sizeDest        // specifies the size of the upper left corner of the source bitmap from where the bit-block transfer must begin
    SFBBitmapSmpConstRef bmpSrc     // specifies the Source bitmap
    SFXGridConstRef gridSrc         // specifies the size of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);

Example

Draw the bitmap which is read from the resource file to the screen of device.

// resource ID of reading bitmap from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp     shell   = SFBShell::GetInstance();
SFBDisplaySmp   display = SFBDisplay::NewInstance();
SFBBitmapSmp    bmp;
SFBBitmapSmp    dst;

// get bitmap from the resource file
bmp = shell->LoadResBitmap(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

if (bmp != null) {
    // get the destination bitmap to darw.
    dst = display->GetDestination();

    // draw the bitmap which read from the resource file to the destination bitmap
    dst->BltIn(
 SFXRectangle(0, 0, 100, 100), // destination rectangle
        bmp,                          // source bitmap
 SFXGrid(0, 0)                 // source starting grid
    );

    // update screen
    display->Update();
}

Reference

BREW API IBITMAP_BltIn | AEERasterOp | SFBBitmap::BltOut


SFBBitmap::BltOut
Perform a bit-block transfer from this bitmap into the specified destination bitmap.
[ public ]
SFCError BltOut(
    SInt32 xDest                    // specifies the X coordinates of the upper left corner of the destination rectangular area
    SInt32 yDest                    // specifies the Y coordinates of the upper left corner of the destination rectangular area
    SInt32 dx                       // specifies the width of the destination rectangle
    SInt32 dy                       // specifies the height of the destination rectangle
    SFBBitmapSmpConstRef bmpDest    // specifies the destination bitmap
    SInt32 xSrc                     // specifies the X coordinate of the upper left corner of the source bitmap from where the bit-block transfer must begin
    SInt32 ySrc                     // specifies the Y coordinate of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);
[ public ]
SFCError BltOut(
    SFXRectangleConstRef rcDest     // specifies the destination rectangle
    SFBBitmapSmpConstRef bmpDest    // specifies the destination bitmap
    SFXGridConstRef gridSrc         // specifies the grid of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);
[ public ]
SFCError BltOut(
    SFXGridConstRef gridDest        // specifies the X coordinates of the upper left corner of the destination rectangular area
    SFXSizeConstRef sizeDest        // specifies the size of the destination rectangular area
    SFBBitmapSmpConstRef bmpDest    // specifies the destination bitmap
    SFXGridConstRef gridSrc         // specifies the grid of the upper left corner of the source bitmap from where the bit-block transfer must begin
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);

Reference

BREW API IBITMAP_BltOut | AEERasterOp | SFBBitmap::BltIn


SFBBitmap::ColorToNative
Convert RGB value into Native value.
[ public ]
NativeColor ColorToNative(
    SFXRGBColorConstRef color   // RGB Color
);

Return Values

Return the converted Native value.

Description

Convert RGB value into Native value. The Native value contains the pixels matrix. if a Native color corresponding a certain RGBVAL value is not exist, it returns the nearest Native color This function does not always return the nearest Native color, sometimes it return another Native color for permorance.

Reference

BREW API IBITMAP_RGBToNative | SFXRGBColor | SFBBitmap::NativeToRGB


SFBBitmap::CreateCompatibleBitmap
Create a new bitmap compatible with this bitmap interface.
[ public ]
SFCError CreateCompatibleBitmap(
    SFBBitmapSmpPtr cloneBmp   // pointer to new SFBBitmap interface of the new bitmap
    UInt16 width               // width of new bitmap
    UInt16 height              // height of new bitmap
);
[ public ]
SFBBitmapSmp CreateCompatibleBitmap(
    SFXSizeConstRef size   // size of new bitmap
);

Example

Creates a new bitmap compatible with this bitmap interface.

SFXGraphicsPtr  graphic = SFXGraphics::NewInstance();
SFBBitmapSmp    dst;
SFBBitmapSmp    tmpDst;

// get destination bitmap.
dst = graphic->GetDestination();

// creates a new bitmap compatible with this bitmap interface.
tmpDst = dst->CreateCompatibleBitmap(SFXSize(100, 100));

Reference

BREW API IBITMAP_CreateCompatibleBitmap


SFBBitmap::DrawHScanline
Draw horizon scan line.
[ public ]
SFCError DrawHScanline(
    UInt32 y                        // Y coordinates
    UInt32 xMin                     // X coordinates of start point
    UInt32 xMax                     // X coordinates of end point
    NativeColor color               // specifies the color to be used to draw the line. This is a native color, which can be obtained with SFBBitmap::ColorToNative()
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);

Reference

BREW API IBITMAP_DrawHScanline | AEERasterOp


SFBBitmap::DrawPixel
Draws a single pixel in the bitamp.
[ public ]
SFCError DrawPixel(
    UInt32 x                        // X coordinate of pixel
    UInt32 y                        // Y coordinate of pixel
    NativeColor color               // specifies the color to be used to draw the pixel. This is a native color, which can be obtained with SFBBitmap::ColorToNative()
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);
[ public ]
SFCError DrawPixel(
    SFXPixelConstRef pixel          // coordinate of pixel
    NativeColor color               // specifies the color to be used to draw the pixel. This is a native color, which can be obtained with SFBBitmap::ColorToNative()
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);

Return value

If the pixel is drawn succfully, it returns SFERR_NO_ERROR.

Reference

BREW API IBITMAP_DrawPixel | AEERasterOp | SFBBitmap::GetPixel


SFBBitmap::FillRect
Draw a solid rectangle of the specified color.
[ public ]
SFCError FillRect(
    SFXRectangleConstRef rect       // rectangle
    NativeColor color               // specifies the color to be used to draw the rectangle. This is a native color, which can be obtained with SFBBitmap::ColorToNative()
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used while doing the bit-block transfer
);

Return value

If the rectangle is drawn succfully, it returns SFERR_NO_ERROR.

Example

Draw a solid rectangle in red.

SFXGraphicsSmp      graphic = SFXGraphics::NewInstance();
SFBBitmapSmp        dst;
NativeColor         nativeColor;

// get destination bitmap
dst = graphic->GetDestination();

// convert RGB Color into Native Color.
nativeColor = dst->RGBToNative(SFXRGBColor(0xFF, 0x00, 0x00));

// draw a rectangle in red to destination bitmap.
dst->FillRect(SFXRectangle(0, 0, 100, 100), nativeColor);

Reference

BREW API IBITMAP_FillRect | AEERasterOp


SFBBitmap::GetInfo
Retrieve the dimension of the bitmap.
[ public ]
SFCError GetInfo(
    AEEBitmapInfo* bmpInfo                // pointer to AEEBitmapInfo result
    SInt32 size = sizeof(AEEBitmapInfo)   // the size of AEEBitmapInfo in the current version. AEEBitmapInfo STRUCT may grow over time. This field will allow backward compatibility
);

Example

Retrieves the dimension of the bitmap.

// resource ID of reading bitmap from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp     shell   = SFBShell::GetInstance();
SFBBitmapSmp    bmp;
AEEBitmapInfo   bmpInfo = {0};

// get bitmap from the resource file
bmp = shell->LoadResBitmap(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

// get the size of bitmap
bmp->GetInfo(&bmpInfo);

Reference

BREW API IBITMAP_GetInfo | AEEBitmapInfo


SFBBitmap::GetPixel
Retrieves the value of the specified pixel.
[ public ]
SFCError GetPixel(
    UInt32 x             // X coordinate of pixel
    UInt32 y             // Y coordinate of pixel
    NativeColor* color   // color of specified pixel
);
[ public ]
SFCError GetPixel(
    SFXPixelConstRef pixel   // coordinate of pixel
    NativeColor* color       // pointer to the receiving bound of Native color
);
[ public ]
NativeColor GetPixel(
    SFXPixelConstRef pixel   // coordinate of pixel
);

Return value

If the value of pixel is get succfully, it returns SFERR_NO_ERROR.

Reference

BREW API IBITMAP_GetPixel | SFBBitmap::SetPixels


SFBBitmap::GetTransparencyColor
Get the current transparency color of the bitmap. This is used when this bitmap is the source bitmap of a transparent bit blit operation.
[ public ]
SFCError GetTransparencyColor(
    NativeColor* color   // pointer to the receiving space of Native color
);
[ public ]
NativeColor GetTransparencyColor(Void);

Reference

BREW API IBITMAP_GetTransparencyColor | SFBBitmap::BltIn | SFBBitmap::BltOut | SFBBitmap::SetTransparencyColor


SFBBitmap::Invalidate
Expand the bitmap's dirty rectangle to include the rectangle passed in the rect parameter.
[ public ]
SFCError Invalidate(
    SFXRectangleConstRef rect   // rectangle that should be included in the dirty region
);

Reference

BREW API IBITMAP_Invalidate


SFBBitmap::NativeToColor
Convert Native value into the RGB value.
[ public ]
Void NativeToColor(
    NativeColor nativeColor   // native color
    SFXRGBColorPtr sfxColor   // pointer to the receiving space of RGB color
);
[ public ]
SFXRGBColor NativeToColor(
    NativeColor color   // native color
);

Return value

If color is get succfully, it returns SFERR_NO_ERROR.

Reference

BREW API IBITMAP_NativeToRGB | NativeColor | RGBVAL | SFBBitmap::RGBToNative


SFBBitmap::NativeToRGB
Convert Native color into RGB color.
[ public ]
RGBVAL NativeToRGB(
    NativeColor color   // value of Native color
);

Example

Convert Native color into RGB color.

SFXGraphicsSmp      graphic = SFXGraphics::NewInstance();
SFBBitmapSmp        dst;
NativeColor         nativeColor;
SFXRGBColor         rgbColor;

// get destination bitmap.
dst = graphic->GetDestination();

// get the value of pixel.
nativeColor = dst->GetPixel(SFXGrid(0, 0));

// convert Native color into RGB color.
rgbColor = dst->NativeToRGB(nativeColor);

Reference

BREW API IBITMAP_NativeToRGB | SFBBitmap::NativeToColor | NativeColor | RGBVAL | SFBBitmap::RGBToNative


SFBBitmap::QueryBitmapRotation
Query a SFBBitmapRot instance (This function is SophiaFramework Extension).
[ public ]
SFBBitmapRotSmp QueryBitmapRotation(Void);

Version

Introduced BREW Client 3.1.5 or 4.0.3

Reference

SFBBitmapRot


SFBBitmap::RGBToNative
Convert RGB color into Native color.
[ public ]
NativeColor RGBToNative(
    RGBVAL color   // source RGB value.
                   // true RGB value is supported.
                   // the index of ColorTable is not supported
);

Example

Convert RGB color into Native color, and draw a red-filled rectangle.

SFXGraphicsSmp      graphic = SFXGraphics::NewInstance();
SFBBitmapSmp        dst;
NativeColor         nativeColor;

// get destination bitmap.
dst = graphic->GetDestination();

// convert RGB color into Native color.
nativeColor = dst->RGBToNative(SFXRGBColor(0xFF, 0x00, 0x00));

// draw a red-filled rectangle to destination bitmap.
dst->FillRect(SFXRectangle(0, 0, 100, 100), nativeColor);

Reference

BREW API IBITMAP_RGBToNative | RGBVAL | SFBBitmap::ColorToNative | SFBBitmap::NativeToRGB | SFBBitmap::NativeToColor


SFBBitmap::SetPixels
Draws multiple pixels with the same color.
[ public ]
SFCError SetPixels(
    UInt32 count                    // number of pixels
    SFXPixelPtr pixels              // header pointer to the array of 2D points
    NativeColor color               // specifies the color to be used to draw the pixel. This is a native color, which can be obtained with SFBBitmap::ColorToNative()
    AEERasterOp rop = AEE_RO_COPY   // specifies the raster operation that will be used to draw the pixel
);

Return value

If the pixels are drawn succfully, it returns SFERR_NO_ERROR.

Reference

BREW API IBITMAP_SetPixels | AEERasterOp | SFBBitmap::GetPixel


SFBBitmap::SetTransparencyColor
Set the transparency color of the bitmap.
[ public ]
SFCError SetTransparencyColor(
    NativeColor color   // color to make transparent
);

Reference

BREW API IBITMAP_SetTransparencyColor | SFBBitmap::BltIn | SFBBitmap::BltOut | SFBBitmap::GetTransparencyColor