IEVisionRectToTRect
Declaration
function IEVisionRectToTRect(Rect: TIEVisionRect): TRect;
Description
Convert a
TIEVisionRect to a VCL
TRect record.
TIEVisionRect stores position and size as
x, y, width, height. The result uses Delphi’s usual half-open (exclusive) rectangle:
Right = x + width and
Bottom = y + height, so
TRect.Width/Height match the vision size and drawing APIs such as
TCanvas.Rectangle cover the same pixels without an extra +1 on Right/Bottom.
Note: This matches
IERectangleToRect. Before v15.2.0, inclusive corners were used (
x+width-1 /
y+height-1); callers that compensated with
Right+1/
Bottom+1 when drawing should drop that adjustment.
Example
// Draw a red box onto bitmap around an IEVision rectangle
with ImageEnView1.IEBitmap.Canvas do
begin
Pen.Color := clRed;
Pen.Width := 8;
Brush.Style := bsClear;
Rectangle(IEVisionRectToTRect(ievrect));
Font.Height := 36;
Font.Color := clRed;
Brush.Style := bsSolid;
Brush.Color := clWhite;
TextOut(rect.x + 4, rect.y + 4, 'Result');
end;
// Add a layer at the position of an IEVision rectangle
ImageEnView1.LayersAdd( ielkText, IEVisionRectToTRect( ievrect ));
with TIETextLayer( ImageEnView1.CurrentLayer ) do
begin
BorderColor := clRed;
BorderWidth := 5;
FillColor := clWhite;
Opacity := 0.66;
Font.Height := 24;
Font.Color := clRed;
WordWrap := False;
Alignment := iejCenter;
Text := 'Result';
TextOverflow := ieoShrink;
end;
See Also
◼IEVisionRect
◼IERectangleToRect