Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Please help me !!!

I am really having a problem on this function. I cant make it work on my simulator.What I try to achieve is to scale a IBitmap that converted form a png file in my RES_File.

So use ...IBitmapScale_Scale(bitmapscale ,bitmap ,NULL ,pDst ,NULL ,NULL , AEE_RO_OLDTRANSPARENT);bitmap is a source img, pDst is point to another which have different size.I suppose that the above code is to scale a whole source file and write new img on the pDst.

Am I understand it correctly?

But it's always crash with memory access violation. PLEASE HELP ME or at least give me a guide

thanks

The area of the source bitmap defined by prcSrc is scaled to fit into the prcDst rect. Only the part of the image that ends up in the intersection of prcDst and prcClip is drawn into the destination.

The area of the source bitmap defined by prcSrc is scaled to fit into the prcDst rect. Only the part of the image that ends up in the intersection of prcDst and prcClip is drawn into the destination.

Have you ever success on doing so?
if yes can you give me an example.
I am totally understand what you mention it 's also on the api page
I expect something different here

Have you ever success on doing so?
if yes can you give me an example.
I am totally understand what you mention it 's also on the api page
I expect something different here

Sample code:
IBitmap * pDevBitmap;
AEERect sRec;
AECHAR aStr[25];
double sFac;

IBitmap * pDevBitmap=NULL;
AEERasterOp rop;

rop=AEE_RO_COPY;

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);
if( pDevBitmap == NULL )
{
DBGPRINTF("Unable to get Device Bitmap");
}

if (pMe->pIBitmap)
{
IBitmap_Release(pMe->pIBitmap);
pMe->pIBitmap = NULL;
}

//Creating the compatible bitmap pointer to the device bitmap
IBITMAP_CreateCompatibleBitmap(pDevBitmap,&pMe->pIBitmap,pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen);
//Copying the data from device bitmap
IBITMAP_BltIn(pMe->pIBitmap,0,0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen, pDevBitmap,0,0, rop);

IBITMAP_Release(pDevBitmap);

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);

IDISPLAY_EraseRgn(pMe->pIDisplay, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen);
IDISPLAY_Update(pMe->pIDisplay);

sRec.x=0;
sRec.y=0;

sFac=0.25;
//sFac=0.5;
//sFac=0.75;

pMe->DeviceInfo.cxScreen = (uint16)(pMe->DeviceInfo.cxScreen*sFac);
pMe->DeviceInfo.cyScreen = (uint16)(pMe->DeviceInfo.cyScreen*sFac);
sRec.dx=pMe->DeviceInfo.cxScreen;
sRec.dy=pMe->DeviceInfo.cyScreen;

IBitmapScale_Scale(pMe->pIBitmapScale,pMe->pIBitmap,NULL,pDevBitmap,&sRec,NULL,0);

if (pDevBitmap)
{
IBitmap_Release(pDevBitmap);
pDevBitmap = NULL;
}
if (pMe->pIBitmap)
{
IBitmap_Release(pMe->pIBitmap);
pMe->pIBitmap = NULL;
}

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);
IBITMAP_CreateCompatibleBitmap(pDevBitmap,&pMe->pIBitmap,(uint16)(pMe->DeviceInfo.cxScreen/sFac), (uint16)(pMe->DeviceInfo.cyScreen/sFac));
IBITMAP_BltIn(pMe->pIBitmap,0,0, (uint16)(pMe->DeviceInfo.cxScreen/sFac), (uint16)(pMe->DeviceInfo.cyScreen/sFac), pDevBitmap,0,0, AEE_RO_COPY);

IDISPLAY_Update(pMe->pIDisplay);
IBITMAP_Release(pDevBitmap);

Sample code:
IBitmap * pDevBitmap;
AEERect sRec;
AECHAR aStr[25];
double sFac;

IBitmap * pDevBitmap=NULL;
AEERasterOp rop;

rop=AEE_RO_COPY;

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);
if( pDevBitmap == NULL )
{
DBGPRINTF("Unable to get Device Bitmap");
}

if (pMe->pIBitmap)
{
IBitmap_Release(pMe->pIBitmap);
pMe->pIBitmap = NULL;
}

//Creating the compatible bitmap pointer to the device bitmap
IBITMAP_CreateCompatibleBitmap(pDevBitmap,&pMe->pIBitmap,pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen);
//Copying the data from device bitmap
IBITMAP_BltIn(pMe->pIBitmap,0,0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen, pDevBitmap,0,0, rop);

IBITMAP_Release(pDevBitmap);

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);

IDISPLAY_EraseRgn(pMe->pIDisplay, 0, 0, pMe->DeviceInfo.cxScreen, pMe->DeviceInfo.cyScreen);
IDISPLAY_Update(pMe->pIDisplay);

sRec.x=0;
sRec.y=0;

sFac=0.25;
//sFac=0.5;
//sFac=0.75;

pMe->DeviceInfo.cxScreen = (uint16)(pMe->DeviceInfo.cxScreen*sFac);
pMe->DeviceInfo.cyScreen = (uint16)(pMe->DeviceInfo.cyScreen*sFac);
sRec.dx=pMe->DeviceInfo.cxScreen;
sRec.dy=pMe->DeviceInfo.cyScreen;

IBitmapScale_Scale(pMe->pIBitmapScale,pMe->pIBitmap,NULL,pDevBitmap,&sRec,NULL,0);

if (pDevBitmap)
{
IBitmap_Release(pDevBitmap);
pDevBitmap = NULL;
}
if (pMe->pIBitmap)
{
IBitmap_Release(pMe->pIBitmap);
pMe->pIBitmap = NULL;
}

IDISPLAY_GetDeviceBitmap(pMe->a.m_pIDisplay, &pDevBitmap);
IBITMAP_CreateCompatibleBitmap(pDevBitmap,&pMe->pIBitmap,(uint16)(pMe->DeviceInfo.cxScreen/sFac), (uint16)(pMe->DeviceInfo.cyScreen/sFac));
IBITMAP_BltIn(pMe->pIBitmap,0,0, (uint16)(pMe->DeviceInfo.cxScreen/sFac), (uint16)(pMe->DeviceInfo.cyScreen/sFac), pDevBitmap,0,0, AEE_RO_COPY);

IDISPLAY_Update(pMe->pIDisplay);
IBITMAP_Release(pDevBitmap);