source: trunk/Packages/bgracontrols/bgratextfxtypes.pas

Last change on this file was 2, checked in by chronos, 5 years ago
File size: 4.1 KB
Line 
1unit BGRATextFXTypes;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, Controls, Graphics,
9 BGRABitmap, BGRABitmapTypes, LMessages;
10
11type
12
13 { TBGRATextEffectBase }
14
15 TBGRATextEffectBase = class(TPersistent)
16 private
17 FAlpha: byte;
18 FColor: TColor;
19 FOffsetX: integer;
20 FOffsetY: integer;
21 FOwner: TControl;
22 FVisible: boolean;
23 procedure SetFAlpha(const AValue: byte);
24 procedure SetFColor(const AValue: TColor);
25 procedure SetFOffsetX(const AValue: integer);
26 procedure SetFOffsetY(const AValue: integer);
27 procedure SetFVisible(const AValue: boolean);
28 public
29 constructor Create(AOwner: TControl);
30 destructor Destroy; override;
31 published
32 property Alpha: byte Read FAlpha Write SetFAlpha;
33 property Color: TColor Read FColor Write SetFColor;
34 property OffsetX: integer Read FOffsetX Write SetFOffsetX;
35 property OffsetY: integer Read FOffsetY Write SetFOffsetY;
36 property Visible: boolean Read FVisible Write SetFVisible;
37 end;
38
39 { TBGRATextEffectShadow }
40
41 TBGRATextEffectShadow = class(TBGRATextEffectBase)
42 private
43 FRadius: integer;
44 procedure SetFRadius(AValue: integer);
45 public
46 constructor Create(AOwner: TControl);
47 destructor Destroy; override;
48 published
49 property Radius: integer Read FRadius Write SetFRadius;
50 end;
51
52 { TBGRATextEffectBaseTex }
53
54 TBGRATextEffectBaseTex = class(TBGRATextEffectBase)
55 private
56 FTexture: IBGRAScanner;
57 public
58 constructor Create(AOwner: TControl);
59 destructor Destroy; override;
60 procedure Texture(ATexture: IBGRAScanner);
61 published
62 end;
63
64 { TBGRATextEffectOutline }
65
66 TBGRATextEffectOutline = class(TBGRATextEffectBaseTex)
67 private
68 public
69 constructor Create(AOwner: TControl);
70 destructor Destroy; override;
71 published
72 end;
73
74implementation
75
76{ TBGRATextEffectOutline }
77
78constructor TBGRATextEffectOutline.Create(AOwner: TControl);
79begin
80 inherited Create(AOwner);
81 FColor := clWhite;
82end;
83
84destructor TBGRATextEffectOutline.Destroy;
85begin
86 inherited Destroy;
87end;
88
89{ TBGRATextEffectBaseTex }
90
91constructor TBGRATextEffectBaseTex.Create(AOwner: TControl);
92begin
93 inherited Create(AOwner);
94end;
95
96destructor TBGRATextEffectBaseTex.Destroy;
97begin
98 FreeAndNil(FTexture);
99 inherited Destroy;
100end;
101
102procedure TBGRATextEffectBaseTex.Texture(ATexture: IBGRAScanner);
103begin
104 if FTexture = ATexture then
105 exit;
106 FTexture := ATexture;
107
108 FOwner.Perform(CM_FONTCHANGED, 0, 0);
109 FOwner.Invalidate;
110end;
111
112{ TBGRATextEffectShadow }
113
114procedure TBGRATextEffectShadow.SetFRadius(AValue: integer);
115begin
116 if FRadius = AValue then
117 exit;
118 FRadius := AValue;
119
120 FOwner.Perform(CM_FONTCHANGED, 0, 0);
121 FOwner.Invalidate;
122end;
123
124constructor TBGRATextEffectShadow.Create(AOwner: TControl);
125begin
126 inherited Create(AOwner);
127 FColor := clBlack;
128 FOffsetX := 1;
129 FOffsetY := 1;
130 FRadius := 1;
131end;
132
133destructor TBGRATextEffectShadow.Destroy;
134begin
135 inherited Destroy;
136end;
137
138{ TBGRATextEffectBase }
139
140procedure TBGRATextEffectBase.SetFAlpha(const AValue: byte);
141begin
142 if FAlpha = AValue then
143 exit;
144 FAlpha := AValue;
145
146 FOwner.Perform(CM_FONTCHANGED, 0, 0);
147 FOwner.Invalidate;
148end;
149
150procedure TBGRATextEffectBase.SetFColor(const AValue: TColor);
151begin
152 if FColor = AValue then
153 exit;
154 FColor := AValue;
155
156 FOwner.Perform(CM_FONTCHANGED, 0, 0);
157 FOwner.Invalidate;
158end;
159
160procedure TBGRATextEffectBase.SetFOffsetX(const AValue: integer);
161begin
162 if FOffsetX = AValue then
163 exit;
164 FOffsetX := AValue;
165
166 FOwner.Perform(CM_FONTCHANGED, 0, 0);
167 FOwner.Invalidate;
168end;
169
170procedure TBGRATextEffectBase.SetFOffsetY(const AValue: integer);
171begin
172 if FOffsetY = AValue then
173 exit;
174 FOffsetY := AValue;
175
176 FOwner.Perform(CM_FONTCHANGED, 0, 0);
177 FOwner.Invalidate;
178end;
179
180procedure TBGRATextEffectBase.SetFVisible(const AValue: boolean);
181begin
182 if FVisible = AValue then
183 exit;
184 FVisible := AValue;
185
186 FOwner.Perform(CM_FONTCHANGED, 0, 0);
187 FOwner.Invalidate;
188end;
189
190constructor TBGRATextEffectBase.Create(AOwner: TControl);
191begin
192 FOwner := AOwner;
193 FAlpha := 255;
194 FColor := clNone;
195 FOffsetX := 0;
196 FOffsetY := 0;
197 FVisible := True;
198 inherited Create;
199end;
200
201destructor TBGRATextEffectBase.Destroy;
202begin
203 inherited Destroy;
204end;
205
206end.
Note: See TracBrowser for help on using the repository browser.