GDI+

I am in the middle porting one of my bigger OSX apps to Windows and stumbled across GDI+
I already figured out it enabled me to use alpha channels and antialiasing.

But can anyone explain what GDI+ exactly is/doing?
Are there any pitfalls? Does it work on all Windows versions? Does it introduce incompatibility issues?

BTW I still hate Windows. :slight_smile:

Is this a good answer ?
About GDI+

Sometimes, I hope to find answers to my questions as fast and easy than this one… ;-:slight_smile:

For what it’s worth, if you do find issues, you can turn it on/off when working with it. For instance, you can surround picture creation code with App.UseGDI = true and App.UseGDI = False.

[quote=129162:@Emile Schwarz]Is this a good answer ?
About GDI+ [/quote]

OK, this link is telling me it only is for Windows XP and Windows Server 2003? So do no benefit for newer Windows versions?

I use the ’ Advanced Graphics for Windows’ lib in almost every one of my Windows programs. It’s a complete wrapper around the full GDI+ framework and gives you much better control over graphics stuff. It’s not just about speed, but also being able to use custom paints, gradients, paths, etc…)

No, it means there’s no reason to leave it off in newer Windows versions.

Cannot find this. Any download link? :wink:

OK stupid question: why isn’t this then enabled by default in Xojo? Donth think anyone is making apps for Win3.11 anymore. :slight_smile:

This can help : http://en.wikipedia.org/wiki/Graphics_Device_Interface#GDI.2B

For all intents and purposes, switch it on and forget about it, then do what you do on Mac :wink:

@Christoph De Vocht If you download one of my projects on my blog (like http://alwaysbusycorner.com/2014/03/25/xojo-about-cables-chains-and-other-curves/), the framework is included. The original link is gone a while since Aaron left.

Because it does conflict with other technologies at times, and as I recall, GDI is a bit slower when drawing to pictures.

That and the fact that if we silently changed the default from False to True, users projects could just break when running a newer IDE.

A bit more info on what to look out for would be appreciated by everyone not well versed on the intricacies of Windows graphics programming … :wink:

I was talking about my pre-Xojo experience. I found that GDI sometimes made it tricky to deal with thermal label printers which needed funky resolutions like 302dpi. For me, turning GDI on only when I needed it was a much better solution.

I will say this, if you run into something funky with graphics or printing that you can’t otherwise figure out, try turning GDI off right before the code that is giving you trouble (before creating the picture or printer object) and you may find that it helps.

Is it enough to just add app.UseGDI=true in the apps open event?
Or do you need to enable it in every canvas?

Do you know whats good when making an Windows app? You always realise making an app for OSX is so much more fun. :slight_smile:

lol. That’s just because you’re not equally used to program for windows. I have the same annoyance when I try to make something for mac. :slight_smile: Those CG declares make no sense to me either. A framework you know is always more fun to work with.

To answer your question. app.UseGDI=true should be enough if you’re not planning to use only Xojo’s default Gdi+. If you plan to experiment with Advanced Graphics for Windows, put this in the app.Open event:

  #if TargetWin32
    if not GdiPlus.Startup then
      MsgBox "GdiPlus is not supported, quitting now."
      Quit
    end if
  #endif  

and this in the app.close event:

  #if TargetWin32
    GdiPlus.Shutdown
  #endif

and that’s it! You can now start using the advanced gdi+ functions in your app.

[quote=129274:@Alain Bailleul]@Christoph De Vocht Do you know whats good when making an Windows app? You always realise making an app for OSX is so much more fun. :slight_smile:
lol. That’s just because you’re not equally used to program for windows. I have the same annoyance when I try to make something for mac. :slight_smile: Those CG declares make no sense to me either. A framework you know is always more fun to work with.[/quote]

Yes, I never had a PC before (and I am using computers for over 30 years now) so making a Windows app is hard for me.
Well, I did found a good way to code for Windows (from my point that is):
I put the project on my local server. I code on my Mac and when I need to check how it looks on Windows, I compile it on Windows. :slight_smile:
I gave Windows a fair shot for some weeks now, but really, Xojo on Windows is so slow to use I was pulling my hair of frustration more than ones. :slight_smile:

Anyhow, Xojo is a great tool to make cross-platform apps. Most core code just works fine cross-wise but you really have to do some work to make a (modern) GUI work on other platforms.

Did you try remote debugging? I used to do stuff similar to what you are doing, but once I stumbled across Xojo’s remote debugging tool, not even close, so much easier.

I agree, this new ‘IDE’ is total crap, that’s why i stopped renewing a year ago.

Don’t forget you can override the Default projects in Xojo. I have a project in my templates directory named “Default Desktop Project” which has things like GDI+ turned on, a label subclass that has transparency turned on & a few other bits. So when I start a new project it’s already done.