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

Inheritance diagram

 Inheritance diagram of SFBTransformClass

Version

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

Reference

BREW API ITransform

Member

Public Functions
static
SFBTransformSmp
NewInstance( SFBBitmapSmpConstRef bitmap , SFCErrorPtr exception = null )
Create a new SFBTransform instance.
static
SFBTransformSmp
NewInstance( SFBBitmapSmpConstRef bitmap , AEECLSID id , SFCErrorPtr exception = null )
Create a new SFBTransform instance.
SFCError TransformBltComplex( SInt32 xDest , SInt32 yDest , SFBBitmapSmpConstRef bmpSrc , SInt32 xSrc , SInt32 ySrc , UInt32 dxSrc , UInt32 dySrc , AEETransformMatrix const & transformMatrix , UInt08 composite = COMPOSITE_OPAQUE )
Blit a one bitmap to another, applying a set of simple, predefined transformations.
SFCError TransformBltComplex( SFXGridConstRef gridDest , SFBBitmapSmpConstRef bmpSrc , SFXRectangleConstRef rectSrc , AEETransformMatrix const & transformMatrix , UInt08 composite = COMPOSITE_OPAQUE )
Blit a one bitmap to another, applying a set of simple, predefined transformations.
SFCError TransformBltSimple( SInt32 xDest , SInt32 yDest , SFBBitmapSmpConstRef bmpSrc , SInt32 xSrc , SInt32 ySrc , UInt32 dxSrc , UInt32 dySrc , UInt16 transform , UInt08 composite = COMPOSITE_OPAQUE )
Blit a one bitmap to another, applying a set of simple, predefined transformations.
SFCError TransformBltSimple( SFXGridConstRef gridDest , SFBBitmapSmpConstRef bmpSrc , SFXRectangleConstRef rectSrc , UInt16 transform , UInt08 composite = COMPOSITE_OPAQUE )
Blit a one bitmap to another, applying a set of simple, predefined transformations.
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.

SFBTransform::NewInstance
Create a new SFBTransform instance.
[ public, static ]
SFBTransformSmp NewInstance(
    SFBBitmapSmpConstRef bitmap    // SFBBitmap instance
    SFCErrorPtr exception = null   // Error
);
[ public, static ]
SFBTransformSmp NewInstance(
    SFBBitmapSmpConstRef bitmap    // SFBBitmap instance
    AEECLSID id                    // Class ID
    SFCErrorPtr exception = null   // Error
);

Description

Get the instance of SFBTransform from the instance of argument specified SFBBitmap, and returns it.

Reference

SFBBitmap


SFBTransform::TransformBltComplex
Blit a one bitmap to another, applying a set of simple, predefined transformations.
[ public ]
SFCError TransformBltComplex(
    SInt32 xDest                                 // x-Coordinate in destination where upper left corner of source will be drawn
    SInt32 yDest                                 // y-Coordinate in destination where upper left corner of source will be drawn
    SFBBitmapSmpConstRef bmpSrc                  // source bitmap
    SInt32 xSrc                                  // x-Coordinate of upper left corner of source bitmap to be blitted to destination
    SInt32 ySrc                                  // y-Coordinate of upper left corner of source bitmap to be blitted to destination
    UInt32 dxSrc                                 // width of source bitmap area to be blitted
    UInt32 dySrc                                 // height of source bitmap area to be blitted
    AEETransformMatrix const & transformMatrix   // pointer to AEETransformMatrix structure
    UInt08 composite = COMPOSITE_OPAQUE          // property
);
[ public ]
SFCError TransformBltComplex(
    SFXGridConstRef gridDest                     // coordinate in destination where upper left corner of source will be drawn
    SFBBitmapSmpConstRef bmpSrc                  // source bitmap
    SFXRectangleConstRef rectSrc                 // source rectangle
    AEETransformMatrix const & transformMatrix   // pointer to AEETransformMatrix structure
    UInt08 composite = COMPOSITE_OPAQUE          // property
);

Example

Read a bitmap from resource map, resize it to 1.5x size and draw it.

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

SFXGraphicsPtr           graphic = SFXGraphics::GetInstance();
SFBShellSmp              shell   = SFBShell::GetInstance();
SFBBitmapSmp             bmp;
SFBBitmapSmp             dst;
SFBBitmapSmp             tmp;
AEEBitmapInfo            bmpInfo = {0};
SFXRectangle                  bmpRect;
SFBTransformSmp          trans;
SFXGrid                 point;
AEETransformMatrix       matrix  = {0};

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

if (bmp != null) {
    // get the size of the bitmap.
    bmp->GetInfo(&bmpInfo);

    // set the source rectangle of bitmap.
    bmpRect.Set(0, 0, (UInt16)bmpInfo.cx, (UInt16)bmpInfo.cy);

    // create a temporary bitmap for transform.
    // ( Create a bitmap compatible with destination bitmap.)
    dst = graphic->GetDestination();
    tmp = dst->CreateCompatibleBitmap(SFXSize((UInt16)bmpInfo.cx, (UInt16)bmpInfo.cy));

    // draw the temporary bitmap.
    tmp->BltIn(bmpRect, bmp, SFXGrid(0, 0));

    // create the instance of SFBTransform.
    trans = SFBTransform::NewInstance(dst);

    // set the tramsform matrix.
    // resize to 1.5x size.
    matrix.A = 384;
    matrix.B = 0;
    matrix.C = 0;
    matrix.D = 384;

    // draw the 1.5x resized source bitmap.
    point.Set((UInt16)(bmpInfo.cx / 2), (UInt16)(bmpInfo.cy / 2));
    trans->TransformBltComplex(
                                point,    // coordinate of destination.
                                tmp,      // source bitmaop.
                                bmpRect,  // source rectangle.
                                matrix    // resize to 1.5x
                              );
}

Reference

BREW API ITRANSFORM_TransformBltComplex | BREW API Transform properties | AEEMatrixTransform | SFBTransform


SFBTransform::TransformBltSimple
Blit a one bitmap to another, applying a set of simple, predefined transformations.
[ public ]
SFCError TransformBltSimple(
    SInt32 xDest                          // x-Coordinate in destination where upper left corner of source will be drawn
    SInt32 yDest                          // y-Coordinate in destination where upper left corner of source will be drawn
    SFBBitmapSmpConstRef bmpSrc           // source bitmap
    SInt32 xSrc                           // x-Coordinate of upper left corner of source bitmap to be blitted to destination
    SInt32 ySrc                           // y-Coordinate of upper left corner of source bitmap to be blitted to destination
    UInt32 dxSrc                          // width of source bitmap area to be blitted
    UInt32 dySrc                          // height of source bitmap area to be blitted
    UInt16 transform                      // flag
    UInt08 composite = COMPOSITE_OPAQUE   // property
);
[ public ]
SFCError TransformBltSimple(
    SFXGridConstRef gridDest              // coordinate in destination where upper left corner of source will be drawn
    SFBBitmapSmpConstRef bmpSrc           // source bitmap
    SFXRectangleConstRef rectSrc          // source rectangle
    UInt16 transform                      // flag
    UInt08 composite = COMPOSITE_OPAQUE   // property
);

Example

Read a bitmap from resource map, resize it to 2x size and draw it.

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

SFXGraphicsPtr          graphic = SFXGraphics::GetInstance();
SFBShellSmp             shell   = SFBShell::GetInstance();
SFBBitmapSmp            bmp;
SFBBitmapSmp            dst;
SFBBitmapSmp            tmp;
AEEBitmapInfo           bmpInfo = {0};
SFXRectangle                 bmpRect;
SFBTransformSmp         trans;

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

if (bmp != null) {
    // get the size of the bitmap.
    bmp->GetInfo(&bmpInfo);

    // set the source rectangle of bitmap.
    bmpRect.Set(0, 0, (UInt16)bmpInfo.cx, (UInt16)bmpInfo.cy);

    // create a temporary bitmap for transform.
    // ( Create a bitmap compatible with destination bitmap.)
    dst = graphic->GetDestination();
    tmp = dst->CreateCompatibleBitmap(SFXSize((UInt16)bmpInfo.cx, (UInt16)bmpInfo.cy));

    // draw the temporary bitmap.
    tmp->BltIn(bmpRect, bmp, SFXGrid(0, 0));

     // create the instance of SFBTransform.
    trans = SFBTransform::NewInstance(dst);

    // resize the source bitmap to 2x size and draw it.
    point.Set((UInt16)(bmpInfo.cx / 2), (UInt16)(bmpInfo.cy / 2));
    trans->TransformBltSimple(
                               point,             / Coordinate of destination.
                               tmp,               // source bitmaop.
                               bmpRect,           // source rectangle.
                               TRANSFORM_SCALE_2  // resize to 2x
                              );
}

Reference

BREW API ITRANSFORM_TransformBltSimple | BREW API Transform properties | SFBTransform