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
 Built-in MouseIsOutsideImage function?

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
PeterPanino Posted - Dec 04 2021 : 04:35:10
I wrote this function to detect whether the mouse pointer is outside of the image:

function TForm1.MouseIsOutsideImage(const X, Y: Integer): Boolean;
begin
  Result := (X < 0) or (Y < 0) or (X > ImageEnView1.IEBitmap.Width) or (Y > ImageEnView1.IEBitmap.Height);
end;


I use it in this way:

procedure TForm1.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  var bx := ImageEnView1.XScr2Bmp(X, False);
  var by := ImageEnView1.YScr2Bmp(Y, False);
  if MouseIsOutsideImage(bx, by) then
  begin
    DoSomething;
    EXIT; 
  end;
  var ThisColor: TColor;
  try
    ThisColor := TRGB2TColor(ImageEnView1.IEBitmap.Pixels[bx, by]);
  except
    CodeSite.Send('TForm1.ImageEnView1MouseMove except: bx', bx);
    CodeSite.Send('TForm1.ImageEnView1MouseMove except: by', by);
  end;

  DoSomething(ThisColor);
end;


Is there already a built-in MouseIsOutsideImage (or similar) function in TImageEnView? I didn't find anything in the documentation.
2   L A T E S T    R E P L I E S    (Newest First)
PeterPanino Posted - Dec 04 2021 : 17:39:30
Hi Nigel,

Thanks!
xequte Posted - Dec 04 2021 : 15:00:22
There isn't a built in function for that.

Please use:

Result := (X < 0) or (Y < 0) or (X >= ImageEnView1.IEBitmap.Width) or (Y >= ImageEnView1.IEBitmap.Height);

Nigel
Xequte Software
www.imageen.com