Recent

Author Topic: LAMW How convert colors to TARGBColorBridge  (Read 2685 times)

maxx

  • New Member
  • *
  • Posts: 12
LAMW How convert colors to TARGBColorBridge
« on: October 03, 2017, 06:56:52 am »
Hello!
Is it possible convert colors from TColorRGB to TARGBColorBridge,
or choose a similar color from TARGBColorBridge in run-time?

maxx

  • New Member
  • *
  • Posts: 12
Re: LAMW How convert colors to TARGBColorBridge
« Reply #1 on: October 03, 2017, 10:29:50 am »
Done.
Code: Pascal  [Select][+][-]
  1. function TAndroidModule1.ARGBtoCustomColor(conv_clr: TColorRGBA): DWORD;
  2. begin
  3.   Result := (conv_clr.A shl 24) + (conv_clr.R shl 16) + (conv_clr.G shl 8) + conv_clr.B;
  4. end;
  5.  
  6. procedure TAndroidModule1.AndroidModule_ColorPickJNIPrompt(Sender: TObject);
  7. var
  8.   my_color: TColorRGBA;
  9. begin
  10.  
  11.   //My Custom color Yellow (as example)
  12.   my_color.A := $FF; //Not transparent
  13.   my_color.R := $FF;
  14.   my_color.G := $FF;
  15.   my_color.B := $00;
  16.  
  17.   jPanel_Current_ColorPick.CustomColor := ARGBtoCustomColor(my_color);
  18.  
  19.   jPanel_Current_ColorPick.BackgroundColor := colbrCustom;
  20. end;
  21.  
  22.  

maxx

  • New Member
  • *
  • Posts: 12
Re: LAMW How convert colors to TARGBColorBridge
« Reply #2 on: October 03, 2017, 02:00:58 pm »
I did it for this little prog.

ColorPicker example for LAMW:Android

Enjoy friends!  8-)




jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW How convert colors to TARGBColorBridge
« Reply #3 on: October 03, 2017, 10:13:47 pm »

Added to LAMW repo  as GUI demo "ColorPicker"!

ref. https://github.com/jmpessoa/lazandroidmodulewizard

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

neuro

  • Jr. Member
  • **
  • Posts: 62
Re: LAMW How convert colors to TARGBColorBridge
« Reply #4 on: July 16, 2022, 12:44:44 am »
In year 2017 maxx made Color Picker demo, which had a serious defect – it was constantly writing color picker image to file.
I completely rewrote it – I eliminated writing of color picker image to file, so now Color Picker works faster and all calculations are done in memory.
Attachment is available in page:
https://forum.lazarus.freepascal.org/index.php/topic,52567.0.html

 

TinyPortal © 2005-2018