ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Proc functions do not work after SelectCustom

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Jan 23 2019 : 07:44:42
Hello,

This is odd.

After performing custom selection using following code:
procedure TfrmMainForm.scBtnSelSkinColorClick(Sender: TObject);
var
  X, Y: Integer;
  Clr: TRGB;
  R,G,B: Integer;
  arrClrVal: array[0..2] of Integer;
begin
  ImageEnViewMain.Deselect;
  ImageEnViewMain.SelectionMaskDepth := 8;
  if (ImageEnViewMain.IEBitmap.Width > 100) and (ImageEnViewMain.IEBitmap.Height > 0) then
  begin
    for Y := 0 to ImageEnViewMain.IEBitmap.Height - 1 do
    begin
      for X := 0 to ImageEnViewMain.IEBitmap.Width - 1 do
      begin
        Clr := ImageEnViewMain.IEBitmap.Pixels[X,Y];
        R := Clr.r;
        G := Clr.g;
        B := Clr.b;

        arrClrVal[0] := R;
        arrClrVal[1] := G;
        arrClrVal[2] := B;        

        if ((R > 95) and (G > 40) and (B > 20) and ((MaxIntValue(arrClrVal) - MinIntValue(arrClrVal)) > 15) and ((r - g) > 15) and (R > G) and (R > B)) then
        begin
          ImageEnViewMain.SelectionMask.SetPixel(X,Y,1);
        end;
      end;
    end;
    ImageEnViewMain.SelectCustom;
    ImageEnViewMain.Proc.DoPreviews(ppeColorAdjust);
  end;
end;


But none of the Proc functions work like for example Proc.DoPreviews(ppeColorAdjust).

Is something wrong with my code or is it a problem in ImageEn?

TIA


Yogi Yang
3   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Jan 24 2019 : 01:16:41
Hello Nigel,

Thanks for the tip and clarifications.

Now it is working!

Also thanks for the code sample.

The effect generated is interesting and can be used in may different ways.

Regards,


Yogi Yang
xequte Posted - Jan 23 2019 : 18:03:59
// Make a gradient selection (increasing from unselected to fully selected along height of image)
// Then convert selection to gray scale
ImageEnView1.Deselect();
ImageEnView1.SelectionMaskDepth := 8;
for Y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  for X := 0 to ImageEnView1.IEBitmap.Width - 1 do
  begin
    selIntensity := Round( Y / ImageEnView1.IEBitmap.Height * 255 );
    ImageEnView1.SelectionMask.SetPixel( X, Y, selIntensity );
  end;
ImageEnView1.SelectCustom;
ImageEnView1.Proc.ConvertToGray();
ImageEnView1.Deselect();




Nigel
Xequte Software
www.imageen.com
xequte Posted - Jan 23 2019 : 17:33:39
Hi Yogi

With regard to TIEMask.SetPixel:

If the selection depth is 1 bit, then 0 is unselected and 1 is selected.
If the selection depth is 8 bit, then 0 is unselected, 1 - 254 is partially selected and 255 is fully selected.

You are calling:

ImageEnViewMain.SelectionMask.SetPixel(X,Y,1);

So it "barely" selected. Please try:

ImageEnViewMain.SelectionMask.SetPixel(X,Y,255);


Nigel
Xequte Software
www.imageen.com