Class TCastleShape

Unit

Declaration

type TCastleShape = class(TUIControlSizeable)

Description

Draw a simple shape (rectangle, circle) with given color and optional outline.

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public procedure Render; override;

Properties

Public property ShapeType: TShapeType read FShapeType write SetShapeType default stRectangle;
Public property Filled: boolean read FFilled write SetFilled default true;
Public property Color: TCastleColor read FColor write SetColor;
Public property Outline: boolean read FOutline write SetOutline default false;
Public property OutlineColor: TCastleColor read FOutlineColor write SetOutlineColor;
Public property OutlineThick: boolean read FOutlineThick write SetOutlineThick;
Public property OutlineWidth: Single read FOutlineWidth write SetOutlineWidth default 1.0;

Description

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public procedure Render; override;
 

Properties

Public property ShapeType: TShapeType read FShapeType write SetShapeType default stRectangle;
 
Public property Filled: boolean read FFilled write SetFilled default true;
 
Public property Color: TCastleColor read FColor write SetColor;

The fill color, used if Filled. By default, opaque white.

Public property Outline: boolean read FOutline write SetOutline default false;
 
Public property OutlineColor: TCastleColor read FOutlineColor write SetOutlineColor;

The outline color, used if Outline. By default, opaque black.

Public property OutlineThick: boolean read FOutlineThick write SetOutlineThick;

Determines the drawing method of the outline, used if Outline.

False (default)

Draw the outline using lines, and apply OutlineWidth by changing line width.

Disadvantage: outline widths thicker than 1 pixel are not guaranteed to be supported. In particular they will almost never work on mobile (OpenGLES). See the LineWidth comments at DrawPrimitive2D procedure.

Consider using other methods if you need to draw a thick shape outline in a reliable manner. To draw a rectangle with frame, it's usually better to use Draw3x3 call, with a special texture with a frame and insides.

True

Draw the outline by first drawing a larger shape with OutlineColor underneath the smaller shape with Color.

Disadvantages:

  • Cannot work sensibly if Filled is False, so it's disabled then. When Filled is False, it's like OutlineThick was always also False.

  • The alpha blending may not be exactly what you want, since the pixels inside are overdrawn with both OutlineColor and then with Color.

  • May look a little worse in case of small OutlineWidth and non-rectangular shapes.

Advantage: thick OutlineWidth works reliably.

Public property OutlineWidth: Single read FOutlineWidth write SetOutlineWidth default 1.0;

The outline width, used if Outline. It is affected by UI scaling.

If OutlineThick is False, then outline widths thicker than 1 pixel are not guaranteed to be supported. In particular they will almost never work on mobile (OpenGLES). Change OutlineThick to True to have reliable thick outlines.


Generated by PasDoc 0.15.0.