1 | unit bgrasamples;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, Forms, Controls, Graphics,
|
---|
9 | BGRABitmap, BGRABitmapTypes, BGRAGradients, BGRAButton, BGRAVirtualScreen,
|
---|
10 | BGRAImageButton, BGRAPolygon, LCLProc;
|
---|
11 |
|
---|
12 | const
|
---|
13 | // accent color
|
---|
14 | acMagenta = TColor($009700FF);
|
---|
15 | acPurple = TColor($00FF00A2);
|
---|
16 | acTeal = TColor($00A9AB00);
|
---|
17 | acLime = TColor($0026BF8C);
|
---|
18 | acBrown = TColor($000050A0);
|
---|
19 | acPink = TColor($00B871E6);
|
---|
20 | acOrange = TColor($000996F0);
|
---|
21 | acBlue = TColor($00E2A11B);
|
---|
22 | acRed = TColor($000014E5);
|
---|
23 | acGreen = TColor($00339933);
|
---|
24 | // facebook button color
|
---|
25 | fbBlue = TColor($00AA785F);
|
---|
26 | fbGreen = TColor($004BA567);
|
---|
27 | fbGray = TColor($00F8F8F8);
|
---|
28 |
|
---|
29 | type
|
---|
30 | TBGRASampleStyle = (ssDefault, ssFlashPlayer, ssWin7ToolBar,
|
---|
31 | ssWin7ToolBarSmooth, ssWin7, ssOffice2010,
|
---|
32 | ssMacOSXLion, ssWin7Cristal, ssiOSBar, ssiOSToolBar, ssiOSBackground,
|
---|
33 | {ssFacebookBlue, ssFacebookGreen, ssFacebookGray,} ssBlack,
|
---|
34 | ssSilverSquared, ssSilver, ssGreen, ssBlue);
|
---|
35 |
|
---|
36 | const
|
---|
37 | TBGRASampleStyleStr: array [TBGRASampleStyle] of string =
|
---|
38 | ('Default', 'Flash Player', 'Windows 7 ToolBar', 'Windows 7 ToolBar Smooth',
|
---|
39 | 'Windows 7', 'Office 2010',
|
---|
40 | 'Mac OSX Lion', 'Windows 7 Cristal', 'iOS Bar', 'iOS ToolBar',
|
---|
41 | 'iOS Background',{ 'Facebook Blue', 'Facebook Green', 'Facebook Gray',}
|
---|
42 | 'Black', 'Silver Squared', 'Silver', 'Green', 'Blue');
|
---|
43 |
|
---|
44 | function StrToTBGRASampleStyle(const s: ansistring): TBGRASampleStyle;
|
---|
45 |
|
---|
46 | { Glass }
|
---|
47 | procedure Glass(AVirtualScreen: TBGRAVirtualScreen; ABackground: TBGRABitmap;
|
---|
48 | ABlur: integer; btnShowBkg: boolean);
|
---|
49 |
|
---|
50 | { Metro UI }
|
---|
51 | procedure AccentColorButton(AButton: TBGRAButton; AColor: TColor);
|
---|
52 | procedure AccentColorButtonAll(AControl: TControl);
|
---|
53 | procedure AccentColorImageButton(Sender: TObject);
|
---|
54 | procedure AccentColorImageButton(AButton: TBGRAImageButton; AColor: TColor);
|
---|
55 | procedure AccentColorImageButtonAll(AControl: TControl);
|
---|
56 |
|
---|
57 | { Misc }
|
---|
58 | procedure SetAllFormsDoubleBuffered;
|
---|
59 | procedure SetAllBGRAButtonFont(Control: TControl; AFont: TFont);
|
---|
60 | procedure SetBGRAButtonFont(AButton: TBGRAButton; AFont: TFont);
|
---|
61 |
|
---|
62 | { Drawings }
|
---|
63 | procedure DrawButton(bitmap: TBGRABitmap; cl1, cl2, cl3, cl4, border, light: TBGRAPixel;
|
---|
64 | rx, ry, w, Value: single; dir1, dir2, dir3: TGradientDirection;
|
---|
65 | options: TRoundRectangleOptions = []; drawlight: boolean = True);
|
---|
66 | procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
|
---|
67 | procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
|
---|
68 | procedure DrawWin7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign; Smooth: boolean = False);
|
---|
69 |
|
---|
70 | { StyleButtons }
|
---|
71 | procedure StyleButtons(AControl: TControl; AButton: TBGRAButton);
|
---|
72 | procedure StyleButtonsSample(AControl: TControl; AStyle: TBGRASampleStyle);
|
---|
73 |
|
---|
74 | { Buttons }
|
---|
75 | procedure FlashPlayerButton(AButton: TBGRAButton);
|
---|
76 | procedure Win7ToolBarButton(AButton: TBGRAButton; Smooth: boolean = False);
|
---|
77 | procedure Win7Button(AButton: TBGRAButton);
|
---|
78 | procedure Office2010Button(AButton: TBGRAButton);
|
---|
79 | procedure MacOSXLionButton(AButton: TBGRAButton);
|
---|
80 | procedure Win7CristalButton(AButton: TBGRAButton);
|
---|
81 |
|
---|
82 | { Image Buttons }
|
---|
83 | procedure SingleColorImageButton(AButton: TBGRAImageButton;
|
---|
84 | cl1, cl2, cl3, cl4: TBGRAPixel);
|
---|
85 | procedure SingleColorImageButton(AButton: TBGRAImageButton; cl1, cl2, cl3, cl4: TColor);
|
---|
86 |
|
---|
87 | { iOS }
|
---|
88 | type
|
---|
89 | TiOSElement = (iOSBar, iOSToolBar, iOSBackground);
|
---|
90 |
|
---|
91 | procedure DrawiOSElement(ABitmap: TBGRABitmap; Element: TiOSElement);
|
---|
92 | function DrawiOSElement(AWidth, AHeight: integer; Element: TiOSElement): TBGRABitmap;
|
---|
93 | procedure DrawiOSBar(ABitmap: TBGRABitmap);
|
---|
94 | procedure DrawiOSToolBar(ABitmap: TBGRABitmap; Shadow: boolean = True);
|
---|
95 | procedure DrawiOSBackground(ABitmap: TBGRABitmap);
|
---|
96 |
|
---|
97 | { Facebook Button }
|
---|
98 |
|
---|
99 | procedure DrawFacebookImageButton(Sender: TObject);
|
---|
100 | procedure DrawFacebookImageButton(AButton: TBGRAImageButton; AclBody: TBGRAPixel);
|
---|
101 | procedure DrawFacebookButton(ABitmap: TBGRABitmap; AclBody, AclBackground: TBGRAPixel;
|
---|
102 | Pressed: boolean);
|
---|
103 | procedure DrawFacebookButtonNormal(ABitmap: TBGRABitmap;
|
---|
104 | AclBody, AclBorder, AclBorderDark, AclLight, AclShadow: TBGRAPixel);
|
---|
105 | procedure DrawFacebookButtonPressed(ABitmap: TBGRABitmap;
|
---|
106 | AclBody, AclBorder, AclShadow: TBGRAPixel);
|
---|
107 |
|
---|
108 | { Silver Style }
|
---|
109 |
|
---|
110 | procedure DrawBlackToolBarButton(AButton: TBGRAButton);
|
---|
111 | procedure DrawBlueBodyButton(AButton: TBGRAButton);
|
---|
112 | procedure DrawGreenBodyButton(AButton: TBGRAButton);
|
---|
113 | procedure DrawSilverBodyButton(AButton: TBGRAButton);
|
---|
114 | procedure DrawSilverBodyButtonDropDown(AButton: TBGRAButton);
|
---|
115 | procedure DrawSilverBodyButtonSquared(AButton: TBGRAButton);
|
---|
116 | procedure DrawSilverToolBar(ABitmap: TBGRABitmap);
|
---|
117 | procedure DrawSilverStatusBar(ABitmap: TBGRABitmap);
|
---|
118 |
|
---|
119 | implementation
|
---|
120 |
|
---|
121 | function StrToTBGRASampleStyle(const s: ansistring): TBGRASampleStyle;
|
---|
122 | var
|
---|
123 | ss: TBGRASampleStyle;
|
---|
124 | ls: ansistring;
|
---|
125 | begin
|
---|
126 | Result := ssDefault;
|
---|
127 | ls := UTF8LowerCase(s);
|
---|
128 | for ss := low(TBGRASampleStyle) to high(TBGRASampleStyle) do
|
---|
129 | if ls = UTF8LowerCase(TBGRASampleStyleStr[ss]) then
|
---|
130 | begin
|
---|
131 | Result := ss;
|
---|
132 | break;
|
---|
133 | end;
|
---|
134 | end;
|
---|
135 |
|
---|
136 | { Glass }
|
---|
137 |
|
---|
138 | procedure Glass(AVirtualScreen: TBGRAVirtualScreen; ABackground: TBGRABitmap;
|
---|
139 | ABlur: integer; btnShowBkg: boolean);
|
---|
140 | var
|
---|
141 | bmpMask, blurBkg, copyBkg: TBGRABitmap;
|
---|
142 | i: integer;
|
---|
143 | begin
|
---|
144 | bmpMask := TBGRABitmap.Create(AVirtualScreen.Width, AVirtualScreen.Height);
|
---|
145 |
|
---|
146 | for i := 0 to AVirtualScreen.ControlCount - 1 do
|
---|
147 | begin
|
---|
148 | if AVirtualScreen.Controls[i] is TBGRAButton then
|
---|
149 | begin
|
---|
150 | AVirtualScreen.Controls[i].UpdateBaseBounds(True, True, False);
|
---|
151 | bmpMask.Rectangle(AVirtualScreen.Controls[i].BaseBounds, BGRAWhite,
|
---|
152 | BGRAWhite, dmSet);
|
---|
153 | end;
|
---|
154 | end;
|
---|
155 |
|
---|
156 | copyBkg := TBGRABitmap.Create;
|
---|
157 | BGRAReplace(copyBkg, ABackground.Resample(AVirtualScreen.Width,
|
---|
158 | AVirtualScreen.Height));
|
---|
159 |
|
---|
160 | blurBkg := copyBkg.Duplicate(False) as TBGRABitmap;
|
---|
161 | blurBkg.ApplyMask(bmpMask);
|
---|
162 | bmpMask.Free;
|
---|
163 |
|
---|
164 | BGRAReplace(blurBkg, blurBkg.FilterBlurRadial(ABlur, rbFast));
|
---|
165 |
|
---|
166 | if btnShowBkg then
|
---|
167 | AVirtualScreen.Bitmap.PutImage(0, 0, copyBkg, dmDrawWithTransparency);
|
---|
168 | copyBkg.Free;
|
---|
169 |
|
---|
170 | AVirtualScreen.Bitmap.PutImage(0, 0, blurBkg, dmDrawWithTransparency);
|
---|
171 | blurBkg.Free;
|
---|
172 | end;
|
---|
173 |
|
---|
174 | { Metro UI }
|
---|
175 |
|
---|
176 | procedure AccentColorButton(AButton: TBGRAButton; AColor: TColor);
|
---|
177 | begin
|
---|
178 | with AButton do
|
---|
179 | begin
|
---|
180 | TextShadow := True;
|
---|
181 | TextShadowOffsetX := 1;
|
---|
182 | TextShadowOffsetY := 1;
|
---|
183 | TextShadowRadius := 1;
|
---|
184 | with BodyNormal do
|
---|
185 | begin
|
---|
186 | BorderColor := AColor;
|
---|
187 | BorderColorOpacity := 255;
|
---|
188 | BorderStyle := bboSolid;
|
---|
189 | Color := AColor;
|
---|
190 | ColorOpacity := 255;
|
---|
191 | Font.Color := clWhite;
|
---|
192 | Font.Name := 'Segoe WP Light';
|
---|
193 | Style := bbsColor;
|
---|
194 | end;
|
---|
195 | with BodyHover do
|
---|
196 | begin
|
---|
197 | BorderColor := clWhite;
|
---|
198 | BorderColorOpacity := 255;
|
---|
199 | BorderStyle := bboSolid;
|
---|
200 | Color := clWhite;
|
---|
201 | ColorOpacity := 255;
|
---|
202 | Font.Color := clWhite;
|
---|
203 | Font.Name := 'Segoe WP Light';
|
---|
204 | Style := bbsColor;
|
---|
205 | end;
|
---|
206 | with BodyClicked do
|
---|
207 | begin
|
---|
208 | BorderColor := AColor;
|
---|
209 | BorderColorOpacity := 255;
|
---|
210 | BorderStyle := bboSolid;
|
---|
211 | Color := AColor;
|
---|
212 | ColorOpacity := 255;
|
---|
213 | Font.Color := clWhite;
|
---|
214 | Font.Name := 'Segoe WP Light';
|
---|
215 | Style := bbsColor;
|
---|
216 | end;
|
---|
217 | end;
|
---|
218 | end;
|
---|
219 |
|
---|
220 | procedure AccentColorButtonAll(AControl: TControl);
|
---|
221 | var
|
---|
222 | i: integer;
|
---|
223 | WinControl: TWinControl;
|
---|
224 | begin
|
---|
225 | if AControl is TBGRAButton then
|
---|
226 | AccentColorButton(AControl as TBGRAButton, AControl.Color);
|
---|
227 |
|
---|
228 | if AControl is TWinControl then
|
---|
229 | begin
|
---|
230 | WinControl := TWinControl(AControl);
|
---|
231 | if WinControl.ControlCount = 0 then
|
---|
232 | exit;
|
---|
233 | for i := 0 to WinControl.ControlCount - 1 do
|
---|
234 | AccentColorButtonAll(WinControl.Controls[i]);
|
---|
235 | end;
|
---|
236 | end;
|
---|
237 |
|
---|
238 | procedure AccentColorImageButton(Sender: TObject);
|
---|
239 | begin
|
---|
240 | if Sender is TBGRAImageButton then
|
---|
241 | AccentColorImageButton(TBGRAImageButton(Sender), TBGRAImageButton(Sender).Color);
|
---|
242 | end;
|
---|
243 |
|
---|
244 | procedure AccentColorImageButton(AButton: TBGRAImageButton; AColor: TColor);
|
---|
245 | begin
|
---|
246 | AButton.Font.Name := 'Segoe WP Light';
|
---|
247 | AButton.Font.Color := clWhite;
|
---|
248 | SingleColorImageButton(AButton, AColor, $00FAFAFA, AColor, clGray);
|
---|
249 | end;
|
---|
250 |
|
---|
251 | procedure AccentColorImageButtonAll(AControl: TControl);
|
---|
252 | var
|
---|
253 | i: integer;
|
---|
254 | WinControl: TWinControl;
|
---|
255 | begin
|
---|
256 | if AControl is TBGRAImageButton then
|
---|
257 | AccentColorImageButton(AControl as TBGRAImageButton, AControl.Color);
|
---|
258 |
|
---|
259 | if AControl is TWinControl then
|
---|
260 | begin
|
---|
261 | WinControl := TWinControl(AControl);
|
---|
262 | if WinControl.ControlCount = 0 then
|
---|
263 | exit;
|
---|
264 | for i := 0 to WinControl.ControlCount - 1 do
|
---|
265 | AccentColorImageButtonAll(WinControl.Controls[i]);
|
---|
266 | end;
|
---|
267 | end;
|
---|
268 |
|
---|
269 | { Misc }
|
---|
270 |
|
---|
271 | procedure SetAllFormsDoubleBuffered;
|
---|
272 | var
|
---|
273 | i: integer;
|
---|
274 | begin
|
---|
275 | for i := 0 to Screen.FormCount - 1 do
|
---|
276 | Screen.Forms[i].DoubleBuffered := True;
|
---|
277 | end;
|
---|
278 |
|
---|
279 | procedure SetAllBGRAButtonFont(Control: TControl; AFont: TFont);
|
---|
280 | var
|
---|
281 | i: integer;
|
---|
282 | WinControl: TWinControl;
|
---|
283 | tempButton: TBGRAButton;
|
---|
284 | begin
|
---|
285 | if Control is TBGRAButton then
|
---|
286 | begin
|
---|
287 | tempButton := TBGRAButton(Control);
|
---|
288 | SetBGRAButtonFont(tempButton, AFont);
|
---|
289 | end;
|
---|
290 | if Control is TWinControl then
|
---|
291 | begin
|
---|
292 | WinControl := TWinControl(Control);
|
---|
293 | if WinControl.ControlCount = 0 then
|
---|
294 | exit;
|
---|
295 | for i := 0 to WinControl.ControlCount - 1 do
|
---|
296 | if WinControl.Controls[i] is TBGRAButton then
|
---|
297 | begin
|
---|
298 | tempButton := TBGRAButton(WinControl.Controls[i]);
|
---|
299 | SetBGRAButtonFont(tempButton, AFont);
|
---|
300 | end;
|
---|
301 | end;
|
---|
302 | end;
|
---|
303 |
|
---|
304 | procedure SetBGRAButtonFont(AButton: TBGRAButton; AFont: TFont);
|
---|
305 | begin
|
---|
306 | with AButton do
|
---|
307 | begin
|
---|
308 | BodyClicked.Font := AFont;
|
---|
309 | BodyHover.Font := AFont;
|
---|
310 | BodyNormal.Font := AFont;
|
---|
311 | end;
|
---|
312 | end;
|
---|
313 |
|
---|
314 | { Drawings }
|
---|
315 |
|
---|
316 | procedure DrawButton(bitmap: TBGRABitmap; cl1, cl2, cl3, cl4, border, light: TBGRAPixel;
|
---|
317 | rx, ry, w, Value: single; dir1, dir2, dir3: TGradientDirection;
|
---|
318 | options: TRoundRectangleOptions = []; drawlight: boolean = True);
|
---|
319 | var
|
---|
320 | texture: TBGRABitmap;
|
---|
321 | w2, b2: single;
|
---|
322 | begin
|
---|
323 | texture := DoubleGradientAlphaFill(Rect(0, 0, bitmap.Width, bitmap.Height),
|
---|
324 | cl1, cl2, cl3, cl4, dir1, dir2, dir3, Value);
|
---|
325 |
|
---|
326 | b2 := 1;
|
---|
327 | w2 := w * 2 - 1;
|
---|
328 |
|
---|
329 | FillRoundRectangleAntialiasWithTexture(bitmap, Trunc(w / 2),
|
---|
330 | Trunc(w / 2), bitmap.Width - b2 - Trunc(w / 2),
|
---|
331 | bitmap.Height - b2 - Trunc(w / 2), rx, ry, options, texture);
|
---|
332 | texture.Free;
|
---|
333 |
|
---|
334 | if drawlight then
|
---|
335 | BorderRoundRectangleAntialias(bitmap, w, w,
|
---|
336 | bitmap.Width - b2 - w,
|
---|
337 | bitmap.Height - b2 - w, rx, ry, w2, options, light, False);
|
---|
338 |
|
---|
339 | BorderRoundRectangleAntialias(bitmap, Trunc(w / 2), Trunc(w / 2),
|
---|
340 | bitmap.Width - b2 - Trunc(w / 2),
|
---|
341 | bitmap.Height - b2 - Trunc(w / 2), rx, ry, w, options, border, False);
|
---|
342 | end;
|
---|
343 |
|
---|
344 | procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
|
---|
345 | begin
|
---|
346 | with ABitmap do
|
---|
347 | begin
|
---|
348 | GradientFill(0, 0, Width, Height, BGRA(203, 19, 23, 255), BGRA(110, 3, 20, 255),
|
---|
349 | gtLinear, PointF(0, 0), PointF(0, Height), dmSet);
|
---|
350 | Rectangle(0, 0, Width, Height + 1, BGRA(0, 0, 0, 215), dmDrawWithTransparency);
|
---|
351 | end;
|
---|
352 | end;
|
---|
353 |
|
---|
354 | procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
|
---|
355 | begin
|
---|
356 | with ABitmap do
|
---|
357 | begin
|
---|
358 | DrawHorizLine(0, 0, Width, BGRA(30, 30, 30, 255));
|
---|
359 | DrawHorizLine(0, Height - 1, Width, BGRA(62, 62, 62, 255));
|
---|
360 | Rectangle(0, 1, Width, Height - 1, BGRA(91, 91, 91, 255),
|
---|
361 | BGRA(76, 76, 76, 255), dmSet);
|
---|
362 | end;
|
---|
363 | end;
|
---|
364 |
|
---|
365 | procedure DrawWin7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign; Smooth: boolean = False);
|
---|
366 | var
|
---|
367 | tempBmp: TBGRABitmap;
|
---|
368 | begin
|
---|
369 | if Smooth then
|
---|
370 | tempBmp := DoubleGradientAlphaFill(Rect(0, 0, ABitmap.Width, ABitmap.Height),
|
---|
371 | BGRA(245, 249, 255, 255), BGRA(222, 232, 245, 255), BGRA(220, 230, 245, 255),
|
---|
372 | BGRA(222, 230, 245, 255), gdVertical, gdVertical, gdVertical, 0.50)
|
---|
373 | else
|
---|
374 | tempBmp := DoubleGradientAlphaFill(Rect(0, 0, ABitmap.Width, ABitmap.Height),
|
---|
375 | BGRA(245, 250, 255, 255), BGRA(230, 240, 250, 255), BGRA(220, 230, 244, 255),
|
---|
376 | BGRA(221, 233, 247, 255), gdVertical, gdVertical, gdVertical, 0.50);
|
---|
377 |
|
---|
378 | ABitmap.PutImage(0, 0, tempBmp, dmSet);
|
---|
379 | tempBmp.Free;
|
---|
380 |
|
---|
381 | case ADir of
|
---|
382 | alLeft: with ABitmap do
|
---|
383 | begin
|
---|
384 | if not Smooth then
|
---|
385 | Rectangle(0, 0, Width - 2, Height, BGRA(255, 255, 255, 100),
|
---|
386 | dmDrawWithTransparency);
|
---|
387 | SetVertLine(Width - 1, 0, Height - 1, BGRA(160, 175, 195, 255));
|
---|
388 | SetVertLine(Width - 2, 0, Height - 1, BGRA(205, 218, 234, 255));
|
---|
389 | end;
|
---|
390 | alTop: with ABitmap do
|
---|
391 | begin
|
---|
392 | if not Smooth then
|
---|
393 | Rectangle(0, 0, Width, Height - 2, BGRA(255, 255, 255, 100),
|
---|
394 | dmDrawWithTransparency);
|
---|
395 | SetHorizLine(0, Height - 1, Width - 1, BGRA(160, 175, 195, 255));
|
---|
396 | SetHorizLine(0, Height - 2, Width - 1, BGRA(205, 218, 234, 255));
|
---|
397 | end;
|
---|
398 | alRight: with ABitmap do
|
---|
399 | begin
|
---|
400 | if not Smooth then
|
---|
401 | Rectangle(2, 0, Width, Height, BGRA(255, 255, 255, 100),
|
---|
402 | dmDrawWithTransparency);
|
---|
403 | SetVertLine(0, 0, Height, BGRA(160, 175, 195, 255));
|
---|
404 | SetVertLine(1, 0, Height, BGRA(205, 218, 234, 255));
|
---|
405 | end;
|
---|
406 | alBottom: with ABitmap do
|
---|
407 | begin
|
---|
408 | if not Smooth then
|
---|
409 | Rectangle(0, 2, Width, Height, BGRA(255, 255, 255, 100),
|
---|
410 | dmDrawWithTransparency);
|
---|
411 | SetHorizLine(0, 0, Width - 1, BGRA(160, 175, 195, 255));
|
---|
412 | SetHorizLine(0, 1, Width - 1, BGRA(205, 218, 234, 255));
|
---|
413 | end;
|
---|
414 | alClient, alCustom, alNone: with ABitmap do
|
---|
415 | begin
|
---|
416 | if not Smooth then
|
---|
417 | Rectangle(0, 0, Width, Height, BGRA(255, 255, 255, 100),
|
---|
418 | dmDrawWithTransparency);
|
---|
419 | end;
|
---|
420 | end;
|
---|
421 | end;
|
---|
422 |
|
---|
423 | { StyleButtons }
|
---|
424 |
|
---|
425 | procedure StyleButtons(AControl: TControl; AButton: TBGRAButton);
|
---|
426 | var
|
---|
427 | i: integer;
|
---|
428 | WinControl: TWinControl;
|
---|
429 | begin
|
---|
430 | if AControl is TBGRAButton then
|
---|
431 | with AControl as TBGRAButton do
|
---|
432 | begin
|
---|
433 | // Those are recomended properties to keep unchanged
|
---|
434 | AButton.Glyph := Glyph;
|
---|
435 | AButton.GlyphMargin := GlyphMargin;
|
---|
436 | AButton.StaticButton := StaticButton;
|
---|
437 | AButton.Down := Down;
|
---|
438 | AButton.Style := Style;
|
---|
439 | AButton.TextAlign := TextAlign;
|
---|
440 | AButton.TextVAlign := TextVAlign;
|
---|
441 |
|
---|
442 | Assign(AButton);
|
---|
443 | end;
|
---|
444 | if AControl is TWinControl then
|
---|
445 | begin
|
---|
446 | WinControl := TWinControl(AControl);
|
---|
447 | if WinControl.ControlCount = 0 then
|
---|
448 | exit;
|
---|
449 | for i := 0 to WinControl.ControlCount - 1 do
|
---|
450 | StyleButtons(WinControl.Controls[i], AButton);
|
---|
451 | end;
|
---|
452 | end;
|
---|
453 |
|
---|
454 | procedure StyleButtonsSample(AControl: TControl; AStyle: TBGRASampleStyle);
|
---|
455 | var
|
---|
456 | tempBGRAButton: TBGRAButton;
|
---|
457 | begin
|
---|
458 | tempBGRAButton := TBGRAButton.Create(nil);
|
---|
459 | case AStyle of
|
---|
460 | ssFlashPlayer: FlashPlayerButton(tempBGRAButton);
|
---|
461 | ssWin7Toolbar: Win7ToolBarButton(tempBGRAButton);
|
---|
462 | ssWin7ToolbarSmooth: Win7ToolBarButton(tempBGRAButton, True);
|
---|
463 | ssWin7: Win7Button(tempBGRAButton);
|
---|
464 | ssOffice2010: Office2010Button(tempBGRAButton);
|
---|
465 | ssMacOSXLion: MacOSXLionButton(tempBGRAButton);
|
---|
466 | ssWin7Cristal: Win7CristalButton(tempBGRAButton);
|
---|
467 | ssiOSBar, ssiOSToolBar, ssiOSBackground: MacOSXLionButton(tempBGRAButton);
|
---|
468 | // ToDO: add iOS TBGRAButton
|
---|
469 | //ssFacebookBlue, ssFacebookGreen, ssFacebookGray: MacOSXLionButton(tempBGRAButton);
|
---|
470 | // ToDO: add Facebook TBGRAButton
|
---|
471 | ssBlack: DrawBlackToolBarButton(tempBGRAButton);
|
---|
472 | ssSilver: DrawSilverBodyButton(tempBGRAButton);
|
---|
473 | ssSilverSquared: DrawSilverBodyButtonSquared(tempBGRAButton);
|
---|
474 | ssGreen: DrawGreenBodyButton(tempBGRAButton);
|
---|
475 | ssBlue: DrawBlueBodyButton(tempBGRAButton);
|
---|
476 | end;
|
---|
477 | StyleButtons(AControl, tempBGRAButton);
|
---|
478 | tempBGRAButton.Free;
|
---|
479 | end;
|
---|
480 |
|
---|
481 | { Buttons }
|
---|
482 |
|
---|
483 | procedure FlashPlayerButton(AButton: TBGRAButton);
|
---|
484 | begin
|
---|
485 | with AButton do
|
---|
486 | begin
|
---|
487 | TextCanvas := True;
|
---|
488 | TextShadowOffSetX := 1;
|
---|
489 | TextShadowOffSetY := 1;
|
---|
490 | TextShadowRadius := 1;
|
---|
491 | with BorderStyle do
|
---|
492 | begin
|
---|
493 | BottomLeft := bsSquare;
|
---|
494 | BottomRight := bsSquare;
|
---|
495 | TopLeft := bsSquare;
|
---|
496 | TopRight := bsSquare;
|
---|
497 | end;
|
---|
498 | with BodyNormal do
|
---|
499 | begin
|
---|
500 | BorderColor := RGBToColor(24, 24, 24);
|
---|
501 | Font.Color := clWhite;
|
---|
502 | LightOpacity := 20;
|
---|
503 | LightWidth := 1;
|
---|
504 | Gradient1.StartColor := RGBToColor(104, 104, 104);
|
---|
505 | Gradient1.EndColor := RGBToColor(104, 104, 104);
|
---|
506 | Gradient2.StartColor := RGBToColor(103, 103, 103);
|
---|
507 | Gradient2.EndColor := RGBToColor(71, 71, 71);
|
---|
508 | end;
|
---|
509 | with BodyHover do
|
---|
510 | begin
|
---|
511 | BorderColor := RGBToColor(24, 24, 24);
|
---|
512 | Font.Color := clWhite;
|
---|
513 | LightOpacity := 20;
|
---|
514 | LightWidth := 1;
|
---|
515 | Gradient1.StartColor := RGBToColor(118, 118, 118);
|
---|
516 | Gradient1.EndColor := RGBToColor(118, 118, 118);
|
---|
517 | Gradient2.StartColor := RGBToColor(117, 117, 117);
|
---|
518 | Gradient2.EndColor := RGBToColor(81, 81, 81);
|
---|
519 | end;
|
---|
520 | with BodyClicked do
|
---|
521 | begin
|
---|
522 | BorderColor := RGBToColor(24, 24, 24);
|
---|
523 | Font.Color := clWhite;
|
---|
524 | LightOpacity := 20;
|
---|
525 | LightWidth := 1;
|
---|
526 | Gradient1.StartColor := RGBToColor(92, 92, 92);
|
---|
527 | Gradient1.EndColor := RGBToColor(92, 92, 92);
|
---|
528 | Gradient2.StartColor := RGBToColor(91, 91, 91);
|
---|
529 | Gradient2.EndColor := RGBToColor(62, 62, 62);
|
---|
530 | end;
|
---|
531 | end;
|
---|
532 | end;
|
---|
533 |
|
---|
534 | procedure Win7ToolBarButton(AButton: TBGRAButton; Smooth: boolean = False);
|
---|
535 | begin
|
---|
536 | with AButton do
|
---|
537 | begin
|
---|
538 | TextCanvas := True;
|
---|
539 | TextShadow := False;
|
---|
540 | TextShadowOffsetX := 0;
|
---|
541 | TextShadowOffsetY := 0;
|
---|
542 | TextShadowRadius := 0;
|
---|
543 | RoundX := 2;
|
---|
544 | RoundY := 2;
|
---|
545 | with BodyNormal do
|
---|
546 | begin
|
---|
547 | Font.Color := RGBToColor(30, 57, 91); //clBlack;
|
---|
548 | Gradient1EndPercent := 55;
|
---|
549 | BorderStyle := bboNone;
|
---|
550 | // smooth
|
---|
551 | if Smooth then
|
---|
552 | begin
|
---|
553 | Gradient1.StartColor := RGBToColor(245, 249, 255);
|
---|
554 | Gradient1.EndColor := RGBToColor(222, 232, 245);
|
---|
555 | Gradient2.StartColor := RGBToColor(220, 230, 245);
|
---|
556 | Gradient2.EndColor := RGBToColor(222, 230, 245);
|
---|
557 | end
|
---|
558 | // normal
|
---|
559 | else
|
---|
560 | begin
|
---|
561 | Gradient1.StartColor := RGBToColor(245, 250, 255);
|
---|
562 | Gradient1.EndColor := RGBToColor(230, 240, 250);
|
---|
563 | Gradient2.StartColor := RGBToColor(220, 230, 244);
|
---|
564 | Gradient2.EndColor := RGBToColor(221, 233, 247);
|
---|
565 | end;
|
---|
566 | end;
|
---|
567 | with BodyHover do
|
---|
568 | begin
|
---|
569 | Font.Color := RGBToColor(30, 57, 91); //clBlack;
|
---|
570 | Gradient1EndPercent := 55;
|
---|
571 | BorderColor := RGBToColor(187, 202, 219);
|
---|
572 | Gradient1.StartColor := RGBToColor(248, 251, 254);
|
---|
573 | Gradient1.EndColor := RGBToColor(237, 242, 250);
|
---|
574 | Gradient2.StartColor := RGBToColor(215, 228, 244);
|
---|
575 | Gradient2.EndColor := RGBToColor(193, 210, 232);
|
---|
576 | LightWidth := 1;
|
---|
577 | LightOpacity := 200;
|
---|
578 | end;
|
---|
579 | with BodyClicked do
|
---|
580 | begin
|
---|
581 | Font.Color := RGBToColor(30, 57, 91); //clBlack;
|
---|
582 | Gradient1EndPercent := 55;
|
---|
583 | BorderColor := RGBToColor(187, 202, 219);
|
---|
584 | Gradient1.StartColor := RGBToColor(226, 236, 245);
|
---|
585 | Gradient1.EndColor := RGBToColor(216, 228, 241);
|
---|
586 | Gradient2.StartColor := RGBToColor(207, 219, 236);
|
---|
587 | Gradient2.EndColor := RGBToColor(207, 220, 237);
|
---|
588 | end;
|
---|
589 | end;
|
---|
590 | end;
|
---|
591 |
|
---|
592 | procedure Win7Button(AButton: TBGRAButton);
|
---|
593 | begin
|
---|
594 | with AButton do
|
---|
595 | begin
|
---|
596 | TextCanvas := True;
|
---|
597 | TextShadow := False;
|
---|
598 | TextShadowOffsetX := 0;
|
---|
599 | TextShadowOffsetY := 0;
|
---|
600 | TextShadowRadius := 0;
|
---|
601 | RoundX := 3;
|
---|
602 | RoundY := 3;
|
---|
603 | with BodyNormal do
|
---|
604 | begin
|
---|
605 | Font.Color := clBlack;
|
---|
606 | Gradient1EndPercent := 50;
|
---|
607 | BorderColor := RGBToColor(112, 112, 112);
|
---|
608 | Gradient1.StartColor := RGBToColor(242, 242, 242);
|
---|
609 | Gradient1.EndColor := RGBToColor(235, 235, 235);
|
---|
610 | Gradient2.StartColor := RGBToColor(221, 221, 221);
|
---|
611 | Gradient2.EndColor := RGBToColor(207, 207, 207);
|
---|
612 | LightOpacity := 175;
|
---|
613 | LightWidth := 1;
|
---|
614 | end;
|
---|
615 | with BodyHover do
|
---|
616 | begin
|
---|
617 | Font.Color := clBlack;
|
---|
618 | Gradient1EndPercent := 50;
|
---|
619 | BorderColor := RGBToColor(60, 127, 177);
|
---|
620 | Gradient1.StartColor := RGBToColor(234, 246, 253);
|
---|
621 | Gradient1.EndColor := RGBToColor(217, 240, 252);
|
---|
622 | Gradient2.StartColor := RGBToColor(190, 230, 253);
|
---|
623 | Gradient2.EndColor := RGBToColor(167, 217, 245);
|
---|
624 | LightOpacity := 175;
|
---|
625 | LightWidth := 1;
|
---|
626 | end;
|
---|
627 | with BodyClicked do
|
---|
628 | begin
|
---|
629 | Font.Color := clBlack;
|
---|
630 | Gradient1EndPercent := 55;
|
---|
631 | BorderColor := RGBToColor(44, 98, 139);
|
---|
632 | Gradient1.StartColor := RGBToColor(229, 244, 252);
|
---|
633 | Gradient1.EndColor := RGBToColor(196, 229, 246);
|
---|
634 | Gradient2.StartColor := RGBToColor(152, 209, 239);
|
---|
635 | Gradient2.EndColor := RGBToColor(104, 179, 219);
|
---|
636 | LightWidth := 0;
|
---|
637 | end;
|
---|
638 | end;
|
---|
639 | end;
|
---|
640 |
|
---|
641 | procedure Office2010Button(AButton: TBGRAButton);
|
---|
642 | begin
|
---|
643 | with AButton do
|
---|
644 | begin
|
---|
645 | TextCanvas := True;
|
---|
646 | RoundX := 3;
|
---|
647 | RoundY := 3;
|
---|
648 | TextShadow := False;
|
---|
649 | TextShadowOffsetX := 0;
|
---|
650 | TextShadowOffsetY := 0;
|
---|
651 | TextShadowRadius := 0;
|
---|
652 | with BodyNormal do
|
---|
653 | begin
|
---|
654 | BorderColor := RGBToColor(207, 208, 210);
|
---|
655 | Font.Color := clBlack;
|
---|
656 | Gradient1.StartColor := RGBToColor(255, 255, 255);
|
---|
657 | Gradient1.EndColor := RGBToColor(237, 239, 241);
|
---|
658 | Gradient1EndPercent := 100;
|
---|
659 | LightOpacity := 175;
|
---|
660 | LightWidth := 1;
|
---|
661 | end;
|
---|
662 | with BodyHover do
|
---|
663 | begin
|
---|
664 | BorderColor := RGBToColor(244, 210, 81);
|
---|
665 | Font.Color := clBlack;
|
---|
666 | Gradient1.StartColor := RGBToColor(254, 241, 189);
|
---|
667 | Gradient1.EndColor := RGBToColor(254, 228, 134);
|
---|
668 | Gradient1EndPercent := 50;
|
---|
669 | Gradient2.StartColor := RGBToColor(254, 228, 134);
|
---|
670 | Gradient2.EndColor := RGBToColor(254, 248, 196);
|
---|
671 | LightOpacity := 175;
|
---|
672 | LightWidth := 1;
|
---|
673 | end;
|
---|
674 | with BodyClicked do
|
---|
675 | begin
|
---|
676 | BorderColor := RGBToColor(194, 161, 63);
|
---|
677 | Font.Color := clBlack;
|
---|
678 | Gradient1.StartColor := RGBToColor(255, 229, 117);
|
---|
679 | Gradient1.EndColor := RGBToColor(255, 216, 107);
|
---|
680 | Gradient1EndPercent := 50;
|
---|
681 | Gradient2.StartColor := RGBToColor(255, 216, 107);
|
---|
682 | Gradient2.EndColor := RGBToColor(255, 239, 129);
|
---|
683 | LightWidth := 0;
|
---|
684 | end;
|
---|
685 | end;
|
---|
686 | end;
|
---|
687 |
|
---|
688 | procedure MacOSXLionButton(AButton: TBGRAButton);
|
---|
689 | begin
|
---|
690 | with AButton do
|
---|
691 | begin
|
---|
692 | TextCanvas := True;
|
---|
693 | TextShadow := False;
|
---|
694 | TextShadowOffsetX := 0;
|
---|
695 | TextShadowOffsetY := 0;
|
---|
696 | TextShadowRadius := 0;
|
---|
697 | RoundX := 3;
|
---|
698 | RoundY := 3;
|
---|
699 | with BodyNormal do
|
---|
700 | begin
|
---|
701 | Font.Color := clBlack;
|
---|
702 | Gradient1EndPercent := 50;
|
---|
703 | BorderColor := RGBToColor(154, 154, 154);
|
---|
704 | Gradient1.StartColor := RGBToColor(255, 255, 255);
|
---|
705 | Gradient1.EndColor := RGBToColor(243, 243, 243);
|
---|
706 | Gradient2.StartColor := RGBToColor(236, 236, 236);
|
---|
707 | Gradient2.EndColor := RGBToColor(235, 235, 235);
|
---|
708 | LightOpacity := 175;
|
---|
709 | LightWidth := 1;
|
---|
710 | end;
|
---|
711 | with BodyHover do
|
---|
712 | begin
|
---|
713 | Font.Color := clBlack;
|
---|
714 | Gradient1EndPercent := 50;
|
---|
715 | BorderColor := RGBToColor(86, 87, 143);
|
---|
716 | Gradient1.StartColor := RGBToColor(204, 229, 252);
|
---|
717 | Gradient1.EndColor := RGBToColor(161, 209, 249);
|
---|
718 | Gradient2.StartColor := RGBToColor(143, 202, 251);
|
---|
719 | Gradient2.EndColor := RGBToColor(207, 245, 253);
|
---|
720 | LightOpacity := 175;
|
---|
721 | LightWidth := 1;
|
---|
722 | end;
|
---|
723 | with BodyClicked do
|
---|
724 | begin
|
---|
725 | Font.Color := clBlack;
|
---|
726 | Gradient1EndPercent := 55;
|
---|
727 | BorderColor := RGBToColor(86, 87, 143);
|
---|
728 | Gradient1.StartColor := RGBToColor(144, 195, 241);
|
---|
729 | Gradient1.EndColor := RGBToColor(113, 180, 239);
|
---|
730 | Gradient2.StartColor := RGBToColor(97, 173, 240);
|
---|
731 | Gradient2.EndColor := RGBToColor(147, 206, 241);
|
---|
732 | LightWidth := 0;
|
---|
733 | end;
|
---|
734 | end;
|
---|
735 | end;
|
---|
736 |
|
---|
737 | procedure Win7CristalButton(AButton: TBGRAButton);
|
---|
738 | begin
|
---|
739 | with AButton do
|
---|
740 | begin
|
---|
741 | TextCanvas := True;
|
---|
742 | TextShadowOffsetX := 1;
|
---|
743 | TextShadowOffsetY := 1;
|
---|
744 | TextShadowRadius := 1;
|
---|
745 | with BorderStyle do
|
---|
746 | begin
|
---|
747 | BottomLeft := bsSquare;
|
---|
748 | BottomRight := bsSquare;
|
---|
749 | TopLeft := bsSquare;
|
---|
750 | TopRight := bsSquare;
|
---|
751 | end;
|
---|
752 | with BodyNormal do
|
---|
753 | begin
|
---|
754 | BorderColor := RGBToColor(93, 111, 136);
|
---|
755 | Font.Color := clWhite;
|
---|
756 | LightOpacity := 150;
|
---|
757 | LightWidth := 1;
|
---|
758 | Gradient1EndPercent := 40;
|
---|
759 | Gradient1.StartColor := RGBToColor(195, 212, 231);
|
---|
760 | Gradient1.EndColor := RGBToColor(190, 211, 232);
|
---|
761 | Gradient2.StartColor := RGBToColor(156, 181, 207);
|
---|
762 | Gradient2.EndColor := RGBToColor(183, 208, 233);
|
---|
763 | Gradient2.Point1YPercent := 70;
|
---|
764 | end;
|
---|
765 | with BodyHover do
|
---|
766 | begin
|
---|
767 | BorderColor := RGBToColor(81, 94, 108);
|
---|
768 | Font.Color := clWhite;
|
---|
769 | LightOpacity := 150;
|
---|
770 | LightWidth := 1;
|
---|
771 | Gradient1EndPercent := 40;
|
---|
772 | Gradient1.StartColor := RGBToColor(170, 213, 243);
|
---|
773 | Gradient1.EndColor := RGBToColor(134, 194, 235);
|
---|
774 | Gradient1.Point1YPercent := 5;
|
---|
775 | Gradient2.StartColor := RGBToColor(45, 117, 167);
|
---|
776 | Gradient2.EndColor := RGBToColor(36, 198, 235);
|
---|
777 | Gradient2.Point1YPercent := 70;
|
---|
778 | end;
|
---|
779 | with BodyClicked do
|
---|
780 | begin
|
---|
781 | BorderColor := RGBToColor(81, 94, 108);
|
---|
782 | Font.Color := clWhite;
|
---|
783 | LightOpacity := 75;
|
---|
784 | LightWidth := 1;
|
---|
785 | Gradient1EndPercent := 40;
|
---|
786 | Gradient1.StartColor := RGBToColor(127, 154, 172);
|
---|
787 | Gradient1.EndColor := RGBToColor(97, 122, 144);
|
---|
788 | Gradient1.Point1YPercent := 5;
|
---|
789 | Gradient2.StartColor := RGBToColor(32, 62, 84);
|
---|
790 | Gradient2.EndColor := RGBToColor(39, 201, 200);
|
---|
791 | Gradient2.Point1YPercent := 70;
|
---|
792 | end;
|
---|
793 | end;
|
---|
794 | end;
|
---|
795 |
|
---|
796 | procedure SingleColorImageButton(AButton: TBGRAImageButton;
|
---|
797 | cl1, cl2, cl3, cl4: TBGRAPixel);
|
---|
798 | var
|
---|
799 | temp: TBGRABitmap;
|
---|
800 | begin
|
---|
801 | temp := TBGRABitmap.Create(1, 4);
|
---|
802 | temp.SetPixel(0, 0, cl1);
|
---|
803 | temp.SetPixel(0, 1, cl2);
|
---|
804 | temp.SetPixel(0, 2, cl3);
|
---|
805 | temp.SetPixel(0, 3, cl4);
|
---|
806 | AButton.Bitmap := temp.Bitmap;
|
---|
807 | temp.Free;
|
---|
808 | end;
|
---|
809 |
|
---|
810 | procedure SingleColorImageButton(AButton: TBGRAImageButton; cl1, cl2, cl3, cl4: TColor);
|
---|
811 | begin
|
---|
812 | SingleColorImageButton(AButton, ColorToBGRA(ColorToRGB(cl1), 255),
|
---|
813 | ColorToBGRA(ColorToRGB(cl2), 255),
|
---|
814 | ColorToBGRA(ColorToRGB(cl3), 255),
|
---|
815 | ColorToBGRA(ColorToRGB(cl4), 255));
|
---|
816 | end;
|
---|
817 |
|
---|
818 | { iOS }
|
---|
819 |
|
---|
820 | procedure DrawiOSElement(ABitmap: TBGRABitmap; Element: TiOSElement);
|
---|
821 | begin
|
---|
822 | case Element of
|
---|
823 | iOSBar: DrawiOSBar(ABitmap);
|
---|
824 | iOSToolBar: DrawiOSToolBar(ABitmap);
|
---|
825 | iOSBackground: DrawiOSBackground(ABitmap);
|
---|
826 | end;
|
---|
827 | end;
|
---|
828 |
|
---|
829 | function DrawiOSElement(AWidth, AHeight: integer; Element: TiOSElement): TBGRABitmap;
|
---|
830 | var
|
---|
831 | ABitmap: TBGRABitmap;
|
---|
832 | begin
|
---|
833 | ABitmap := TBGRABitmap.Create(AWidth, AHeight);
|
---|
834 | DrawiOSElement(ABitmap, Element);
|
---|
835 | Result := ABitmap;
|
---|
836 | end;
|
---|
837 |
|
---|
838 | procedure DrawiOSBar(ABitmap: TBGRABitmap);
|
---|
839 | begin
|
---|
840 | ABitmap.GradientFill(0, 0, ABitmap.Width, ABitmap.Height - 4,
|
---|
841 | BGRA(238, 245, 248, 255), BGRA(196, 204, 208, 255), gtLinear,
|
---|
842 | PointF(0, 0), PointF(0, ABitmap.Height - 4), dmSet);
|
---|
843 | with ABitmap do
|
---|
844 | begin
|
---|
845 | // Bottom Bevel
|
---|
846 | SetHorizLine(0, Height - 4, Width - 1, BGRA(190, 198, 202, 255));
|
---|
847 | SetHorizLine(0, Height - 3, Width - 1, BGRA(201, 209, 213, 255));
|
---|
848 | SetHorizLine(0, Height - 2, Width - 1, BGRA(134, 142, 147, 255));
|
---|
849 | SetHorizLine(0, Height - 1, Width - 1, BGRA(177, 180, 182, 255));
|
---|
850 | end;
|
---|
851 | end;
|
---|
852 |
|
---|
853 | procedure DrawiOSToolBar(ABitmap: TBGRABitmap; Shadow: boolean = True);
|
---|
854 | begin
|
---|
855 | if Shadow then
|
---|
856 | begin
|
---|
857 | DoubleGradientAlphaFill(ABitmap, Rect(0, 3, ABitmap.Width, ABitmap.Height - 6),
|
---|
858 | BGRA(172, 185, 201), BGRA(134, 153, 178, 255),
|
---|
859 | BGRA(125, 147, 175, 255), BGRA(110, 132, 162, 255),
|
---|
860 | gdVertical, gdVertical, gdVertical, 0.5);
|
---|
861 | with ABitmap do
|
---|
862 | begin
|
---|
863 | // Top Bevel
|
---|
864 | SetHorizLine(0, 0, Width - 1, BGRA(201, 210, 221, 255));
|
---|
865 | SetHorizLine(0, 1, Width - 1, BGRA(173, 184, 200, 255));
|
---|
866 | SetHorizLine(0, 2, Width - 1, BGRA(179, 190, 205, 255));
|
---|
867 | // Bottom Bevel
|
---|
868 | SetHorizLine(0, Height - 6, Width - 1, BGRA(107, 129, 158, 255));
|
---|
869 | SetHorizLine(0, Height - 5, Width - 1, BGRA(116, 139, 170, 255));
|
---|
870 | SetHorizLine(0, Height - 4, Width - 1, BGRA(48, 54, 62, 255));
|
---|
871 | // Bottom Shadow
|
---|
872 | SetHorizLine(0, Height - 3, Width - 1, BGRA(0, 0, 0, 75));
|
---|
873 | SetHorizLine(0, Height - 2, Width - 1, BGRA(255, 255, 255, 50));
|
---|
874 | SetHorizLine(0, Height - 1, Width - 1, BGRA(0, 0, 0, 10));
|
---|
875 | end;
|
---|
876 | end
|
---|
877 | else
|
---|
878 | begin
|
---|
879 | DoubleGradientAlphaFill(ABitmap, Rect(0, 3, ABitmap.Width, ABitmap.Height - 3),
|
---|
880 | BGRA(172, 185, 201), BGRA(134, 153, 178, 255),
|
---|
881 | BGRA(125, 147, 175, 255), BGRA(110, 132, 162, 255),
|
---|
882 | gdVertical, gdVertical, gdVertical, 0.5);
|
---|
883 | with ABitmap do
|
---|
884 | begin
|
---|
885 | // Top Bevel
|
---|
886 | SetHorizLine(0, 0, Width - 1, BGRA(201, 210, 221, 255));
|
---|
887 | SetHorizLine(0, 1, Width - 1, BGRA(173, 184, 200, 255));
|
---|
888 | SetHorizLine(0, 2, Width - 1, BGRA(179, 190, 205, 255));
|
---|
889 | // Bottom Bevel
|
---|
890 | SetHorizLine(0, Height - 3, Width - 1, BGRA(107, 129, 158, 255));
|
---|
891 | SetHorizLine(0, Height - 2, Width - 1, BGRA(116, 139, 170, 255));
|
---|
892 | SetHorizLine(0, Height - 1, Width - 1, BGRA(48, 54, 62, 255));
|
---|
893 | end;
|
---|
894 | end;
|
---|
895 | end;
|
---|
896 |
|
---|
897 | procedure DrawiOSBackground(ABitmap: TBGRABitmap);
|
---|
898 | var
|
---|
899 | temp: TBGRABitmap;
|
---|
900 | begin
|
---|
901 | temp := TBGRABitmap.Create(16, 1, BGRA(197, 204, 211));
|
---|
902 | with temp do
|
---|
903 | begin
|
---|
904 | SetPixel(7, 0, BGRA(203, 210, 217));
|
---|
905 | SetPixel(14, 0, BGRA(204, 211, 218));
|
---|
906 | BGRAReplace(temp, temp.FilterBlurRadial(1, rbFast));
|
---|
907 | BGRAReplace(temp, temp.FilterSharpen);
|
---|
908 | end;
|
---|
909 | ABitmap.Fill(temp);
|
---|
910 | temp.Free;
|
---|
911 | end;
|
---|
912 |
|
---|
913 | { Facebook Button }
|
---|
914 |
|
---|
915 | procedure DrawFacebookImageButton(Sender: TObject);
|
---|
916 | begin
|
---|
917 | if Sender is TBGRAImageButton then
|
---|
918 | DrawFacebookImageButton(TBGRAImageButton(Sender),
|
---|
919 | ColorToBGRA(ColorToRGB(TBGRAImageButton(Sender).Color), 255));
|
---|
920 | end;
|
---|
921 |
|
---|
922 | procedure DrawFacebookImageButton(AButton: TBGRAImageButton; AclBody: TBGRAPixel);
|
---|
923 | var
|
---|
924 | temp1, temp2, temp: TBGRABitmap;
|
---|
925 | begin
|
---|
926 | AButton.Font.Color := clWhite;
|
---|
927 | temp1 := TBGRABitmap.Create(AButton.Width, AButton.Height);
|
---|
928 | DrawFacebookButton(temp1, AclBody, BGRAPixelTransparent, False);
|
---|
929 | temp2 := TBGRABitmap.Create(AButton.Width, AButton.Height);
|
---|
930 | DrawFacebookButton(temp2, AclBody, BGRAPixelTransparent, True);
|
---|
931 | temp := TBGRABitmap.Create(AButton.Width, AButton.Height * 4);
|
---|
932 | temp.PutImage(0, 0, temp1, dmDrawWithTransparency);
|
---|
933 | temp.PutImage(0, AButton.Height, temp1, dmDrawWithTransparency);
|
---|
934 | BGRAReplace(temp1, temp1.FilterGrayScale);
|
---|
935 | temp.PutImage(0, AButton.Height * 3, temp1, dmDrawWithTransparency);
|
---|
936 | temp2.BlendImage(0, 0, temp1, boMultiply);
|
---|
937 | temp.PutImage(0, AButton.Height * 2, temp2, dmDrawWithTransparency);
|
---|
938 | AButton.Bitmap := temp.Bitmap;
|
---|
939 | temp.Free;
|
---|
940 | temp1.Free;
|
---|
941 | temp2.Free;
|
---|
942 | end;
|
---|
943 |
|
---|
944 | procedure DrawFacebookButton(ABitmap: TBGRABitmap; AclBody, AclBackground: TBGRAPixel;
|
---|
945 | Pressed: boolean);
|
---|
946 | begin
|
---|
947 | ABitmap.Fill(AclBackground);
|
---|
948 | if not Pressed then
|
---|
949 | DrawFacebookButtonNormal(ABitmap, AclBody, BGRA(0, 0, 0, 150),
|
---|
950 | BGRA(0, 0, 0, 100), BGRA(255, 255, 255, 50), BGRA(0, 0, 0, 50))
|
---|
951 | else
|
---|
952 | DrawFacebookButtonPressed(ABitmap, AclBody, BGRA(0, 0, 0, 150), BGRA(0, 0, 0, 100));
|
---|
953 | end;
|
---|
954 |
|
---|
955 | procedure DrawFacebookButtonNormal(ABitmap: TBGRABitmap;
|
---|
956 | AclBody, AclBorder, AclBorderDark, AclLight, AclShadow: TBGRAPixel);
|
---|
957 | begin
|
---|
958 | with ABitmap do
|
---|
959 | begin
|
---|
960 | Rectangle(0, 0, Width, Height - 1, AclBody, AclBody, dmDrawWithTransparency);
|
---|
961 | Rectangle(0, 0, Width, Height - 1, AclBorder, BGRAPixelTransparent,
|
---|
962 | dmDrawWithTransparency);
|
---|
963 | DrawHorizLine(1, 1, Width - 2, AclLight);
|
---|
964 | DrawHorizLine(1, Height - 2, Width, AclBorderDark);
|
---|
965 | DrawHorizLine(0, Height - 1, Width, AclShadow);
|
---|
966 | end;
|
---|
967 | end;
|
---|
968 |
|
---|
969 | procedure DrawFacebookButtonPressed(ABitmap: TBGRABitmap;
|
---|
970 | AclBody, AclBorder, AclShadow: TBGRAPixel);
|
---|
971 | begin
|
---|
972 | with ABitmap do
|
---|
973 | begin
|
---|
974 | Rectangle(0, 0, Width, Height - 1, AclBody, AclBody, dmDrawWithTransparency);
|
---|
975 | Rectangle(0, 0, Width, Height - 1, AclBorder, BGRAPixelTransparent,
|
---|
976 | dmDrawWithTransparency);
|
---|
977 | DrawHorizLine(0, Height - 1, Width, AclShadow);
|
---|
978 | end;
|
---|
979 | end;
|
---|
980 |
|
---|
981 | { Silver Style }
|
---|
982 |
|
---|
983 | procedure DrawBlackToolBarButton(AButton: TBGRAButton);
|
---|
984 | begin
|
---|
985 | with AButton do
|
---|
986 | begin
|
---|
987 | TextCanvas := True;
|
---|
988 | TextShadow := False;
|
---|
989 | TextShadowOffsetX := 0;
|
---|
990 | TextShadowOffsetY := 0;
|
---|
991 | TextShadowRadius := 0;
|
---|
992 | with BorderStyle do
|
---|
993 | begin
|
---|
994 | BottomLeft := bsSquare;
|
---|
995 | BottomRight := bsSquare;
|
---|
996 | TopLeft := bsSquare;
|
---|
997 | TopRight := bsSquare;
|
---|
998 | end;
|
---|
999 | with BorderStyleDropDown do
|
---|
1000 | begin
|
---|
1001 | BottomLeft := bsSquare;
|
---|
1002 | BottomRight := bsSquare;
|
---|
1003 | TopLeft := bsSquare;
|
---|
1004 | TopRight := bsSquare;
|
---|
1005 | end;
|
---|
1006 | with BodyNormal do
|
---|
1007 | begin
|
---|
1008 | Font.Color := clSilver;
|
---|
1009 | BorderColor := RGBToColor(23, 23, 23);
|
---|
1010 | Color := RGBToColor(23, 23, 23);
|
---|
1011 | Style := bbsColor;
|
---|
1012 | end;
|
---|
1013 | with BodyHover do
|
---|
1014 | begin
|
---|
1015 | Font.Color := clWhite;
|
---|
1016 | BorderColor := RGBToColor(23, 23, 23);
|
---|
1017 | Color := RGBToColor(23, 23, 23);
|
---|
1018 | Style := bbsColor;
|
---|
1019 | end;
|
---|
1020 | with BodyClicked do
|
---|
1021 | begin
|
---|
1022 | Font.Color := clWhite;
|
---|
1023 | BorderColor := clBlack;
|
---|
1024 | Color := clBlack;
|
---|
1025 | Style := bbsColor;
|
---|
1026 | end;
|
---|
1027 | end;
|
---|
1028 | end;
|
---|
1029 |
|
---|
1030 | procedure DrawBlueBodyButton(AButton: TBGRAButton);
|
---|
1031 | begin
|
---|
1032 | with AButton do
|
---|
1033 | begin
|
---|
1034 | //TextCanvas := True;
|
---|
1035 | TextShadowColor := clBlack;
|
---|
1036 | TextShadowOffsetX := 0;
|
---|
1037 | TextShadowOffsetY := -1;
|
---|
1038 | TextShadowRadius := 0;
|
---|
1039 | RoundX := 3;
|
---|
1040 | RoundY := 3;
|
---|
1041 | with BodyNormal do
|
---|
1042 | begin
|
---|
1043 | Font.Color := clWhite;
|
---|
1044 | Font.Style := [fsBold];
|
---|
1045 | BorderColor := RGBToColor(0, 68, 135);
|
---|
1046 | Gradient1.StartColor := RGBToColor(82, 136, 189);
|
---|
1047 | Gradient1.EndColor := RGBToColor(47, 101, 154);
|
---|
1048 | Gradient1EndPercent := 100;
|
---|
1049 | LightWidth := 1;
|
---|
1050 | end;
|
---|
1051 | with BodyHover do
|
---|
1052 | begin
|
---|
1053 | Font.Color := clWhite;
|
---|
1054 | Font.Style := [fsBold];
|
---|
1055 | BorderColor := RGBToColor(0, 68, 135);
|
---|
1056 | Gradient1.StartColor := RGBToColor(82, 136, 189);
|
---|
1057 | Gradient1.EndColor := RGBToColor(47, 101, 154);
|
---|
1058 | Gradient1EndPercent := 100;
|
---|
1059 | LightWidth := 1;
|
---|
1060 | end;
|
---|
1061 | with BodyClicked do
|
---|
1062 | begin
|
---|
1063 | Font.Color := clWhite;
|
---|
1064 | Font.Style := [fsBold];
|
---|
1065 | BorderColor := RGBToColor(0, 68, 135);
|
---|
1066 | Gradient1.StartColor := RGBToColor(82, 136, 189);
|
---|
1067 | Gradient1.EndColor := RGBToColor(47, 101, 154);
|
---|
1068 | Gradient1EndPercent := 100;
|
---|
1069 | LightWidth := 1;
|
---|
1070 | LightColor := clBlack;
|
---|
1071 | end;
|
---|
1072 | end;
|
---|
1073 | end;
|
---|
1074 |
|
---|
1075 | procedure DrawGreenBodyButton(AButton: TBGRAButton);
|
---|
1076 | begin
|
---|
1077 | with AButton do
|
---|
1078 | begin
|
---|
1079 | //TextCanvas := True;
|
---|
1080 | TextShadowColor := clBlack;
|
---|
1081 | TextShadowOffsetX := 0;
|
---|
1082 | TextShadowOffsetY := -1;
|
---|
1083 | TextShadowRadius := 0;
|
---|
1084 | RoundX := 3;
|
---|
1085 | RoundY := 3;
|
---|
1086 | with BodyNormal do
|
---|
1087 | begin
|
---|
1088 | Font.Color := clWhite;
|
---|
1089 | Font.Style := [fsBold];
|
---|
1090 | BorderColor := RGBToColor(45, 82, 0);
|
---|
1091 | Gradient1.StartColor := RGBToColor(131, 184, 66);
|
---|
1092 | Gradient1.EndColor := RGBToColor(98, 151, 33);
|
---|
1093 | Gradient1EndPercent := 100;
|
---|
1094 | LightWidth := 1;
|
---|
1095 | end;
|
---|
1096 | with BodyHover do
|
---|
1097 | begin
|
---|
1098 | Font.Color := clWhite;
|
---|
1099 | Font.Style := [fsBold];
|
---|
1100 | BorderColor := RGBToColor(45, 82, 0);
|
---|
1101 | Gradient1.StartColor := RGBToColor(131, 184, 66);
|
---|
1102 | Gradient1.EndColor := RGBToColor(98, 151, 33);
|
---|
1103 | Gradient1EndPercent := 100;
|
---|
1104 | LightWidth := 1;
|
---|
1105 | end;
|
---|
1106 | with BodyClicked do
|
---|
1107 | begin
|
---|
1108 | Font.Color := clWhite;
|
---|
1109 | Font.Style := [fsBold];
|
---|
1110 | BorderColor := RGBToColor(45, 82, 0);
|
---|
1111 | Gradient1.StartColor := RGBToColor(131, 184, 66);
|
---|
1112 | Gradient1.EndColor := RGBToColor(98, 151, 33);
|
---|
1113 | Gradient1EndPercent := 100;
|
---|
1114 | LightWidth := 1;
|
---|
1115 | LightColor := clBlack;
|
---|
1116 | end;
|
---|
1117 | end;
|
---|
1118 | end;
|
---|
1119 |
|
---|
1120 | procedure DrawSilverBodyButton(AButton: TBGRAButton);
|
---|
1121 | begin
|
---|
1122 | with AButton do
|
---|
1123 | begin
|
---|
1124 | //TextCanvas := True;
|
---|
1125 | TextShadowColor := clWhite;
|
---|
1126 | TextShadowOffsetX := 0;
|
---|
1127 | TextShadowOffsetY := 1;
|
---|
1128 | TextShadowRadius := 0;
|
---|
1129 | RoundX := 3;
|
---|
1130 | RoundY := 3;
|
---|
1131 | with BodyNormal do
|
---|
1132 | begin
|
---|
1133 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1134 | Font.Style := [fsBold];
|
---|
1135 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1136 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1137 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1138 | Gradient1EndPercent := 100;
|
---|
1139 | LightWidth := 1;
|
---|
1140 | LightOpacity := 175;
|
---|
1141 | end;
|
---|
1142 | with BodyHover do
|
---|
1143 | begin
|
---|
1144 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1145 | Font.Style := [fsBold];
|
---|
1146 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1147 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1148 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1149 | Gradient1EndPercent := 100;
|
---|
1150 | LightWidth := 1;
|
---|
1151 | LightOpacity := 175;
|
---|
1152 | end;
|
---|
1153 | with BodyClicked do
|
---|
1154 | begin
|
---|
1155 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1156 | Font.Style := [fsBold];
|
---|
1157 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1158 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1159 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1160 | Gradient1EndPercent := 100;
|
---|
1161 | LightWidth := 1;
|
---|
1162 | LightColor := clBlack;
|
---|
1163 | end;
|
---|
1164 | end;
|
---|
1165 | end;
|
---|
1166 |
|
---|
1167 | procedure DrawSilverBodyButtonDropDown(AButton: TBGRAButton);
|
---|
1168 | begin
|
---|
1169 | with AButton do
|
---|
1170 | begin
|
---|
1171 | //TextCanvas := True;
|
---|
1172 | TextShadowColor := clWhite;
|
---|
1173 | TextShadowOffsetX := 0;
|
---|
1174 | TextShadowOffsetY := 1;
|
---|
1175 | TextShadowRadius := 0;
|
---|
1176 | RoundX := 3;
|
---|
1177 | RoundY := 3;
|
---|
1178 | with BorderStyle do
|
---|
1179 | begin
|
---|
1180 | BottomRight := bsSquare;
|
---|
1181 | TopRight := bsSquare;
|
---|
1182 | end;
|
---|
1183 | with BorderStyleDropDown do
|
---|
1184 | begin
|
---|
1185 | BottomLeft := bsSquare;
|
---|
1186 | TopLeft := bsSquare;
|
---|
1187 | end;
|
---|
1188 | with BodyNormal do
|
---|
1189 | begin
|
---|
1190 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1191 | Font.Style := [fsBold];
|
---|
1192 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1193 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1194 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1195 | Gradient1EndPercent := 100;
|
---|
1196 | LightWidth := 1;
|
---|
1197 | LightOpacity := 175;
|
---|
1198 | end;
|
---|
1199 | with BodyHover do
|
---|
1200 | begin
|
---|
1201 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1202 | Font.Style := [fsBold];
|
---|
1203 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1204 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1205 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1206 | Gradient1EndPercent := 100;
|
---|
1207 | LightWidth := 1;
|
---|
1208 | LightOpacity := 175;
|
---|
1209 | end;
|
---|
1210 | with BodyClicked do
|
---|
1211 | begin
|
---|
1212 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1213 | Font.Style := [fsBold];
|
---|
1214 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1215 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1216 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1217 | Gradient1EndPercent := 100;
|
---|
1218 | LightWidth := 1;
|
---|
1219 | LightColor := clBlack;
|
---|
1220 | end;
|
---|
1221 | end;
|
---|
1222 | end;
|
---|
1223 |
|
---|
1224 | procedure DrawSilverBodyButtonSquared(AButton: TBGRAButton);
|
---|
1225 | begin
|
---|
1226 | with AButton do
|
---|
1227 | begin
|
---|
1228 | //TextCanvas := True;
|
---|
1229 | TextShadowColor := clWhite;
|
---|
1230 | TextShadowOffsetX := 0;
|
---|
1231 | TextShadowOffsetY := 1;
|
---|
1232 | TextShadowRadius := 0;
|
---|
1233 | RoundX := 3;
|
---|
1234 | RoundY := 3;
|
---|
1235 | with BorderStyle do
|
---|
1236 | begin
|
---|
1237 | BottomLeft := bsSquare;
|
---|
1238 | BottomRight := bsSquare;
|
---|
1239 | TopLeft := bsSquare;
|
---|
1240 | TopRight := bsSquare;
|
---|
1241 | end;
|
---|
1242 | with BorderStyleDropDown do
|
---|
1243 | begin
|
---|
1244 | BottomLeft := bsSquare;
|
---|
1245 | BottomRight := bsSquare;
|
---|
1246 | TopLeft := bsSquare;
|
---|
1247 | TopRight := bsSquare;
|
---|
1248 | end;
|
---|
1249 | with BodyNormal do
|
---|
1250 | begin
|
---|
1251 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1252 | Font.Style := [fsBold];
|
---|
1253 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1254 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1255 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1256 | Gradient1EndPercent := 100;
|
---|
1257 | LightWidth := 1;
|
---|
1258 | LightOpacity := 175;
|
---|
1259 | end;
|
---|
1260 | with BodyHover do
|
---|
1261 | begin
|
---|
1262 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1263 | Font.Style := [fsBold];
|
---|
1264 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1265 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1266 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1267 | Gradient1EndPercent := 100;
|
---|
1268 | LightWidth := 1;
|
---|
1269 | LightOpacity := 175;
|
---|
1270 | end;
|
---|
1271 | with BodyClicked do
|
---|
1272 | begin
|
---|
1273 | Font.Color := RGBToColor(91, 99, 106);
|
---|
1274 | Font.Style := [fsBold];
|
---|
1275 | BorderColor := RGBToColor(163, 166, 168);
|
---|
1276 | Gradient1.StartColor := RGBToColor(235, 239, 242);
|
---|
1277 | Gradient1.EndColor := RGBToColor(213, 217, 220);
|
---|
1278 | Gradient1EndPercent := 100;
|
---|
1279 | LightWidth := 1;
|
---|
1280 | LightColor := clBlack;
|
---|
1281 | end;
|
---|
1282 | end;
|
---|
1283 | end;
|
---|
1284 |
|
---|
1285 | procedure DrawSilverToolBar(ABitmap: TBGRABitmap);
|
---|
1286 | begin
|
---|
1287 | with ABitmap do
|
---|
1288 | begin
|
---|
1289 | GradientFill(0, 0, Width, Height,
|
---|
1290 | BGRA(233, 236, 240, 255), BGRA(218, 221, 225, 255), gtLinear,
|
---|
1291 | PointF(0, 0), PointF(0, Height), dmSet);
|
---|
1292 | SetHorizLine(0, 0, Width - 1, BGRA(191, 195, 199, 255));
|
---|
1293 | SetHorizLine(0, 1, Width - 1, BGRA(253, 254, 254, 255));
|
---|
1294 | SetHorizLine(0, Height - 1, Width - 1, BGRA(191, 195, 199, 255));
|
---|
1295 | end;
|
---|
1296 | end;
|
---|
1297 |
|
---|
1298 | procedure DrawSilverStatusBar(ABitmap: TBGRABitmap);
|
---|
1299 | begin
|
---|
1300 | with ABitmap do
|
---|
1301 | begin
|
---|
1302 | Fill(BGRA(228, 232, 236, 255));
|
---|
1303 | SetHorizLine(0, 0, Width - 1, BGRA(211, 215, 220, 255));
|
---|
1304 | end;
|
---|
1305 | end;
|
---|
1306 |
|
---|
1307 | end.
|
---|
1308 |
|
---|