[cairo] Hello, Cairo! Re: Simple Win32 GDI example with Cairo wanted

Asko Kauppi askok at dnainternet.net
Wed Sep 3 07:45:03 PDT 2008


Which precompiled Cairo lib did you use?

The only one I've found is the one referenced at cairographics.org (http://inkscape.modevia.com/win32libs 
).

That has cairo-1.6.4-mingw.tar.gz that seems to be MSYS-based (has bin/ 
libcairo-2.dll, lib/libcairo.la, lib/libcairo.dll.a).  These are  
useless from VC++, right?

-asko


ja alex kirjoitti 3.9.2008 kello 14:31:

> Hi  folks,
>     I setup VS2008 Cairo hello world project without using GTK+ for  
> windows.
>
> Actually Cairo has win32 surface support(base on GDI). Use   
> cairo_win32_surface_create
>
> instead of other surface creating API (like  
> cairo_image_surface_create).
>
> Only few instructions need to be follow:
> 0. Download cairo lib for windows.
> 1. Use wizard to create a win32 project in Visual C++ 2008 express.
> 2. Open <your project name>.cpp and find function WndProc.
> 3. Modify WM_PAINT branch with piece of code below:
> 	case WM_PAINT:
> 		hdc = BeginPaint(hWnd, &ps);
> 		// TODO: Add any drawing code here...
> 		cairo_surface_t *surface;
> 		cairo_t *cr;
>
>     	surface = cairo_win32_surface_create(hdc);
>     	cr = cairo_create(surface);
> 		Draw(cr);   //  <<<<<<Cairo draw here
> 		cairo_destroy(cr);
> 		
> 		EndPaint(hWnd, &ps);
> 		break;
> 4. Add cairo lib path to new project.
> 5.Compile and check the result
>
> After that,  you will see your cairo drawing  in Windows program's  
> client area.
>
> Hope it is helpful, and correct me if there are mistakes.
>
>
> 2008/9/2 Mohit Sindhwani <tech at onghu.com>
> Asko Kauppi wrote:
> > I would second this.
> >
> > Although setting up a "Hello world" IDE project drawing the text  
> using
> > Cairo should not be a Big Deal, it certainly would help the initial
> > step (instead of pressing 'new' in the IDE).
> >
> > Especially since Windows is my 3rd platform, and I am using VC++  
> 2008
> > Express only occasionally.  So, if anyone has a "Hello world"  
> Cairo +
> > VC++ 2008 project to spare, thanks!   :)
> >
> > In fact, I would like to see such Hello World for VC++, GTK+ and  
> OS X
> > (XCode) all of them.
> >
> > -asko
> >
> Actually I have a Hello World example for Borland Turbo C++ (the new
> currently free version of C++ Builder) - I'm a bit busy the next few
> days, but should be able to post more information about it in the  
> weekend.
>
> Cheers,
> Mohit.
> 9/2/2008 | 12:24 AM.
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list