[cairo] Windows CE usage

Michael Fink michael.fink at asamnet.de
Fri May 26 06:07:07 PDT 2006


Hi,

I just started to use the cairo library to draw some fancy graphics.
I'm using msvc8 and evc4 (eMbedded Visual C++ 4, for Windows CE).
Compiling with msvc8 (express) was straightforward, and evc4 needed a
little work, and I had to disable the font rendering, but the library
seems to work under Windows CE. I just wanted to make some comments
about the library and the needed changes.

In the file cairo-lzw.c there is the function _cairo_lzw_compress that
has the define cairo_public prepended. In the file cairoint.h the
function is prefixed with cairo_private. When I use the two defines to
export the public cairo API, there's an error about the redefinition
with different qualifiers (I'm using __declspec(dllexport)). I think
the function should be using cairo_private in the .c file, too.

In cairo-win32-surface.c the Win32 API function LoadLibrary is used to
load a DLL. When compiling in unicode mode (always true for Windows CE
targets) the LoadLibraryW function is used in _composite_alpha_blend.
This leads to a compiler error, since a non-unicode string was passed.
The line could be looking as following:

   HMODULE msimg32_dll = LoadLibraryW(L"msimg32");

Or, if windows.h (or more exactly tchar.h) is included, it can be:

   HMODULE msimg32_dll = LoadLibrary(TEXT("msimg32"));

There's also a minor fix for Windows CE for the GetProcAddress
function that takes unicode strings for the function name.

In general I just did small changes to the code to port it for Windows
CE. If there's interest, I could provide a patch. I worked with the
latest snapshot 1.1.6, but the changes are relatively small, so they
should be applyable to the latest version, too.

As already said, I couldn't use the font backend, since Windows CE
lacks the needed GDI functions such as SetWorldTransform,
ModifyWorldTransform, etc. Is there a possibility to use a smaller
subset of the GDI functions, e.g. to provide a reduced font backend? I
think I read something about this in the mailing list archive.

Besides the little porting, I think it's a great library to create
smooth looking graphics. Thanks for writing it!

bye
Michael


More information about the cairo mailing list