scale image using ITransform interface | developer.brewmp.com scale image using ITransform interface | developer.brewmp.com

Developer

scale image using ITransform interface

Forums:

Hi, I am trying to resize a bitmap image using ITRANSFORM_TransformBltComplex().
I am getting the resized image but it overlaps the previous image on the display.

also can I save this resized image at given location.

The code is given below

int nRet = 0;
IBitmap* pIBitmap = NULL;
IBitmap* pIBitmap1 = NULL;
ITransform *pITransform = NULL;

pIBitmap1 = ISHELL_LoadBitmap(pMe->m_pIShell, "snap1.bmp");

IDISPLAY_GetDeviceBitmap(pMe->m_pIDisplay, &pIBitmap);
IBITMAP_QueryInterface(pIBitmap, AEECLSID_TRANSFORM, (void **)(&pITransform);

//Scale an image
// nRet = ITRANSFORM_TransformBltSimple(pITransform, 0, 0, pIBitmap1, 0, 0, 192, 192,
// TRANSFORM_SCALE_HALF, COMPOSITE_KEYCOLOR);

AEETransformMatrix xMatrix;
xMatrix.A=200; // for .8
xMatrix.B=0;
xMatrix.C=0;
xMatrix.D=200;

//Scale an image
nRet = ITRANSFORM_TransformBltComplex(pITransform, 0, 0, pIBitmap1, 0, 0, 192, 192,
&xMatrix, COMPOSITE_KEYCOLOR);

// IDISPLAY_ClearScreen(pMe->m_pIDisplay);
IDISPLAY_Update(pMe->m_pIDisplay);

If anybody have any idea please help me to get it out.
Thanks
-- Kushal

Just create a new compatible bitmap from the device bitmap. It's kind of expected that if you transform your image into the device bitmap, it's going to end up on the device bitmap.

Just create a new compatible bitmap from the device bitmap. It's kind of expected that if you transform your image into the device bitmap, it's going to end up on the device bitmap.

Hi, If I use different IBitmap pointer for ITransform nothing happens on the screen.
I am getting this new IBitmap pointer using CreateCompatibleBitmap()
See the code
int nRet = 0;
IBitmap* pIBitmap = NULL;
IBitmap* pIBitmap1 = NULL;
ITransform *pITransform = NULL;
IDISPLAY_GetDeviceBitmap(pMe->m_pIDisplay, &pIBitmap);
IBITMAP_CreateCompatibleBitmap(pIBitmap,&pIBitmap1,100,100);
IBITMAP_QueryInterface(pIBitmap1, AEECLSID_TRANSFORM, (void **)(&pITransform));
//Scale an image
nRet = ITRANSFORM_TransformBltSimple(pITransform, m_xPos, m_yPos, pIBitmap1, m_xPos, m_yPos, 100, 100,
TRANSFORM_SCALE_HALF, COMPOSITE_KEYCOLOR);
IDISPLAY_Update(pMe->m_pIDisplay);
if(pIBitmap){
IBITMAP_Release(pIBitmap);
pIBitmap = NULL;
}
if(pIBitmap1){
IBITMAP_Release(pIBitmap1);
pIBitmap1 = NULL;
}
if(pITransform){
ITRANSFORM_Release(pITransform);
pITransform = NULL;
}

Hi, If I use different IBitmap pointer for ITransform nothing happens on the screen.
I am getting this new IBitmap pointer using CreateCompatibleBitmap()
See the code
int nRet = 0;
IBitmap* pIBitmap = NULL;
IBitmap* pIBitmap1 = NULL;
ITransform *pITransform = NULL;
IDISPLAY_GetDeviceBitmap(pMe->m_pIDisplay, &pIBitmap);
IBITMAP_CreateCompatibleBitmap(pIBitmap,&pIBitmap1,100,100);
IBITMAP_QueryInterface(pIBitmap1, AEECLSID_TRANSFORM, (void **)(&pITransform));
//Scale an image
nRet = ITRANSFORM_TransformBltSimple(pITransform, m_xPos, m_yPos, pIBitmap1, m_xPos, m_yPos, 100, 100,
TRANSFORM_SCALE_HALF, COMPOSITE_KEYCOLOR);
IDISPLAY_Update(pMe->m_pIDisplay);
if(pIBitmap){
IBITMAP_Release(pIBitmap);
pIBitmap = NULL;
}
if(pIBitmap1){
IBITMAP_Release(pIBitmap1);
pIBitmap1 = NULL;
}
if(pITransform){
ITRANSFORM_Release(pITransform);
pITransform = NULL;
}