none
How to use GDI+ on Windows Mobile?

    Question

  • Hi everyone.
    Dont't you know how to use GDI+ on Windows Mobile? Yes, I've found gdiplus.dll in \Windows but it didn't help me much because:
    1) There are no gdiplus.h file in the include directory for Windows CE.
    2) I cannot get(copy) gdiplus.dll somwhere to get all the functions' names contained in this file and to create .lib file (the system gives me no chance to do it).
    3) I've tried LoadLibrary and GetProcAddress. Doing so I can call GdiplusStartup, GdipCreateFromHDC, GdipCreatePen1 and even GdipDrawLineI with OK as a returning value and line is even painted! But when I call GdipDrawBezier, GdipDrawString, GdipDrawCurveI and may other
     neccessary for me functions they return NotImlemented. Is it true that gdi+ on Windows Mobile 5/6 can draw only lines and pixels and it cannot draw beziers, ellipses and other figures? If yes, then what was gdiplus.dll recorded for if there are no essential functions?

    I tried to draw a bezier with GDI, but I've found out that there is no such function present in wingdi.h. Is it possible to draw a bezier 
    somehow?

    What should I use to paint in Windows Mobile 5/6/... and how was all the graphics interface of Windows Mobile painted if many important graphics functions are absent?

    Waiting for someones reply,
    with respect, Artem


    Friday, February 8, 2008 12:09 PM

Answers

  • Hi Artem,

     

    Since you asked this question in a .NET Compact Framework related newsgroup I assume you are wanting to eventually use the GDI+ APIs within a .NET CF application.

     

    In this case you might like to read Alex Feinman's article "Using GDI+ on Windows Mobile" available at http://community.opennetcf.com/articles/cf/archive/2007/10/31/using-gdi-on-windows-mobile.aspx which introduces a C# wrapper for the GDI+ APIs.

     

    You are correct that many of the more advanced drawing functions present within GDI on the desktop are not available in the subset present on Windows CE. Sometimes you can work around these, sometimes you will need to look at third party graphics libraries which end up proiding you with a bitmap that cn be rendered via GDI etc.

     

    Hope this helps,

    Christopher Fairbairn

     

    Saturday, February 9, 2008 10:37 AM
  • Hi Artem

     

    To draw text, use the clasic Win32 GDI APIs DrawText or ExtTextOut. All details can be found in the MSDN Library.

     

    The following two samples show how you could implement the missing bezier drawing function yourself:

    http://www.codeproject.com/KB/mobile/BezierOnPPC.aspx

    http://www.feirtech.com/Articles.aspx?ticle=cfv2_beziers

     

    Hope this is what your looking for

    Michael

    Monday, February 18, 2008 10:42 PM
    Moderator

All replies

  • Hi Artem,

     

    Since you asked this question in a .NET Compact Framework related newsgroup I assume you are wanting to eventually use the GDI+ APIs within a .NET CF application.

     

    In this case you might like to read Alex Feinman's article "Using GDI+ on Windows Mobile" available at http://community.opennetcf.com/articles/cf/archive/2007/10/31/using-gdi-on-windows-mobile.aspx which introduces a C# wrapper for the GDI+ APIs.

     

    You are correct that many of the more advanced drawing functions present within GDI on the desktop are not available in the subset present on Windows CE. Sometimes you can work around these, sometimes you will need to look at third party graphics libraries which end up proiding you with a bitmap that cn be rendered via GDI etc.

     

    Hope this helps,

    Christopher Fairbairn

     

    Saturday, February 9, 2008 10:37 AM
  • Hello Christopher.

    Thank you for the reply. But I need to use GDI+ library without NET Compact Framework, but on the ARMV41 platform itself. Nethertheless you reply was very helpful.

    Would you advise me what library should I use to draw beziers and text on ARMV41 (Windows Mobile 5 ...)?

    With respect,
    Artem Kushnir
    Tuesday, February 12, 2008 1:23 PM
  • Hi Artem

     

    To draw text, use the clasic Win32 GDI APIs DrawText or ExtTextOut. All details can be found in the MSDN Library.

     

    The following two samples show how you could implement the missing bezier drawing function yourself:

    http://www.codeproject.com/KB/mobile/BezierOnPPC.aspx

    http://www.feirtech.com/Articles.aspx?ticle=cfv2_beziers

     

    Hope this is what your looking for

    Michael

    Monday, February 18, 2008 10:42 PM
    Moderator
  • Hi Michael.

     

    Thanks, your post was very helpful and it helped me much.

    But there is another essential thing that I don't know how to implement. And this thing is transformations. Don't you know how to transform the coordinate space, because I couldn't find any functions like SetTransform, RotateTransform, TranslateTransform that change  the CTM (if it exists there) in Windows Mobile graphics applications. Should new user functions be written to implement transformation possibilities?

     

    With Respect,

    Artem

     

    Tuesday, February 19, 2008 6:26 AM
  • Hi Artem

     

    Yep, this is one of the options you have. Some Information on the underlaying math for doing this can be found here:

    http://en.wikipedia.org/wiki/Transformation_matrix

     

    An other option is to use the Direct 3D Mobile extension library available starting with Windows Mobile 5.0. You should be able to implement your coordinate transformantions using this library. The details can be found here: http://msdn2.microsoft.com/en-us/library/aa921044.aspx

     

    Michael

    Tuesday, February 19, 2008 3:58 PM
    Moderator
  • hello guys..

    i was checking this thread because i want to implement some 2D vector drawing sketch tool on .NET Compact Framework...

    u think gdiplus is the way to go?


    i wanna be able to draw with stylus a line on the screen, but without being a freehand drawing.. if i want a straight line, i wanna get a straight line!!
    Thursday, March 27, 2008 1:11 PM
  • Hi cornelyus

     

    On Windows Mobile, GDI+ is not an officially documented API.  You'll be using these APIs at your own risk.

     

    I'd suggest the following strategy:

    Evaluate, whether the officially available APIs are good enough to get your job done. From what you write, this should be possible.

    If the standard APIs are not good enough, consider using the GDI+ apis

     

    Hope this does make sens

    Michael

    Thursday, March 27, 2008 4:44 PM
    Moderator
  • hello Michael...

    i found this library.. from open net..

    http://community.opennetcf.com/articles/cf/archive/2007/10/31/using-gdi-on-windows-mobile.aspx

    i was able to draw some pretty simple vector lines...

    now about drawarcs... i would say.. it's not supported... right?
    Friday, March 28, 2008 10:49 AM
  • Hi cornelyus

     

    If you get an exception saying 'NotImplemented' - this means that the called API is not supported.

     

     

     

    Friday, March 28, 2008 1:15 PM
    Moderator
  • thank you....

    well... guess it won't be an easy thing to draw some arc's Indifferent
    Friday, March 28, 2008 4:32 PM
  • The OpenNETCF.org SDK 1.4 RoundGauge control has some code to draw arcs. The download can be found here: http://www.opennetcf.com/FreeSoftware/SDF14/tabid/91/Default.aspx

     

    This should help

    Michael

     

     

    Monday, March 31, 2008 8:03 AM
    Moderator