PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFBImage
Wrapper Class for the IImage interface.
#include <SFBImage.h.hpp>
class SFBImage : public SFBBase;
SFMTYPEDEFWRAPPER(SFBImage)

Inheritance diagram

 Inheritance diagram of SFBImageClass

Version

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

Reference

BREW API IImage

Member

Public Functions
Void Draw( SInt32 x , SInt32 y )
Draw the image on the screen at the specified position.
Void Draw( SFXGridConstRef grid )
Draw the image on the screen at the specified position.
Void DrawFrame( SInt32 frame , SInt32 x , SInt32 y )
Draw a specific frame, contained within the image, on the screen at the specified position.
Void DrawFrame( SInt32 frame , SFXGridConstRef grid )
Draw a specific frame, contained within the image, on the screen at the specified position.
Void DrawOffscreen( SInt32 offscreen = 0 )
Specify whether the image should be drawn to the off-screen buffer or main buffer. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_OFFSCREEN.
Void GetInfo( AEEImageInfo* info )
Retrieve information about the specific image.
Bool HandleEvent( AEEEvent event , UInt16 wParam , UInt32 dwParam )
Handler of SFBImage object event.
Bool HandleEvent( SFXEventConstRef event )
Handler of SFBImage object event.
static
SFBImageSmp
NewInstance( AEECLSID id , SFCErrorPtr exception = null )
Create a new SFBImage instance.
Void Notify( PFNIMAGEINFO notify , VoidPtr data = null )
Register a callback function that is invoked when a streaming I/O operation initiated by SFBImage::SetStream completes retrieving the image data.
Void SetAnimationRate( SInt32 rate )
Help to set the animation rate in milliseconds. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_RATE.
Void SetDisplay( SFBDisplaySmpConstRef display )
Specify the display on which the images decoded by the SFBDisplay interface should be drawn/animated.
Void SetDrawSize( SInt32 width , SInt32 height )
Set the dimensions of the region to be displayed. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_SIZE.
Void SetFrameCount( SInt32 count )
Help to set the number of frames in the image Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_NFRAMES.
Void SetFrameSize( SInt32 width )
Help to set the width of each frame for formats not normally supporting animation (such as Windows BMP). Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_CXFRAME.
Void SetOffset( SInt32 cx , SInt32 cy )
Set the location within the image of the region to be displayed. The dimensions of the region are set with SFBImage::SetDrawSize(). Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_OFFSET.
Void SetOffset( SFXGridConstRef grid )
Set the location within the image of the region to be displayed. The dimensions of the region are set with SFBImage::SetDrawSize(). Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_OFFSET.
Void SetParm( SInt32 param , SInt32 p1 , SInt32 p2 )
Set various image related parameters of a SFBIImage Interface object.
Void SetStream( SFBAStreamSmpConstRef stream )
Set a SFBAStream interface to be associated with an SFBImage Interface object to allow image data to be streamed in from a file or socket.
Void Start( SInt32 x , SInt32 y )
Animate the given image. It cycles through the individual frames of the image.
Void Start( SFXGridConstRef grid )
Animate the given image. It cycles through the individual frames of the image.
Void Stop( Void )
Stop the animation of the image that was started using the SFBImage::Start().
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.

SFBImage::Draw
Draw the image on the screen at the specified position.
[ public ]
Void Draw(
    SInt32 x   // specifies the X coordinates of the upper left corner of the 
               // destination rectangular area where the image needs to be drawn
    SInt32 y   // specifies the Y coordinates of the upper left corner of the 
               // destination rectangular area where the image needs to be drawn
);
[ public ]
Void Draw(
    SFXGridConstRef grid   // specifies the grid of the upper left corner of the 
                           // destination rectangular area where the image needs to be drawn
);

Example

Draw the image which read from resourse file.

// resourse ID of bitmap which read from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp    shell     = SFBShell::GetInstance();
SFBImageSmp    image;
AEEImageInfo   imageInfo = {0};

// get image from resourse file.
image = shell->LoadResImage(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

if (image != null) {
    // get the information of the image.
    image->GetInfo(&imageInfo);

    // confirm whether the image has a SFBImage object.
    if (imageInfo.cx == 0) {
        DBGPRINTF("Failed to load image…!");
        image.Release();
    }
    else {
        // draw the image.
        image->Draw(0, 0);
    }
}

Reference

BREW API IIMAGE_Draw | SFBImage::DrawFrame


SFBImage::DrawFrame
Draw a specific frame, contained within the image, on the screen at the specified position.
[ public ]
Void DrawFrame(
    SInt32 frame   // specifies the frame that needs to be drawn. 
                   // frame numbers start from 0 (zero). nFrame of -1 may be passed to draw
                   // the "current" frame, if the image is being animated 

    SInt32 x       // specifies the X coordinates of the upper left corner of the 
                   // destination rectangular area where the frame needs to be drawn
    SInt32 y       // specifies the Y coordinates of the upper left corner of the 
                   // destination rectangular area where the frame needs to be drawn
);
[ public ]
Void DrawFrame(
    SInt32 frame           // specifies the frame that needs to be drawn. 
                           // frame numbers start from 0 (zero). nFrame of -1 may be passed to draw
                           // the "current" frame, if the image is being animated 
    SFXGridConstRef grid   // specifies the grid of the upper left corner of the 
                           // destination rectangular area where the frame needs to be drawn
);

Example

Read a BREW Compressed image (BCI) from resourse file, draw it on discretional animation frame.

// resource ID of BCI image which read from resourse file.
#define IDR_MY_ANIMATION  0x0001

SFBShellSmp    shell     = SFBShell::GetInstance();
SFBImageSmp    image;
AEEImageInfo   imageInfo = {0};

// get BCI image from resourse file.
image = shell->LoadResImage(MYRESOURCE_RES_FILE, IDR_MY_ANIMATION);

if (image != null) {
    // get the information of the BCI image.
    image->GetInfo(&imageInfo);

    // confirm whether SFBImage object has a BCI image.
    if (imageInfo.cx == 0) {
        DBGPRINTF("Failed to load image…!");
        image.Release();
    }
    else {
        // draw it on discretional animation frame.
        image->DrawFrame(1, 0, 0);
    }
}

Reference

BREW API IIMAGE_DrawFrame | SFBImage::Draw


SFBImage::DrawOffscreen
Specify whether the image should be drawn to the off-screen buffer or main buffer. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_OFFSCREEN.
[ public ]
Void DrawOffscreen(
    SInt32 offscreen = 0   // offscreen
);

Reference

BREW API IIMAGE_DrawOffscreen | SFBImage::SetParm


SFBImage::GetInfo
Retrieve information about the specific image.
[ public ]
Void GetInfo(
    AEEImageInfo* info   // pointer to the space which is to receive the information of the image
);

Example

Get the information of the image.

// resource ID of the bitmap which read from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp    shell     = SFBShell::GetInstance();
SFBImageSmp    image;
AEEImageInfo   imageInfo = {0};

// get image from resourse file.
image = shell->LoadResImage(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

if (image != null) {
    // get the information of the image.
    image->GetInfo(&imageInfo);
}

Reference

BREW API IIMAGE_GetInfo | BREW API AEEImageInfo


SFBImage::HandleEvent
Handler of SFBImage object event.
[ public ]
Bool HandleEvent(
    AEEEvent event   // event
    UInt16 wParam    // 16-bit event data
    UInt32 dwParam   // 32-bit event data
);
[ public ]
Bool HandleEvent(
    SFXEventConstRef event   
);

Reference

BREW API IIMAGE_HandleEvent


SFBImage::NewInstance
Create a new SFBImage instance.
[ public, static ]
SFBImageSmp NewInstance(
    AEECLSID id                    // ClassID
    SFCErrorPtr exception = null   // Error
);

Description

The following values can be specified in the id argument as ClassID (* some devices don't support some of them):

  • AEECLSID_WINBMP (AEECLSID_VIEW+1)
  • AEECLSID_NATIVEBMP (AEECLSID_VIEW+2)
  • AEECLSID_GIF (AEECLSID_VIEW+3)
  • AEECLSID_PNG (AEECLSID_VIEW+4)
  • AEECLSID_JPEG (AEECLSID_VIEW+5)
  • AEECLSID_BCI (AEECLSID_VIEW+6)

For more details, see BREW API AEECLSID.

Reference

BREW API AEECLSID


SFBImage::Notify
Register a callback function that is invoked when a streaming I/O operation initiated by SFBImage::SetStream completes retrieving the image data.
[ public ]
Void Notify(
    PFNIMAGEINFO notify   // callback function
    VoidPtr data = null   // user data
);

Reference

BREW API IIMAGE_Notify | PFNIMAGEINFO | SFBImage::SetStream


SFBImage::SetAnimationRate
Help to set the animation rate in milliseconds. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_RATE.
[ public ]
Void SetAnimationRate(
    SInt32 rate   // animation rate
);

Reference

BREW API IIMAGE_SetAnimationRate | SFBImage::SetParm


SFBImage::SetDisplay
Specify the display on which the images decoded by the SFBDisplay interface should be drawn/animated.
[ public ]
Void SetDisplay(
    SFBDisplaySmpConstRef display   // interface of SFBDisplay class
);

Version

Introduced in BREW Client 3.1

Reference

BREW API IIMAGE_SetDisplay


SFBImage::SetDrawSize
Set the dimensions of the region to be displayed. Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_SIZE.
[ public ]
Void SetDrawSize(
    SInt32 width    // new width of the image
    SInt32 height   // new height of the image
);

Example

REad a image from resourse file, draw it in specified size.

// class ID of the bitmap which read from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp     shell     = SFBShell::GetInstance();
SFBImageSmp     image;
AEEImageInfo    imageInfo = {0};

// get the image from resourse file.
image = shell->LoadResImage(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

if (image != null) {
    // get the information of the image.
    image->GetInfo(&imageInfo);

    // comfirm whether the SFBImage object has a image.
    if (imageInfo.cx == 0) {
        DBGPRINTF("Failed to load image…!");
        image.Release();
    }
    else {
        // spacify the new size of the image.
        image->SetDrawSize(50, 50);
        
        // draw it.
        image->Draw(0, 0);
    }
}

Reference

BREW API IIMAGE_SetDrawSize | SFBImage::SetParm


SFBImage::SetFrameCount
Help to set the number of frames in the image Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_NFRAMES.
[ public ]
Void SetFrameCount(
    SInt32 count   // number of frames
);

Reference

BREW API IIMAGE_SetFrameCount | SFBImage::SetParm


SFBImage::SetFrameSize
Help to set the width of each frame for formats not normally supporting animation (such as Windows BMP). Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_CXFRAME.
[ public ]
Void SetFrameSize(
    SInt32 width   // width of each frame 
);

Reference

BREW API IIMAGE_SetFrameSize | SFBImage::SetParm


SFBImage::SetOffset
Set the location within the image of the region to be displayed. The dimensions of the region are set with SFBImage::SetDrawSize(). Invoking this function is identical to invoking SFBImage::SetParm() with IPARM_OFFSET.
[ public ]
Void SetOffset(
    SInt32 cx   // X coordinate of the new offset
    SInt32 cy   // Y coordinate of the new offset
);
[ public ]
Void SetOffset(
    SFXGridConstRef grid   // grid of the new offset
);

Reference

BREW API IIMAGE_SetOffset | SFBImage::SetParm


SFBImage::SetParm
Set various image related parameters of a SFBIImage Interface object.
[ public ]
Void SetParm(
    SInt32 param   // type of the parameter
    SInt32 p1      // specific parameter value
    SInt32 p2      // specific parameter value
);

Example

Read a image from resourse file, Draw it in transparent mode.

// resourse ID of the bitmap which read from resourse file.
#define IDB_MY_PICTURE  0x0001

SFBShellSmp     shell     = SFBShell::GetInstance();
SFBImageSmp     image;
AEEImageInfo    imageInfo = {0};

// get the image from the resourse file.
image = shell->LoadResImage(MYRESOURCE_RES_FILE, IDB_MY_PICTURE);

if (image != null) {
    // get the information of the image.
    image->GetInfo(&imageInfo);

    // confirm if the SFBImage object has a image.
    if (imageInfo.cx == 0) {
        DBGPRINTF("Failed to load image…!");
        image.Release();
    }
    else {
        // set the image into transparent mode.
        image->SetParm(IPARM_ROP, AEE_RO_TRANSPARENT, 0);

        // draw it.
        image->Draw(0, 0);
    }
}

Reference

BREW API IIMAGE_SetParm


SFBImage::SetStream
Set a SFBAStream interface to be associated with an SFBImage Interface object to allow image data to be streamed in from a file or socket.
[ public ]
Void SetStream(
    SFBAStreamSmpConstRef stream   // image data stream
);

Reference

BREW API IIMAGE_SetStream | SFBAStream::Read | SFBAStream::Readable


SFBImage::Start
Animate the given image. It cycles through the individual frames of the image.
[ public ]
Void Start(
    SInt32 x   // specifies the X coordinates of the upper left corner of the destination 
               // rectangular area where the frame needs to be drawn
    SInt32 y   // specifies the Y coordinates of the upper left corner of the destination 
               // rectangular area where the frame needs to be drawn
);
[ public ]
Void Start(
    SFXGridConstRef grid   // specifies the grid of the upper left corner of the destination 
                           // rectangular area where the frame needs to be drawn
);

Reference

BREW API IIMAGE_Start | SFBImage::Stop


SFBImage::Stop
Stop the animation of the image that was started using the SFBImage::Start().
[ public ]
Void Stop(Void);

Reference

BREW API IIMAGE_Stop | SFBImage::Start