⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tecanvas.pas

📁 BCB第三方组件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    property Height:Integer read FHeight write FHeight default 0;
    property Left:Integer read FLeft write FLeft default 0;
    property Top:Integer read FTop write FTop default 0;
    property Width:Integer read FWidth write FWidth default 0;
  end;

  TRGB=packed record
    Blue  : Byte;
    Green : Byte;
    Red   : Byte;

    {$IFDEF CLX}
    Alpha : Byte; // Linux
    {$ENDIF}
  end;

  TRGBs=packed Array[0..0] of TRGB;
  PRGBs=^TRGBs;

  IFormCreator=interface
    function AddCheckBox(const PropName,ACaption:String; OnChange:TNotifyEvent=nil):TCheckBox;
    function AddColor(const PropName,ACaption:String):TButton;
    function AddCombo(const PropName:String):TComboBox;
    function AddInteger(const PropName,ACaption:String; AMin,AMax:Integer):TEdit;
    function AddScroll(const PropName:String; AMin,AMax:Integer):TScrollBar;
  end;

  {$IFDEF CLR}
  {$UNSAFECODE ON}
  {$ENDIF}

  TRGBArray=Array of PRGBs;

  {$IFDEF CLR}
  {$UNSAFECODE OFF}
  {$ENDIF}

  TTeeFilter=class(TCollectionItem)
  private
    FEnabled : Boolean;
    FRegion  : TFilterRegion;

    function GetRegion:TFilterRegion;
  protected
    AllowRegion : Boolean;
    FChanged    : TNotifyEvent;
    ReuseLines  : Boolean;

    procedure CalcLines(Bitmap:TBitmap);
  public
    {$IFDEF CLR}
    {$UNSAFECODE ON}
    {$ENDIF}

    Lines       : TRGBArray;

    {$IFDEF CLR}
    {$UNSAFECODE OFF}
    {$ENDIF}

    Constructor Create(Collection:TCollection); override;
    Destructor Destroy; override;

    class procedure ApplyTo(Bitmap:TBitmap); overload;
    procedure Apply(Bitmap: TBitmap); overload;
    procedure Apply(Bitmap: TBitmap; const R:TRect); overload; virtual;

    procedure Assign(Source:TPersistent); override;

    procedure CreateEditor(Creator:IFormCreator; AChanged:TNotifyEvent); virtual;
    class function Description:String; virtual;
  published
    property Enabled:Boolean read FEnabled write FEnabled default True;
    property Region:TFilterRegion read GetRegion write FRegion;
  end;

  TFilterClass=class of TTeeFilter;

  TFilterItems=class(TOwnedCollection)
  private
    Function Get(Index:Integer):TTeeFilter;
    Procedure Put(Index:Integer; Const Value:TTeeFilter);
  public
    function Add(Filter:TFilterClass):TTeeFilter;
    procedure ApplyTo(ABitmap:TBitmap);

    procedure Assign(Source:TPersistent); override;

    property Item[Index:Integer]:TTeeFilter read Get write Put; default;
  end;

  TConvolveFilter=class(TTeeFilter)  // abstract class
  protected
    {$IFDEF CLR}
    {$UNSAFECODE ON}
    {$ENDIF}

    Prev,
    This,
    Next : PRGBs;

    {$IFDEF CLR}
    {$UNSAFECODE OFF}
    {$ENDIF}

    InvTotalWeight : Single;
  public
    Weights : packed Array[-1..1,-1..1] of Single;

    Constructor Create(Collection:TCollection); override;
    procedure Apply(Bitmap:TBitmap; const R:TRect); override;
  end;

  TBlurFilter=class(TConvolveFilter)
  private
    FAmount : Integer;
    FSteps  : Integer;
  public
    Constructor Create(Collection:TCollection); override;

    procedure Apply(Bitmap:TBitmap; const R:TRect); override;
    class function Description: String; override;

    procedure CreateEditor(Creator:IFormCreator; AChanged:TNotifyEvent); override;
  published
    property Amount:Integer read FAmount write FAmount default 1;
    property Steps:Integer read FSteps write FSteps default 1;
  end;

  TTeePicture=class(TPicture)
  private
    FFilters : TFilterItems;
    IBitmap  : TBitmap;

    procedure DoReadFilters(Reader: TReader);
    procedure DoWriteFilters(Writer: TWriter);
    function FiltersStored:Boolean;
    function GetFilters:TFilterItems;
    procedure SetFilters(Const Value:TFilterItems);
  protected
    procedure DefineProperties(Filer:TFiler); override;
  public
    Destructor Destroy; override;

    procedure Assign(Source:TPersistent); override;
    function Filtered:TGraphic;
    procedure Repaint;
    class procedure ReadFilters(Reader:TReader; Filters:TFilterItems);
    class procedure WriteFilters(Writer: TWriter; Filters:TFilterItems);
  published
    property Filters:TFilterItems read GetFilters write SetFilters
                                  stored False;
  end;

     TPenEndStyle=(esRound,esSquare,esFlat);

     TChartPen=class(TPen)
     private
       FEndStyle   : TPenEndStyle;
       FSmallDots  : Boolean;
       FSmallSpace : Integer;
       FVisible    : Boolean;

       {$IFDEF CLR}
       [EditorBrowsable(EditorBrowsableState.Never)]
       {$ENDIF}
       Function IsEndStored:Boolean;

       {$IFDEF CLR}
       [EditorBrowsable(EditorBrowsableState.Never)]
       {$ENDIF}
       Function IsVisibleStored:Boolean;

       procedure SetEndStyle(const Value: TPenEndStyle);
       Procedure SetSmallDots(const Value:Boolean);
       Procedure SetSmallSpace(const Value:Integer);
       Procedure SetVisible(const Value:Boolean);

     {$IFDEF CLR}
     public
     {$ELSE}
     protected
     {$ENDIF}

       DefaultEnd : TPenEndStyle;
       DefaultVisible : Boolean;

     public
       Constructor Create(OnChangeEvent:TNotifyEvent);

       Procedure Assign(Source:TPersistent); override;
       procedure Hide;
       procedure Show;
     published
       property EndStyle:TPenEndStyle read FEndStyle write SetEndStyle stored IsEndStored;
       property SmallDots:Boolean read FSmallDots write SetSmallDots default False;
       property SmallSpace:Integer read FSmallSpace write SetSmallSpace default 0;
       property Visible:Boolean read FVisible write SetVisible stored IsVisibleStored;
     end;

     TChartHiddenPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Visible default False;
     end;

     TDottedGrayPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clGray;
       property Style default psDot;
     end;

     TDarkGrayPen=class(TChartPen)
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clDkGray;
     end;

     TWhitePen=class(TChartPen)
     private
      Function IsVisibleStored:Boolean;
     public
       Constructor Create(OnChangeEvent:TNotifyEvent);
     published
       property Color default clWhite;
       property Visible stored IsVisibleStored;  // 8.0 TV52010620
     end;

     TChartBrush=class(TBrush)
     private
       FBackColor : TColor;
       FImage     : TPicture;  // @TODO: change to TTeePicture

       Function GetImage:TPicture;
       procedure SetBackColor(const Value:TColor);
       procedure SetImage(const Value:TPicture);
     public
       Constructor Create(OnChangeEvent:TNotifyEvent); virtual;
       Destructor Destroy; override;

       Procedure Assign(Source:TPersistent); override;
       Procedure Clear;
     published
       property BackColor:TColor read FBackColor write SetBackColor default clNone;
       property Color default clDefault;
       property Image:TPicture read GetImage write SetImage;
     end;

     TTeeView3DScrolled=procedure(IsHoriz:Boolean) of object;
     TTeeView3DChangedZoom=procedure(NewZoom:Integer) of object;

     TView3DOptions = class(TPersistent)
     private
       FElevation   : Double;
       FFontZoom    : Integer;
       FHorizOffset : Integer;
       FOrthogonal  : Boolean;
       FOrthoAngle  : Integer;
       FPerspective : Integer;
       FRotation    : Double;
       FTilt        : Integer;
       FVertOffset  : Integer;
       FZoom        : Double;
       FZoomText    : Boolean;
       FOnScrolled  : TTeeView3DScrolled;
       FOnChangedZoom:TTeeView3DChangedZoom;

       {$IFDEF TEEVCL}
       FParent      : TWinControl;
       {$ENDIF}

       function GetElevation:Integer;
       function GetRotation:Integer;
       function GetZoom:Integer;
       Procedure SetElevationInteger(const Value:Integer);
       Procedure SetElevation(const Value:Double);
       Procedure SetFontZoom(Value:Integer);
       Procedure SetPerspective(Value:Integer);
       Procedure SetRotationInteger(const Value:Integer);
       procedure SetRotation(const Value:Double); overload;
       Procedure SetTilt(Value:Integer);
       Procedure SetHorizOffset(Value:Integer);
       Procedure SetVertOffset(Value:Integer);
       Procedure SetOrthoAngle(Value:Integer);
       Procedure SetOrthogonal(Value:Boolean);
       Procedure SetZoomInteger(const Value:Integer);
       Procedure SetZoom(const Value:Double);
       Procedure SetZoomText(Value:Boolean);
       Procedure SetBooleanProperty(Var Variable:Boolean; Value:Boolean);
       Procedure SetIntegerProperty(Var Variable:Integer; Value:Integer);
     protected
       function CalcOrthoRatio:Double;
     public
       Constructor Create({$IFDEF TEEVCL}AParent:TWinControl{$ENDIF});
       Procedure Repaint;
       Procedure Assign(Source:TPersistent); override;

       {$IFDEF TEEVCL}
       property Parent:TWinControl read FParent write FParent;
       {$ENDIF}

       property ElevationFloat:Double read FElevation write SetElevation;
       property RotationFloat:Double read FRotation write SetRotation;
       property ZoomFloat:Double read FZoom write SetZoom;

       property OnChangedZoom:TTeeView3DChangedZoom read FOnChangedZoom
                                                    write FOnChangedZoom;
       property OnScrolled:TTeeView3DScrolled read FOnScrolled write FOnScrolled;
     published
       property Elevation:Integer read GetElevation write SetElevationInteger default 345;
       property FontZoom:Integer read FFontZoom write SetFontZoom default 100;
       property HorizOffset:Integer read FHorizOffset write SetHorizOffset default 0;
       property OrthoAngle:Integer read FOrthoAngle write SetOrthoAngle default 45;
       property Orthogonal:Boolean read FOrthogonal write SetOrthogonal default True;
       property Perspective:Integer read FPerspective
                                    write SetPerspective default TeeDefaultPerspective;
       property Rotation:Integer read GetRotation write SetRotationInteger default 345;
       property Tilt:Integer read FTilt write SetTilt default 0;
       property VertOffset:Integer read FVertOffset write SetVertOffset default 0;
       property Zoom:Integer read GetZoom write SetZoomInteger default 100;
       property ZoomText:Boolean read FZoomText write SetZoomText default True;
     end;

     TTeeCanvas=class;

     TTeeTransparency=0..100;

     TTeeBlend=class
     private
       FBitmap : TBitmap;
       FCanvas : TTeeCanvas;
       FRect   : TRect;

       IValidSize : Boolean;
     public
       Constructor Create(ACanvas:TTeeCanvas; Const R:TRect);
       Destructor Destroy; override;

       Procedure DoBlend(Transparency:TTeeTransparency);
       Procedure SetRectangle(Const R:TRect);

       property Bitmap:TBitmap read FBitmap;
     end;

     TPointArray=Array of TPoint;

     TCanvas3D=class;

     TTeeShadow=class(TPersistent)
     private
       FClip         : Boolean;
       FColor        : TColor;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -