Hi all,

I am new to develop an AP on winCE 5.0 and I try to use the
IImage library. Now I can load the JPG picture on the screen
successfully and try to rotate it. However I met some problem.

I had find some suggestion which indicate how to rotate bitmap step by
step as follows:

CoInitialize
CoCreate CLSID_ImagingFactory
CreateImageFromFile which returns you an IImage interface
Query the IImage interface for IBasicBitmapOps interface
use the IBasicBitmapOps interface to adjust brightness, contrast,
gamma,
rotation, etc.
Use the IImage interface to Draw the bitmap on the screen

I just can't understand which does the "Query the IImage interface for
IBasicBitmapOps interface" means.

Here is my code and would anyone tell me where is going wrong ?

By the way, is it possible to use the IImage library to convert from
JPG to BMP and PNG ?

Thanks in advance, any suggestion will be appreciated.


::CoUninitialize();
IImagingFactory *pFactory = NULL;
IImage *pImage = NULL;
ImageInfo *info = NULL;
IBitmapImage *rotebitmap = NULL;
IBasicBitmapOps *oper = NULL;

::CoCreateInstance(CLSID_ImagingFactory,
NULL,CLSCTX_INPROC_SERVER,IID_IImagingFactory, (void **)&pFactory);

pFactory->CreateImageFromFile(L"\\jupiter.jpg", &pImage);

pFactory->CreateBitmapFromImage(pImage, 0, 0, PixelFormatDontCare,
InterpolationHintDefault, &rotebitmap);

pImage->QueryInterface(IID_IBasicBitmapOps, (void **) &oper);

oper->Rotate(180.0, InterpolationHintDefault, &rotebitmap);

pImage->Draw(hdc, &test , NULL);

Re: Use IImage in WinCE by bluesphere

bluesphere
Fri Feb 02 11:29:04 CST 2007

"Query the IImage interface for IBasicBitmapOps interface"

means that you would like to get a pointer to an
interface that is able to rotate the underlying image.
The pointer is stored into "oper" in your case. But
you cannot be sure that the interface is actually
implemented if you don't check QueryInterface's
return value. I never used this rotation but i notice
that the documentation says that the interface for
IBasicBitmapOps has to be queried to an
IBitmapImage object.


"googoo" <googoo.2ldhdz@no-spam-here.com> wrote in message
news:googoo.2ldhdz@no-spam-here.com...
>
> Hi all,
>
> I am new to develop an AP on winCE 5.0 and I try to use the
> IImage library. Now I can load the JPG picture on the screen
> successfully and try to rotate it. However I met some problem.
>
> I had find some suggestion which indicate how to rotate bitmap step by
> step as follows:
>
> CoInitialize
> CoCreate CLSID_ImagingFactory
> CreateImageFromFile which returns you an IImage interface
> Query the IImage interface for IBasicBitmapOps interface
> use the IBasicBitmapOps interface to adjust brightness, contrast,
> gamma,
> rotation, etc.
> Use the IImage interface to Draw the bitmap on the screen
>
> I just can't understand which does the "Query the IImage interface for
> IBasicBitmapOps interface" means.
>
> Here is my code and would anyone tell me where is going wrong ?
>
> By the way, is it possible to use the IImage library to convert from
> JPG to BMP and PNG ?
>
> Thanks in advance, any suggestion will be appreciated.
>
>
> ::CoUninitialize();
> IImagingFactory *pFactory = NULL;
> IImage *pImage = NULL;
> ImageInfo *info = NULL;
> IBitmapImage *rotebitmap = NULL;
> IBasicBitmapOps *oper = NULL;
>
> ::CoCreateInstance(CLSID_ImagingFactory,
> NULL,CLSCTX_INPROC_SERVER,IID_IImagingFactory, (void **)&pFactory);
>
> pFactory->CreateImageFromFile(L"\\jupiter.jpg", &pImage);
>
> pFactory->CreateBitmapFromImage(pImage, 0, 0, PixelFormatDontCare,
> InterpolationHintDefault, &rotebitmap);
>
> pImage->QueryInterface(IID_IBasicBitmapOps, (void **) &oper);
>
> oper->Rotate(180.0, InterpolationHintDefault, &rotebitmap);
>
> pImage->Draw(hdc, &test , NULL);
>
>



Re: Use IImage in WinCE by googoo

googoo
Sat Feb 03 09:44:33 CST 2007


bluesphere Wrote:
> "Query the IImage interface for IBasicBitmapOps interface"
>
> means that you would like to get a pointer to an
> interface that is able to rotate the underlying image.
> The pointer is stored into "oper" in your case. But
> you cannot be sure that the interface is actually
> implemented if you don't check QueryInterface's
> return value. I never used this rotation but i notice
> that the documentation says that the interface for
> IBasicBitmapOps has to be queried to an
> IBitmapImage object.
> >[/color]

Thanks bluesphere, it really a great help for me :)
I think I should try to query IBitmapImage instead of IImage
I will try it again. Thanks for your kindly advice again