IBitmap rotation | developer.brewmp.com IBitmap rotation | developer.brewmp.com

Developer

IBitmap rotation

Forums:

Hi !

I loaded a bitmap in an IBitmap interface and now I want to rotate that image using ITransform interface, but no matter what I do, nothing happens on the image after I apply the transformation. Could someone help me out on this ?

ITransform *transform = null;

if( IBITMAP_QueryInterface( m_bitmap, AEECLSID_TRANSFORM, (void**)&transform ) == SUCCESS )
{
if( ITRANSFORM_TransformBltSimple( transform, 0, 0, m_bitmap, getX( ), getY( ), getWidth( ), getHeight( ), TRANSFORM_ROTATE_90, COMPOSITE_KEYCOLOR ) == SUCCESS )
{
DBGPRINTF("Image transformed...");
}

Thanks very much !

Well, it is working now, but I really can't rotate it perfectly, the image gets distorced when I call:
ITRANSFORM_TransformBltSimple( transform, getX( ), getY( ), m_bitmap, 0, 0, getWidth( ), getHeight( ), TRANSFORM_ROTATE_90, COMPOSITE_KEYCOLOR );
and I can't understand the API description at all, kinda too simple :/

Well, it is working now, but I really can't rotate it perfectly, the image gets distorced when I call:
ITRANSFORM_TransformBltSimple( transform, getX( ), getY( ), m_bitmap, 0, 0, getWidth( ), getHeight( ), TRANSFORM_ROTATE_90, COMPOSITE_KEYCOLOR );
and I can't understand the API description at all, kinda too simple :/

what bit don't you understand

what bit don't you understand

From the description below:
int ITRANSFORM_TransformBltSimple
(
ITransform *pITransform,
int xDst,
int yDst,
IBitmap *pSrc,
int xSrc,
int ySrc,
unsigned dxSrc,
unsigned dySrc,
uint16 unTransform,
uint8 unComposite
)
I can't understand:
- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
I get confused when it comes to put values on it.
I just want to rotate the image keeping the center of it fixed.

From the description below:
int ITRANSFORM_TransformBltSimple
(
ITransform *pITransform,
int xDst,
int yDst,
IBitmap *pSrc,
int xSrc,
int ySrc,
unsigned dxSrc,
unsigned dySrc,
uint16 unTransform,
uint8 unComposite
)
I can't understand:
- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
I get confused when it comes to put values on it.
I just want to rotate the image keeping the center of it fixed.

- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
If you want to just rotate by center, keep xDst=xSrc, and yDest=ySrc. Here you are trying to give x,y,dx,dy of a image rect to be rotated and display at xdes,ydest.
You can compare manually rotated using image tool and the one with handset. If the distortion mean a corrupted image, then something else is going on.

- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
If you want to just rotate by center, keep xDst=xSrc, and yDest=ySrc. Here you are trying to give x,y,dx,dy of a image rect to be rotated and display at xdes,ydest.
You can compare manually rotated using image tool and the one with handset. If the distortion mean a corrupted image, then something else is going on.

bru wrote:- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
If you want to just rotate by center, keep xDst=xSrc, and yDest=ySrc. Here you are trying to give x,y,dx,dy of a image rect to be rotated and display at xdes,ydest.
You can compare manually rotated using image tool and the one with handset. If the distortion mean a corrupted image, then something else is going on.
Hi Bru,
After I read your post I changed my code to:
ITRANSFORM_TransformBltSimple( transform, getX( ), getY( ), m_bitmap, getX( ), getY( ), getWidth( ), getHeight( ), TRANSFORM_ROTATE_90, COMPOSITE_KEYCOLOR );
but no changes are done on the image when I call this function.

bru wrote:- xDst/yDest
- xSrc/ySrc
- dxSrc/dySrc
If you want to just rotate by center, keep xDst=xSrc, and yDest=ySrc. Here you are trying to give x,y,dx,dy of a image rect to be rotated and display at xdes,ydest.
You can compare manually rotated using image tool and the one with handset. If the distortion mean a corrupted image, then something else is going on.
Hi Bru,
After I read your post I changed my code to:
ITRANSFORM_TransformBltSimple( transform, getX( ), getY( ), m_bitmap, getX( ), getY( ), getWidth( ), getHeight( ), TRANSFORM_ROTATE_90, COMPOSITE_KEYCOLOR );
but no changes are done on the image when I call this function.

I am not sure if this is what your problem is, where your dxSrc,dySrc are not same?
http://brewforums.qualcomm.com/showthread.php?t=7345
I remember little bit that I used rectangle.

I am not sure if this is what your problem is, where your dxSrc,dySrc are not same?
http://brewforums.qualcomm.com/showthread.php?t=7345
I remember little bit that I used rectangle.

bru wrote:I am not sure if this is what your problem is, where your dxSrc,dySrc are not same?
http://brewforums.qualcomm.com/showthread.php?t=7345
I remember little bit that I used rectangle.
I did it !
I'll explain it with more details later, but the problem was happening mainly because that I was using the same IBitmap interface on src and destination to apply the transformation, then that's why it was distorting before.
The "nothing happens" problem was happening because I was specifying a wrong values on ITRANSFORM_TransformBltSimple.
I'll detail it more later, maybe tomorrow, but keep in mind that the IBitmap specified on IBITMAP_QueryInterface must be diferent from the IBitmap interface sent on ITRANSFORM_TransformBltSimple other case it will distort because it will use changed pixels to make changes.
Thanks everybody who tried helping me :)

bru wrote:I am not sure if this is what your problem is, where your dxSrc,dySrc are not same?
http://brewforums.qualcomm.com/showthread.php?t=7345
I remember little bit that I used rectangle.
I did it !
I'll explain it with more details later, but the problem was happening mainly because that I was using the same IBitmap interface on src and destination to apply the transformation, then that's why it was distorting before.
The "nothing happens" problem was happening because I was specifying a wrong values on ITRANSFORM_TransformBltSimple.
I'll detail it more later, maybe tomorrow, but keep in mind that the IBitmap specified on IBITMAP_QueryInterface must be diferent from the IBitmap interface sent on ITRANSFORM_TransformBltSimple other case it will distort because it will use changed pixels to make changes.
Thanks everybody who tried helping me :)

Hi
You were abt to give some details on rotation of image ,actually i m facing the same problem ..i mean i m able to rotate the image but its getting distorted so pls provide some useful info
Thanks in advance :)

Hi
You were abt to give some details on rotation of image ,actually i m facing the same problem ..i mean i m able to rotate the image but its getting distorted so pls provide some useful info
Thanks in advance :)

kbrewdev wrote:Hi
You were abt to give some details on rotation of image ,actually i m facing the same problem ..i mean i m able to rotate the image but its getting distorted so pls provide some useful info
Thanks in advance :)
do not use the same bitmap for src and output..
for 90deg rotation, the height and width of image interchanges. 800x600 becomes 600x800..
180 deg rotation shud work fine in the above case..

kbrewdev wrote:Hi
You were abt to give some details on rotation of image ,actually i m facing the same problem ..i mean i m able to rotate the image but its getting distorted so pls provide some useful info
Thanks in advance :)
do not use the same bitmap for src and output..
for 90deg rotation, the height and width of image interchanges. 800x600 becomes 600x800..
180 deg rotation shud work fine in the above case..

oops its solved, I just saw the last post .. sorry!!
Hi kbrewdev, see the post above yours..

oops its solved, I just saw the last post .. sorry!!
Hi kbrewdev, see the post above yours..

:) hi Oceans eleven I did it ....................
Thanks

:) hi Oceans eleven I did it ....................
Thanks