Recent

Author Topic: Aliased edges  (Read 5777 times)

caleb9

  • Jr. Member
  • **
  • Posts: 51
Aliased edges
« on: April 11, 2011, 01:27:25 pm »
Hello. I am currently porting a Delphi project, involving a lot of 2d drawing to Lazarus, so it can run on Mac. I have a problem with drawing bmp/png pictures to a canvas - there's an ugly aliasing around the edges. I've attached two screenshots: first one shows part of the picture drawn correctly, using high level TCanvas.Draw method. Unfortunately the complication of the rest of the project makes it impossible for me to use this method and I have to draw using StretchMaskBlt or Carbon's (Mac OS widgetset) CGContext- low level functions (or something else if you have any suggestions? - in Delphi there's the AlphaBlend function used, but since it doesn't exist on Mac I had to find an "equivalent" for it...) The result is presented on the second screenshot - seems to me that this is related to alpha channel or something like that, but my lack of experience with low level drawing makes it hard to even find the right search keywords. Maybe some of you guys had a similar problem and can recognize possible cause of this? - I would appreciate even just some directions on where I should start investigating... Thanks in advance.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: Aliased edges
« Reply #1 on: April 11, 2011, 02:01:42 pm »
Conscience is the debugger of the mind

caleb9

  • Jr. Member
  • **
  • Posts: 51
Re: Aliased edges
« Reply #2 on: April 11, 2011, 02:20:39 pm »
Thanks, if that's the only way I'll give it a try although I hoped it can be done without an external library since I am able to draw it correctly using StretchBlt with TCanvas.Handle arguments - it must be something in the rest of the project that sets something wrongly and I need hints on what to look at, but I'll take a look to your links as well.

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: Aliased edges
« Reply #3 on: April 11, 2011, 03:06:15 pm »
I do not know, maybe you could post some of your code, and see if it can be changed to keep transparency information.

But anyway, on Gtk alpha channel is not supported so your application may not look the same on Linux.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018