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
 ImageEnVect ObjWidth
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jccruz

Brazil
30 Posts

Posted - May 28 2015 :  15:51:47  Show Profile  Reply
Hello! I have upgraded from ImageEn version 2.2.3 to 5.2.0.

In the version 2.2.3 to get the coordinates from a line like this bar "/" draw from up to down, I used:

x1 := ImageEnVect1.ObjLeft[hobj];
y1 := ImageEnVect1.ObjTop[hobj];
x2 := ImageEnVect1.ObjWidth[hobj] + ImageEnVect1.ObjLeft[hobj];
y2 := ImageEnVect1.ObjHeight[hobj] + ImageEnVect1.ObjTop[hobj];

as an example:
ImageEnVect1.ObjWidth[hobj] = -23
ImageEnVect1.ObjLeft[hobj] = 77
ImageEnVect1.ObjTop[hobj] = 58
ImageEnVect1.ObjHeight[hobj] = 131

Note that ObjWidth is negative and it is right, but when I run the same code using version 5.2.0 the ObjWidth is positive.

Thats wrong?

Thanks
Jose Carlos





JCC

xequte

38510 Posts

Posted - Jun 21 2015 :  19:30:03  Show Profile  Reply
Hi Jose

You can use ImageEnVect.GetObjRect. For objects such as lines, the Rect.Top/Left may exceed Rect.Bottom/Right to indicate the direction of line drawing.

Example
var
  r: TRect;
  hobj: Integer;
  sXDir, sYDir: string;
begin
  if ImageEnVect1.SelObjectsCount > 0 then
  begin
    hobj := ImageEnVect1.SelObjects[ 0 ];
    if ImageEnVect1.ObjKind[ hObj ] <> iekLINE then
      Caption := 'Not a line'
    else
    begin        
      ImageEnVect1.GetObjRect( hobj, r );
      if  r.Top > r.Bottom then
        sYDir := 'Bottom-'
      else
        sYDir := 'Top-';
      if  r.Left > r.Right then
        sXDir := 'Right'
      else
        sXDir := 'Left';
      Caption := 'Line starts at ' + sYDir + sXDir;
    end;
  end;
end;


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: