Recent

Author Topic: Drawing into a canvas with alpha channel (RGBA)  (Read 13120 times)

Bernd82

  • New Member
  • *
  • Posts: 30
Drawing into a canvas with alpha channel (RGBA)
« on: September 22, 2009, 02:52:57 pm »
Hello all,

I try to draw into a normal TCanvas and want to use a color with an alpha channel. So I want the new graphic element to be partial transparent. The result should work under Windows and Linux. I heard about AggPas, but it seems to be very mighty.

Thanks for any help and

best regards Bernd82

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Drawing into a canvas with alpha channel (RGBA)
« Reply #1 on: September 22, 2009, 03:50:05 pm »
It has been many years since I used TCanvas for the last time in Delphi or Lazarus, but I know it has serious limitations.

In Windows, TCanvas calls the native drawing dll, called "GDI", "GDI32" or so by Microsoft. I can't tell about Vista, but, for any other Microsoft OS, it offers no blending or antialiasing natively.

You can just choose the pen/brush color and style. The brush style gives you some control about the background drawing and area filling, but it's not the kind of alpha you want.

If your software have to work in Windows, probably you need to use a library or draw by yourself.

Bernd82

  • New Member
  • *
  • Posts: 30
Re: Drawing into a canvas with alpha channel (RGBA)
« Reply #2 on: September 22, 2009, 04:00:08 pm »
The objects TFPCanvas and TFPColor seem to be available having R+G+B+A as fields. But I did not manage to get them into action yet. I did not find any description or example  :(

The Windows GDI+ API has alpha blending, but unfortunately it may not work under Linux :-\

leocda

  • Jr. Member
  • **
  • Posts: 60
  • Computer Graphics researcher
    • Picture to People
Re: Drawing into a canvas with alpha channel (RGBA)
« Reply #3 on: September 22, 2009, 04:08:02 pm »
The objects TFPCanvas and TFPColor seem to be available having R+G+B+A as fields. But I did not manage to get them into action yet. I did not find any description or example  :(

The Windows GDI+ API has alpha blending, but unfortunately it may not work under Linux :-\

GDI+ has a poor antialiasing, but the real problem is GDI+ is not native part of several Windows flavors (this kind of dll doesn't work in Linux). Even just for Windows, it's a solution just if you can control what goes installed in your client computers aside of your own program.

Bernd82

  • New Member
  • *
  • Posts: 30
Re: Drawing into a canvas with alpha channel (RGBA)
« Reply #4 on: September 22, 2009, 09:58:24 pm »
Is there no graphics library available, that works under Windows and Linux and uses RGBA (alpha blending)  :(

Bernd82

  • New Member
  • *
  • Posts: 30
Re: Drawing into a canvas with alpha channel (RGBA)
« Reply #5 on: September 23, 2009, 02:31:06 am »
So all I want is to e.g. draw a thick line into a normal window and the line doesn't cover the existing window content but transparently lays over it. The degree of transparency can be variable.

I append an example image, where three circles are drawn. First the red one then the green one and last the blue one. The degree of opacity can vary from 0 to 255 within the range of one byte.

Regards, Bernd82  ::)


 

TinyPortal © 2005-2018