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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to avoid AV in Palette Demo?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

860 Posts

Posted - Sep 15 2017 :  18:42:03  Show Profile  Reply
Hello,

in the demo \ImageEn\Demos\ImageAnalysis\Palette an AV is triggered when clicking on an empty space on the TImageEnView (but still on the TImageEnView):



Since the X and Y values are still positive, how can this error be avoided?

PeterPanino

860 Posts

Posted - Sep 15 2017 :  19:45:34  Show Profile  Reply
Could this be the solution?

if not ImageEnView1.VisibleBitmapRect.Contains(Point(ImageEnView1.XScr2Bmp(X), ImageEnView1.YScr2Bmp(Y))) then EXIT;
Go to Top of Page

xequte

38179 Posts

Posted - Sep 17 2017 :  20:32:02  Show Profile  Reply
Hi Peter

Sorry, we don't do any sanity checking there to ensure you are over the image. You just need to compare the result from XScr2Bmp/YScr2Bmp to the bitmap size.

I've attached an updated demo...

attach/xequte/2017917203158_Palette.zip
13.17 KB

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: