NO

Author Topic: How to use Windows Imaging Framework  (Read 15682 times)

leandrojardim

  • Guest
How to use Windows Imaging Framework
« on: April 25, 2012, 11:04:34 PM »
I have this code as seen in MSDN:

Code: [Select]
#include <windows.h>
#include <wincodec.h>

void foobar (void) {
HRESULT Result = 0;
IWICImagingFactory *Factory = NULL;

CoInitialize(NULL);
Result = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, IID_PPV_ARGS(&Factory));

D:\Documentos do Leandro\Pelles C Projects\Alien - Cópia\ball.c(255): error #2140: Type error in argument 1 to 'CoCreateInstance'; expected 'LPCGUID const' but found 'UOW'.
D:\Documentos do Leandro\Pelles C Projects\Alien - Cópia\ball.c(255): error #2140: Type error in argument 4 to 'CoCreateInstance'; expected 'LPCGUID const' but found 'UOW'.
D:\Documentos do Leandro\Pelles C Projects\Alien - Cópia\ball.c(255): warning #2018: Undeclared function 'IID_PPV_ARGS'; assuming 'extern' returning 'int'.
D:\Documentos do Leandro\Pelles C Projects\Alien - Cópia\ball.c(255): error #2140: Type error in argument 5 to 'CoCreateInstance'; expected 'void * *' but found 'int'.

But it doesnt compile. What do I need to modify to make it work as expected?

Thanks!
« Last Edit: April 25, 2012, 11:53:39 PM by leandrojardim »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to use Windows Imaging Framework
« Reply #1 on: April 26, 2012, 07:27:14 AM »
You example was for C++.
So
Code: [Select]
#define IID_PPV_ARGS(ppType) ((void**)(ppType))
Result = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, IID_PPV_ARGS(&Factory));
or
Code: [Select]
Result = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&Factory);
May the source be with you

leandrojardim

  • Guest
Re: How to use Windows Imaging Framework
« Reply #2 on: April 27, 2012, 01:57:37 AM »
Thanks, timo!  :)

_SIL_

  • Guest
Re: How to use Windows Imaging Framework
« Reply #3 on: August 07, 2012, 04:19:38 PM »
Is there a way to use IWICImagingFactory or  IImagingFactory on WinCe???
In winmobile SDK no wincodec.h. Need help!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to use Windows Imaging Framework
« Reply #4 on: August 07, 2012, 05:18:05 PM »
Quote
IImagingFactory on WinCe???
Requirements

OS Versions: Windows CE 5.0 and later.
Header: Imaging.h
Link Library: Imaging.lib

It is COM based and Imaging.h is for C++ only.

http://msdn.microsoft.com/en-us/library/aa452202
http://www.microsoft.com/en-us/download/details.aspx?id=17310
May the source be with you

_SIL_

  • Guest
Re: How to use Windows Imaging Framework
« Reply #5 on: August 07, 2012, 05:56:02 PM »
Thanks, timovjl.
I need only draw several *png with transparency on my form. In evc4 i have worked sample, but i like pelles more than evc.
Maybe you can suggest me easy way to do that in pelles с ? ???
Target prog is very simple so i would't want to overload by libpng or cximage librarys....


Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: How to use Windows Imaging Framework
« Reply #6 on: August 07, 2012, 06:01:59 PM »
How about using GDI+ instead, if that is available on WinCE?
---
Stefan

Proud member of the UltraDefrag Development Team

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to use Windows Imaging Framework
« Reply #7 on: August 07, 2012, 10:12:31 PM »
Here is simple example with partially converted header file.
« Last Edit: August 09, 2012, 06:07:36 AM by timovjl »
May the source be with you

_SIL_

  • Guest
Re: How to use Windows Imaging Framework
« Reply #8 on: August 08, 2012, 09:43:20 AM »
Here is simple example with partially converted header file.
Wow! You Great! Compilled sample work fine!

Can you show your ImgTest.h? Please!!!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to use Windows Imaging Framework
« Reply #9 on: August 08, 2012, 12:35:35 PM »
Oops, but now it is in that zip.
May the source be with you

_SIL_

  • Guest
Re: How to use Windows Imaging Framework
« Reply #10 on: August 08, 2012, 01:22:43 PM »
Many, many thanks!!!
Work fine with CreateImageFromStream() too.

For using GetImageInfo() ImgTest.h also need that
Code: [Select]
typedef INT PixelFormat;

struct ImageInfo{
    GUID RawDataFormat;
    PixelFormat PixelFormat;
    UINT Width, Height;
    UINT TileWidth, TileHeight;
    double Xdpi, Ydpi;
    UINT Flags;
};
Thanks!

-----
screen from my prog: http://lostpic.net/images/ccca17b85f423d928e4bcd61626f03dc.png
« Last Edit: August 10, 2012, 06:47:40 PM by _SIL_ »