Recent

Author Topic: Color Picker everywhere...  (Read 15681 times)

nitram

  • Newbie
  • Posts: 5
Re: Color Picker everywhere...
« Reply #15 on: December 08, 2014, 09:55:44 am »
Did similar with so called grapherSCOPE by means of Lazarus. On Windows it works perfect. Try to port it for Mac where I currently struggle getting screenshots and RGB readout. Only useful method I found seems to be here http://forum.lazarus.freepascal.org/index.php/topic,16980.0.html

Look grapherSCOPE demo at http://www.m2port.com/

All is based on YCbCr Color space which is useful for Video. With YCbCr you get a better feeling for preceived Color.

Don't know why people are that focused on HSB when it comes to retouching of Images. It seem to be a Photoshop phenomenon....
« Last Edit: December 08, 2014, 10:06:43 am by nitram »

CM630

  • Hero Member
  • *****
  • Posts: 1077
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Color Picker everywhere...
« Reply #16 on: September 08, 2021, 09:36:52 am »
I just came into the necessity to pick colours from the screen. I have downloaded this app.
Either I cannot understand how it works or it does not work.
There is no „Help“, just „About“.


Edit: I have watched the video, it somehow helped with some guessing.
Edit 2: The help link in the „About window does not open wheel clicking it.“

Win 10; 64 Bit.
« Last Edit: September 08, 2021, 09:46:45 am by CM630 »
Лазар 3,0 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

BobDog

  • Sr. Member
  • ****
  • Posts: 394
Re: Color Picker everywhere...
« Reply #17 on: September 08, 2021, 01:21:50 pm »

Here is a simple no frills colour picker for windows.
Code: Pascal  [Select][+][-]
  1. program finder;
  2. {$macro on}
  3.  {$define _WIN32_WINNT := $0500}
  4. uses windows,crt,sysutils;
  5.    const
  6.     DC_BRUSH=18;
  7.     const
  8.     DC_PEN=19;
  9.  
  10. type
  11. colour =packed record
  12. case integer of
  13. 0:(r,g,b:byte);
  14. 1:(c:longword);
  15. end;
  16.  
  17.  function Printf(mask : pchar):integer; cdecl; varargs; external 'msvcrt.dll' name 'printf';
  18.  function system(s:pchar):integer ; cdecl external 'msvcrt.dll' name 'system';
  19.  function SetDCBrushColor(p:hdc;colour:COLORREF): COLORREF; stdcall external 'gdi32.dll' name 'SetDCBrushColor';
  20.  function SetDCPenColor(p:hdc;colour:COLORREF): COLORREF; stdcall external 'gdi32.dll' name 'SetDCPenColor';
  21.  Function SetProcessDPIAware():boolean ;stdcall external 'User32.dll' name 'SetProcessDPIAware';
  22.  
  23.  procedure hidecursor();
  24.  var
  25.     consoleHandle:handle;
  26.      info:CONSOLE_CURSOR_INFO ;
  27.      begin
  28.      consolehandle := GetStdHandle(STD_OUTPUT_HANDLE);
  29.      info.dwSize := 100;
  30.      info.bVisible := FALSE ;
  31.      SetConsoleCursorInfo(consoleHandle, @info);
  32.      End;
  33.  
  34. Var
  35. p:hwnd;
  36. h,wh:hdc;
  37. pt:point;
  38. clr:colour;
  39. r:integer=50;
  40. s:pchar;
  41. begin
  42.     p := GetConsoleWindow();
  43.     setwindowpos(p, HWND_TOPMOST, 100, 100, 230, 280, SWP_SHOWWINDOW);
  44.     system('title [MOVE]');
  45.     SetWindowLong(p,GWL_STYLE, GetWindowLong(p, GWL_STYLE) and not(WS_MAXIMIZEBOX) and not( WS_SIZEBOX));
  46.     SetProcessDPIAware;
  47.     hidecursor();
  48.     h:=GetDC(0);
  49.     wh:=GetDC(p);
  50.     SelectObject(wh,GetStockObject(DC_BRUSH));
  51.     SelectObject(wh,GetStockObject(DC_PEN));
  52.     while p<>1 do
  53.     begin
  54.     getcursorpos(@pt);
  55.     clr.c:=getpixel(h,pt.x,pt.y);
  56.     ShowScrollBar(p, SB_BOTH, FALSE);
  57.     SetDCBrushColor(wh,clr.c);
  58.     SetDCPenColor(wh,clr.c);
  59.     ellipse(wh,trunc(105-r),trunc(70-r),trunc(105+r),trunc(70+r));
  60.  
  61.   gotoxy(3,10);
  62.   printf('Red   %s','   ');
  63.   gotoxy(3,10);
  64.   printf('Red   %d',clr.r);
  65.  
  66.   gotoxy(3,11);
  67.   printf('Green %s','   ');
  68.   gotoxy(3,11);
  69.   printf('Green %d',clr.g);
  70.  
  71.   gotoxy(3,12);
  72.   printf('Blue  %s','   ');
  73.   gotoxy(3,12);
  74.   printf('Blue  %d',clr.b);
  75.  
  76.   gotoxy(3,13);
  77.   printf('HEX   %s','          ');
  78.   gotoxy(3,13);
  79.   s:=pchar(IntToHex(clr.c,8));
  80.   printf('HEX  %s',' $');
  81.   printf('%s',s);
  82.  
  83.   gotoxy(3,14);
  84.   printf('RAW   %s','          ');
  85.   gotoxy(3,14);
  86.   printf('RAW   %d',clr.c);
  87.  
  88.   gotoxy(3,15);
  89.   printf('X,Y   %s','             ');
  90.   gotoxy(3,15);
  91.   printf('X,Y   %d ,%s %d',pt.x,'',pt.y);
  92.     sleep(20);
  93.     end;
  94.  
  95.   readln;
  96. end.
  97.  

 

TinyPortal © 2005-2018