T O P I C R E V I E W |
PeterPanino |
Posted - Mar 30 2021 : 18:17:07 Does IE have an EYEDROPPER (PIPETTE) component which can pick up a color from any clicked pixel on the whole screen, on any monitor, with the additional feature of showing a zoomed preview of the region around the mouse pointer, with the additional feature of not only picking up the single color from a single-pixel but also the average color from the region around the mouse pointer? |
11 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Apr 03 2021 : 18:31:51 Hi Peter
> So how can I GET the multiple colors that have been set to transparent > by ImageEnView1.Proc.SetTransparentColors?
SetTransparentColors just changes the alpha channel of an image TIEBitmap.AlphaChannel, it does not change the image colors (the TIEBitmap).
The AlphaChannel is itself just a TIEBitmap of ieg8 format (i.e. grayscale with pixel values from 0 to 255):
https://www.imageen.com/help/TIEBitmap.AlphaChannel.html
So you can just iterate through the scanlines of the AlphaChannel and where the pixel value is <255 (i.e. partially to fully transparent) look up the matching pixel in the TIEBitmap.Scanline to get the color.
https://www.imageen.com/help/TIEBitmap.ScanLine.html
Note: A simpler way, e.g. to test the concept, is to use Pixels instead of Scanlines, i.e.
Alpha: ImageEnView1.IEBitmap.AlphaChannel.Pixels_ie8[x, y]; Color: ImageEnView1.IEBitmap.Pixels[x, y];
But that will much slower than scanlines, so you are better to look at the Scanline examples.
Nigel Xequte Software www.imageen.com
|
PeterPanino |
Posted - Apr 03 2021 : 18:19:14 So, is there a method to GET the transparent colors from the image? (Proc.GetTransparentColors) |
PeterPanino |
Posted - Apr 03 2021 : 10:06:59 Hi Nigel,
I have tested it: The CPU activity is NOT being increased in the loop.
However, I have now implemented another solution that works very fine. |
xequte |
Posted - Apr 02 2021 : 14:44:32 Hi
That looks like it would use a lot of CPU. Can you not put the check into a timer (e.g. every 1/4 second) or implement a delay?
Nigel Xequte Software www.imageen.com
|
PeterPanino |
Posted - Apr 02 2021 : 14:13:43 Hi Nigel,
I wrote this code to get the color from the pixel at screen-mouseposition:
function GetPixelColourFromScreenAsColor(const PixelCoords: TPoint): TColor;
var
dc: HDC;
begin
dc := GetDC(0);
Result := GetPixel(dc, PixelCoords.X, PixelCoords.Y);
end;
FStopGettingPixelColorFromScreen := False;
repeat
GetCursorPos(P);
lblHoverColorProps.Color := GetPixelColourFromScreenAsColor(P);
Application.ProcessMessages;
until FStopGettingPixelColorFromScreen;
CodeSite.Send('TformMain.btnColorDialogClick: FINISHED');
The repeat-loop exits when I press the ESC key in the OnKeyDown event-handler. But for that, my application must have the focus.
What do you say about this code? Is it "evil" using Application.ProcessMessages inside the repeat-loop? |
PeterPanino |
Posted - Apr 02 2021 : 03:49:53 As the Make Transparent Demo shows, loading the same image from file again, cancels the transparency in the previous image. So, the color transparency is an inherent property of the image, not of the ImageEnView control.
So, is there a method to GET the transparent colors from the image? (Proc.GetTransparentColors) |
xequte |
Posted - Mar 31 2021 : 16:56:34 Hi
You should be able to reset it as follows:
ImageEnView1.Proc.SetTransparentColors(TColor2TRGB(clBlue), 0, 255);
Nigel Xequte Software www.imageen.com
|
PeterPanino |
Posted - Mar 31 2021 : 11:23:47 Can I reset a specific color from transparent to opaque with this code?
ImageEnView1.Proc.SetTransparentColors(TColor2TRGB(clBlue), 0, -255); |
PeterPanino |
Posted - Mar 31 2021 : 10:45:31 Thanks, Nigel.
I have tried ImageEnView1.Proc.GetTransparentColors, but that method does not exist.
So how can I GET the multiple colors that have been set to transparent by ImageEnView1.Proc.SetTransparentColors?
And for example: I have set the colors clGreen, clBlue, and clYellow to transparent by using Proc.SetTransparentColors. How can I set clBlue to be no more transparent afterward? |
xequte |
Posted - Mar 30 2021 : 23:25:20 Sorry, I just realized you said the whole screen. That is much harder to do and outside of the functionality of ImageEn.
Nigel Xequte Software www.imageen.com
|
xequte |
Posted - Mar 30 2021 : 23:23:34 Hi Peter
For a Eye dropper use the miColorPicker interaction:
https://www.imageen.com/help/TImageEnView.MouseInteractGeneral.html
And monitor the ieiColorPickerClick events of OnUserInteraction to handle the clicking (and optionally the hovering):
https://www.imageen.com/help/TImageEnView.OnUserInteraction.html
Regarding the zoomed view, see the Magnify2 demo:
\Demos\Display\Magnify2\Magnify2.dpr
http://www.imageen.com/files/demos/run/Display/Magnify2/Magnify2.exe
Which you would position and size using the ieiColorPickerHover event.
Nigel Xequte Software www.imageen.com
|