Returns the minimum value from the array of TCanvasPixel.
Note
|
This function eases cross-library graphics code by using TCanvasXXX types and CanvasXXX functions. With these functions, types, and constants, you can write code that can be used in either a VCL or FMX application. It is recommended that you write the VCL code first as it is more limited that the FMX library.
|
Namespace: RSGraphics
Parameters
Data
Type: array of TCanvasPixel
Return Value
Type: TCanvasPixel
The following is a example of using the CanvasXXX types, constants, and functions to write cross-library graphics code:
Delphi
|
{$DEFINE FMX} // should only define in FMX applications only
var
CenterPt: TCanvasPoint;
LowerRightQuadrant: TCanvasRect;
begin
// get center point using cross-library CenterPoint
CenterPt := CanvasCenterPoint(ARect);
// create a rectangle using cross-library Rect
LowerRightQuadrant := CanvasRect(CenterPt.X, CenterPt.Y, ARect.Right, ARect.Bottom);
// FMX does not have Canvas.Pen property, it is exposed by FMX.RS.CanvasHelper
// as equivalent to Canvas.Stroke
// clxCOLORS are from RSGraphics
Canvas.Pen.Color := clxBlue;
// FMX does not have Canvas.Brush property, it is exposed in FMX.RS.CanvasHelper
// as equivalent to Canvas.Fill
Canvas.Brush.Color := clxRed;
{$IFDEF FMX}
Canvas.StrokeDash := TStrokeDash.sdDash; // <--- not cross-library compatible
{$ELSE}
Canvas.Pen.Style := psDash; // <--- not cross-library compatible
{$ENDIF}
// FMX does not have Canvas.Rectangle method, added in FMX.RS.CanvasHelper
Canvas.Rectangle(LowerRightQuadrant);
// Move text down by around a third of width/height of LowerRightQuadrant, use
// CanvasDiv function from RSGraphics to make the code cross-library
Canvas.TextOut( CenterPt.X + CanvasDiv(LowerRightQuadrant.Width,3.3),
CenterPt.Y + CanvasDiv(LowerRightQuadrant.Height,3.3),
'Hello World' );
end;
|
|