1 | unit BGRATextFXTypes;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, Controls, Graphics,
|
---|
9 | BGRABitmap, BGRABitmapTypes, LMessages;
|
---|
10 |
|
---|
11 | type
|
---|
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 |
|
---|
74 | implementation
|
---|
75 |
|
---|
76 | { TBGRATextEffectOutline }
|
---|
77 |
|
---|
78 | constructor TBGRATextEffectOutline.Create(AOwner: TControl);
|
---|
79 | begin
|
---|
80 | inherited Create(AOwner);
|
---|
81 | FColor := clWhite;
|
---|
82 | end;
|
---|
83 |
|
---|
84 | destructor TBGRATextEffectOutline.Destroy;
|
---|
85 | begin
|
---|
86 | inherited Destroy;
|
---|
87 | end;
|
---|
88 |
|
---|
89 | { TBGRATextEffectBaseTex }
|
---|
90 |
|
---|
91 | constructor TBGRATextEffectBaseTex.Create(AOwner: TControl);
|
---|
92 | begin
|
---|
93 | inherited Create(AOwner);
|
---|
94 | end;
|
---|
95 |
|
---|
96 | destructor TBGRATextEffectBaseTex.Destroy;
|
---|
97 | begin
|
---|
98 | FreeAndNil(FTexture);
|
---|
99 | inherited Destroy;
|
---|
100 | end;
|
---|
101 |
|
---|
102 | procedure TBGRATextEffectBaseTex.Texture(ATexture: IBGRAScanner);
|
---|
103 | begin
|
---|
104 | if FTexture = ATexture then
|
---|
105 | exit;
|
---|
106 | FTexture := ATexture;
|
---|
107 |
|
---|
108 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
109 | FOwner.Invalidate;
|
---|
110 | end;
|
---|
111 |
|
---|
112 | { TBGRATextEffectShadow }
|
---|
113 |
|
---|
114 | procedure TBGRATextEffectShadow.SetFRadius(AValue: integer);
|
---|
115 | begin
|
---|
116 | if FRadius = AValue then
|
---|
117 | exit;
|
---|
118 | FRadius := AValue;
|
---|
119 |
|
---|
120 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
121 | FOwner.Invalidate;
|
---|
122 | end;
|
---|
123 |
|
---|
124 | constructor TBGRATextEffectShadow.Create(AOwner: TControl);
|
---|
125 | begin
|
---|
126 | inherited Create(AOwner);
|
---|
127 | FColor := clBlack;
|
---|
128 | FOffsetX := 1;
|
---|
129 | FOffsetY := 1;
|
---|
130 | FRadius := 1;
|
---|
131 | end;
|
---|
132 |
|
---|
133 | destructor TBGRATextEffectShadow.Destroy;
|
---|
134 | begin
|
---|
135 | inherited Destroy;
|
---|
136 | end;
|
---|
137 |
|
---|
138 | { TBGRATextEffectBase }
|
---|
139 |
|
---|
140 | procedure TBGRATextEffectBase.SetFAlpha(const AValue: byte);
|
---|
141 | begin
|
---|
142 | if FAlpha = AValue then
|
---|
143 | exit;
|
---|
144 | FAlpha := AValue;
|
---|
145 |
|
---|
146 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
147 | FOwner.Invalidate;
|
---|
148 | end;
|
---|
149 |
|
---|
150 | procedure TBGRATextEffectBase.SetFColor(const AValue: TColor);
|
---|
151 | begin
|
---|
152 | if FColor = AValue then
|
---|
153 | exit;
|
---|
154 | FColor := AValue;
|
---|
155 |
|
---|
156 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
157 | FOwner.Invalidate;
|
---|
158 | end;
|
---|
159 |
|
---|
160 | procedure TBGRATextEffectBase.SetFOffsetX(const AValue: integer);
|
---|
161 | begin
|
---|
162 | if FOffsetX = AValue then
|
---|
163 | exit;
|
---|
164 | FOffsetX := AValue;
|
---|
165 |
|
---|
166 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
167 | FOwner.Invalidate;
|
---|
168 | end;
|
---|
169 |
|
---|
170 | procedure TBGRATextEffectBase.SetFOffsetY(const AValue: integer);
|
---|
171 | begin
|
---|
172 | if FOffsetY = AValue then
|
---|
173 | exit;
|
---|
174 | FOffsetY := AValue;
|
---|
175 |
|
---|
176 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
177 | FOwner.Invalidate;
|
---|
178 | end;
|
---|
179 |
|
---|
180 | procedure TBGRATextEffectBase.SetFVisible(const AValue: boolean);
|
---|
181 | begin
|
---|
182 | if FVisible = AValue then
|
---|
183 | exit;
|
---|
184 | FVisible := AValue;
|
---|
185 |
|
---|
186 | FOwner.Perform(CM_FONTCHANGED, 0, 0);
|
---|
187 | FOwner.Invalidate;
|
---|
188 | end;
|
---|
189 |
|
---|
190 | constructor TBGRATextEffectBase.Create(AOwner: TControl);
|
---|
191 | begin
|
---|
192 | FOwner := AOwner;
|
---|
193 | FAlpha := 255;
|
---|
194 | FColor := clNone;
|
---|
195 | FOffsetX := 0;
|
---|
196 | FOffsetY := 0;
|
---|
197 | FVisible := True;
|
---|
198 | inherited Create;
|
---|
199 | end;
|
---|
200 |
|
---|
201 | destructor TBGRATextEffectBase.Destroy;
|
---|
202 | begin
|
---|
203 | inherited Destroy;
|
---|
204 | end;
|
---|
205 |
|
---|
206 | end.
|
---|