Recent

Author Topic: TColorDialog  (Read 1539 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
TColorDialog
« on: December 22, 2020, 08:09:55 pm »
Is it possible to modify TColorDialog so it returns a color with an alpha value, RGBA or BGRA?

On a Mac the TColorDialog has a slider for opacity. It does not have an opacity slider under Windows or Linux, but perhaps that will change in the future.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: TColorDialog
« Reply #1 on: December 22, 2020, 08:20:06 pm »
Hi VTwin

The ColorDialogs in Lin & Win are part oft the widget set and both did not detect the Alpha Channel until now.

This should be a job for the BGRAcontrols crew.
Perhaps you should ask them.

Winni

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TColorDialog
« Reply #2 on: December 28, 2020, 07:01:00 am »
Is it possible to modify TColorDialog so it returns a color with an alpha value, RGBA or BGRA?
It should be possible, but it requires LCL changes as well.

macOS does has the Opacity selection, so it's a native feature.

But it should be added as a LCL feature as well. TColor type is not really designed for "alpha" channel (the higher byte $FF000000 is used to specify system colors).

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: TColorDialog
« Reply #3 on: December 29, 2020, 11:38:48 pm »
Thanks. I realize it would require an LCL widget tweak. I did not realize that TColor used the high byte for system colors, making it a bit more complicated.

It is a wish list item, and not critical. My applications allows selection of:

fill color
fill opacity
stroke color
stroke opacity
stroke width

Since macOS includes opacity in the color dialog, it would cut down on the required selections. I was not aware that Windows and Linux recently began supporting opacity, I do not see it in the versions I am using. If that is the case, it is a good argument for supporting opacity in TColorDialog.

I mainly use BGRABitmap display/output and SVG output. I appreciate the BGRAControls project, but am likely to stick with native controls.

Cheers
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

 

TinyPortal © 2005-2018