1 // SPDX-License-Identifier: LGPL-3.0-only (modified to allow linking)
2 {******************************* CONTRIBUTOR(S) ******************************
3 - Edivando S. Santos Brasil | mailedivando@gmail.com
4   (Compatibility with delphi VCL 11/2018)
5 
6 ***************************** END CONTRIBUTOR(S) *****************************}
7 unit BCSamples;
8 
9 {$I bgracontrols.inc}
10 
11 interface
12 
13 uses
14   Classes, Controls, Graphics,
15   {$IFDEF FPC}LCLProc, LCLType, LazUTF8,{$ENDIF}
16   StdCtrls, BCButton, BCButtonFocus, BCTypes,
17   {$IFNDEF FPC}Types, Windows, Sysutils, BGRAGraphics, GraphType, FPImage, {$ENDIF}
18   BGRABitmap, BGRABitmapTypes, BGRAGradients, MaterialColors, BCBrightAndContrast;
19 
20 {$IFNDEF FPC}
21 type
22   TWinControlHack = class(TWinControl);
23 {$ENDIF}
24 
25 const
26   {Accent Colors}
27   acMagenta = TColor($009700FF);
28   acPurple = TColor($00FF00A2);
29   acTeal = TColor($00A9AB00);
30   acLime = TColor($0026BF8C);
31   acBrown = TColor($000050A0);
32   acPink = TColor($00B871E6);
33   acOrange = TColor($000996F0);
34   acBlue = TColor($00E2A11B);
35   acRed = TColor($000014E5);
36   acGreen = TColor($00339933);
37   {Facebook Colors}
38   fbBlue = TColor($00AA785F);
39   fbGreen = TColor($004BA567);
40   fbGray = TColor($00F8F8F8);
41   {Windows 8 Color Scheme - Background}
42   clScheme1_Background = TColor($00252525);
43   clScheme2_Background = TColor($00252525);
44   clScheme3_Background = TColor($00252525);
45   clScheme4_Background = TColor($00252525);
46   clScheme5_Background = TColor($0000172E);
47   clScheme6_Background = TColor($0000004E);
48   clScheme7_Background = TColor($0038004E);
49   clScheme8_Background = TColor($004E002D);
50   clScheme9_Background = TColor($0068001F);
51   clScheme10_Background = TColor($004E1E00);
52   clScheme11_Background = TColor($00604D00);
53   clScheme12_Background = TColor($00004A00);
54   clScheme13_Background = TColor($002A9915);
55   clScheme14_Background = TColor($00196CE5);
56   clScheme15_Background = TColor($001B1BB8);
57   clScheme16_Background = TColor($006C1BB8);
58   clScheme17_Background = TColor($00B81B69);
59   clScheme18_Background = TColor($00B8581B);
60   clScheme19_Background = TColor($00E39C56);
61   clScheme20_Background = TColor($00AAAA00);
62   clScheme21_Background = TColor($001FBA83);
63   clScheme22_Background = TColor($00099DD3);
64   clScheme23_Background = TColor($00B764E0);
65   clScheme24_Background = TColor($00696969);
66   clScheme25_Background = TColor($00696969);
67   {Windows 8 Color Scheme - Selection}
68   clScheme1_Selection = TColor($0000B3F4);
69   clScheme2_Selection = TColor($0000BA78);
70   clScheme3_Selection = TColor($00EC7326);
71   clScheme4_Selection = TColor($003D11AE);
72   clScheme5_Selection = TColor($00002F63);
73   clScheme6_Selection = TColor($00001EB0);
74   clScheme7_Selection = TColor($004F00C1);
75   clScheme8_Selection = TColor($00AC0072);
76   clScheme9_Selection = TColor($00B41746);
77   clScheme10_Selection = TColor($00C16A00);
78   clScheme11_Selection = TColor($00878200);
79   clScheme12_Selection = TColor($00009919);
80   clScheme13_Selection = TColor($003FC100);
81   clScheme14_Selection = TColor($001D98FF);
82   clScheme15_Selection = TColor($00122EFF);
83   clScheme16_Selection = TColor($00771DFF);
84   clScheme17_Selection = TColor($00FF40AA);
85   clScheme18_Selection = TColor($00FFAE1F);
86   clScheme19_Selection = TColor($00FFC556);
87   clScheme20_Selection = TColor($00CCD800);
88   clScheme21_Selection = TColor($0000D191);
89   clScheme22_Selection = TColor($0000B7E1);
90   clScheme23_Selection = TColor($00BC76FF);
91   clScheme24_Selection = TColor($00A4A400);
92   clScheme25_Selection = TColor($00237DFF);
93 
94 type
95   TBCSampleStyle = (ssDefault, ssWindows7, ssWindows7ToolBar, ssOffice2010,
96     ssFlashPlayer, ssMacOSXLion, ssWindows8_1, ssWindows8_2, ssWindows8_3,
97     ssWindows8_4, ssWindows8_5, ssWindows8_6, ssWindows8_7, ssWindows8_8,
98     ssWindows8_9, ssWindows8_10, ssWindows8_11, ssWindows8_12, ssWindows8_13,
99     ssWindows8_14, ssWindows8_15, ssWindows8_16, ssWindows8_17, ssWindows8_18,
100     ssWindows8_19, ssWindows8_20, ssWindows8_21, ssWindows8_22, ssWindows8_23,
101     ssWindows8_24, ssWindows8_25, ssMaterialRed, ssMaterialPink, ssMaterialPurple,
102     ssMaterialDeepPurple, ssMaterialIndigo, ssMaterialBlue, ssMaterialLightBlue,
103     ssMaterialCyan, ssMaterialTeal, ssMaterialGreen, ssMaterialLightGreen,
104     ssMaterialLime, ssMaterialYellow, ssMaterialAmber, ssMaterialOrange,
105     ssMaterialDeepOrange, ssMaterialBrown, ssMaterialGrey, ssMaterialBlueGrey);
106 
107   TBCSampleDrawing = (sdDefault, sdFlashPlayerBody, sdFlashPlayerButtonPanel,
108     sdWindows7Toolbar, sdiOSBar, sdiOSToolBar, sdiOSBackground,
109     sdWindows8_1, sdWindows8_2, sdWindows8_3,
110     sdWindows8_4, sdWindows8_5, sdWindows8_6, sdWindows8_7, sdWindows8_8,
111     sdWindows8_9, sdWindows8_10, sdWindows8_11, sdWindows8_12, sdWindows8_13,
112     sdWindows8_14, sdWindows8_15, sdWindows8_16, sdWindows8_17, sdWindows8_18,
113     sdWindows8_19, sdWindows8_20, sdWindows8_21, sdWindows8_22, sdWindows8_23,
114     sdWindows8_24, sdWindows8_25);
115 
116 const
117   BCSampleStyleStr: array[TBCSampleStyle] of string =
118     ('Default', 'Windows 7', 'Windows 7 ToolBar', 'Office 2010',
119     'Flash Player', 'Mac OSX Lion', 'Windows 8 Scheme 1', 'Windows 8 Scheme 2',
120     'Windows 8 Scheme 3', 'Windows 8 Scheme 4', 'Windows 8 Scheme 5'
121     , 'Windows 8 Scheme 6', 'Windows 8 Scheme 7', 'Windows 8 Scheme 8'
122     , 'Windows 8 Scheme 9', 'Windows 8 Scheme 10', 'Windows 8 Scheme 11'
123     , 'Windows 8 Scheme 12', 'Windows 8 Scheme 13', 'Windows 8 Scheme 14'
124     , 'Windows 8 Scheme 15', 'Windows 8 Scheme 16', 'Windows 8 Scheme 17'
125     , 'Windows 8 Scheme 18', 'Windows 8 Scheme 19', 'Windows 8 Scheme 20'
126     , 'Windows 8 Scheme 21', 'Windows 8 Scheme 22', 'Windows 8 Scheme 23'
127     , 'Windows 8 Scheme 24', 'Windows 8 Scheme 25', 'Material Red', 'Material Pink',
128     'Material Purple', 'Material Deep Purple', 'Material Indigo', 'Material Blue',
129     'Material Light Blue', 'Material Cyan', 'Material Teal', 'Material Green',
130     'Material Light Green', 'Material Lime', 'Material Yellow', 'Material Amber',
131     'Material Orange', 'Material Deep Orange', 'Material Brown', 'Material Grey',
132     'Material Blue Grey');
133 
134   BCSampleDrawingStr: array[TBCSampleDrawing] of string =
135     ('Default', 'Flash Player Body', 'Flash Player Button Panel',
136     'Windows 7 ToolBar', 'iOS Bar', 'iOS ToolBar', 'iOS Background',
137     'Windows 8 Scheme 1', 'Windows 8 Scheme 2',
138     'Windows 8 Scheme 3', 'Windows 8 Scheme 4', 'Windows 8 Scheme 5'
139     , 'Windows 8 Scheme 6', 'Windows 8 Scheme 7', 'Windows 8 Scheme 8'
140     , 'Windows 8 Scheme 9', 'Windows 8 Scheme 10', 'Windows 8 Scheme 11'
141     , 'Windows 8 Scheme 12', 'Windows 8 Scheme 13', 'Windows 8 Scheme 14'
142     , 'Windows 8 Scheme 15', 'Windows 8 Scheme 16', 'Windows 8 Scheme 17'
143     , 'Windows 8 Scheme 18', 'Windows 8 Scheme 19', 'Windows 8 Scheme 20'
144     , 'Windows 8 Scheme 21', 'Windows 8 Scheme 22', 'Windows 8 Scheme 23'
145     , 'Windows 8 Scheme 24', 'Windows 8 Scheme 25');
146 
StrToTBCSampleStylenull147 function StrToTBCSampleStyle(const s: ansistring): TBCSampleStyle;
148 procedure BCSampleStyleStrList(s: TStrings);
149 
StrToTBCSampleDrawingnull150 function StrToTBCSampleDrawing(const s: ansistring): TBCSampleDrawing;
151 procedure BCSampleDrawingStrList(s: TStrings);
152 
153 procedure StyleButtons(AControl: TControl; AButton: TBCButton); overload;
154 procedure StyleButtons(AControl: TControl; AButton: TBCButtonFocus); overload;
155 procedure StyleButtonsSample(AControl: TControl; AStyle: TBCSampleStyle);
156 procedure StyleButtonsFocusSample(AControl: TControl; AStyle: TBCSampleStyle);
157 
158 procedure DrawSample(ABitmap: TBGRABitmap; Element: TBCSampleDrawing;
159   Align: TAlign = alNone); overload;
DrawSamplenull160 function DrawSample(AWidth, AHeight: integer; Element: TBCSampleDrawing;
161   Align: TAlign = alNone): TBGRABitmap; overload;
162 procedure DrawItem(Control: TWinControl; Index: integer; ARect: TRect;
163   State: TOwnerDrawState; Style: TBCSampleDrawing);
164 
165 { Buttons }
166 procedure BCButtonWindows7(AButton: TBCButton); overload;
167 procedure BCButtonWindows7ToolBar(AButton: TBCButton); overload;
168 procedure BCButtonOffice2010(AButton: TBCButton); overload;
169 procedure BCButtonFlashPlayer(AButton: TBCButton); overload;
170 procedure BCButtonMacOSXLion(AButton: TBCButton); overload;
171 procedure BCButtonWindows8(AButton: TBCButton; cl1, cl2: TColor; rounding: integer = 1); overload;
172 
173 procedure BCButtonWindows7(AButton: TBCButtonFocus); overload;
174 procedure BCButtonWindows7ToolBar(AButton: TBCButtonFocus);overload;
175 procedure BCButtonOffice2010(AButton: TBCButtonFocus);overload;
176 procedure BCButtonFlashPlayer(AButton: TBCButtonFocus);overload;
177 procedure BCButtonMacOSXLion(AButton: TBCButtonFocus);overload;
178 procedure BCButtonWindows8(AButton: TBCButtonFocus; cl1, cl2: TColor;
179   rounding: integer = 1); overload;
180 
181 { Drawings }
182 procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
183 procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
184 procedure DrawWindows7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign;
185   Smooth: boolean = False);
186 procedure DrawiOSBar(ABitmap: TBGRABitmap);
187 procedure DrawiOSToolBar(ABitmap: TBGRABitmap; Shadow: boolean = True);
188 procedure DrawiOSBackground(ABitmap: TBGRABitmap);
189 procedure DrawWindows8Background(ABitmap: TBGRABitmap; {%H-}cl1, cl2: TColor);
190 
191 implementation
192 
StrToTBCSampleStylenull193 function StrToTBCSampleStyle(const s: ansistring): TBCSampleStyle;
194 var
195   ss: TBCSampleStyle;
196   ls: ansistring;
197 begin
198   Result := ssDefault;
199   ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
200   for ss := low(TBCSampleStyle) to high(TBCSampleStyle) do
201     if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(BCSampleStyleStr[ss]) then
202     begin
203       Result := ss;
204       break;
205     end;
206 end;
207 
208 procedure BCSampleStyleStrList(s: TStrings);
209 var
210   ss: TBCSampleStyle;
211 begin
212   for ss := low(TBCSampleStyle) to high(TBCSampleStyle) do
213     s.Add(BCSampleStyleStr[ss]);
214 end;
215 
216 procedure StyleButtons(AControl: TControl; AButton: TBCButton);
217 var
218   i: integer;
219   WinControl: TWinControl;
220 begin
221   if AControl is TBCButton then
222     with AControl as TBCButton do
223     begin
224       // Those are recomended properties to keep unchanged
225       AButton.Glyph := Glyph;
226       AButton.GlyphMargin := GlyphMargin;
227       AButton.StaticButton := StaticButton;
228       AButton.Down := Down;
229       AButton.Style := Style;
230       Assign(AButton);
231     end;
232   if AControl is TWinControl then
233   begin
234     WinControl := TWinControl(AControl);
235     if WinControl.ControlCount = 0 then
236       exit;
237     for i := 0 to WinControl.ControlCount - 1 do
238       StyleButtons(WinControl.Controls[i], AButton);
239   end;
240 end;
241 
242 procedure StyleButtons(AControl: TControl; AButton: TBCButtonFocus);
243 var
244   i: integer;
245   WinControl: TWinControl;
246 begin
247   if AControl is TBCButtonFocus then
248     with AControl as TBCButtonFocus do
249     begin
250       // Those are recomended properties to keep unchanged
251       AButton.Glyph := Glyph;
252       AButton.GlyphMargin := GlyphMargin;
253       AButton.StaticButton := StaticButton;
254       AButton.Down := Down;
255       AButton.Style := Style;
256       Assign(AButton);
257     end;
258   if AControl is TWinControl then
259   begin
260     WinControl := TWinControl(AControl);
261     if WinControl.ControlCount = 0 then
262       exit;
263     for i := 0 to WinControl.ControlCount - 1 do
264       StyleButtons(WinControl.Controls[i], AButton);
265   end;
266 end;
267 
268 procedure StyleButtonsSample(AControl: TControl; AStyle: TBCSampleStyle);
269 var
270   temp: TBCButton;
271 begin
272   temp := TBCButton.Create(nil);
273   case AStyle of
274     ssWindows7: BCButtonWindows7(temp);
275     ssWindows7ToolBar: BCButtonWindows7ToolBar(temp);
276     ssOffice2010: BCButtonOffice2010(temp);
277     ssFlashPlayer: BCButtonFlashPlayer(temp);
278     ssMacOSXLion: BCButtonMacOSXLion(temp);
279     ssWindows8_1: BCButtonWindows8(temp, clScheme1_Background, clScheme1_Selection);
280     ssWindows8_2: BCButtonWindows8(temp, clScheme2_Background, clScheme2_Selection);
281     ssWindows8_3: BCButtonWindows8(temp, clScheme3_Background, clScheme3_Selection);
282     ssWindows8_4: BCButtonWindows8(temp, clScheme4_Background, clScheme4_Selection);
283     ssWindows8_5: BCButtonWindows8(temp, clScheme5_Background, clScheme5_Selection);
284     ssWindows8_6: BCButtonWindows8(temp, clScheme6_Background, clScheme6_Selection);
285     ssWindows8_7: BCButtonWindows8(temp, clScheme7_Background, clScheme7_Selection);
286     ssWindows8_8: BCButtonWindows8(temp, clScheme8_Background, clScheme8_Selection);
287     ssWindows8_9: BCButtonWindows8(temp, clScheme9_Background, clScheme9_Selection);
288     ssWindows8_10: BCButtonWindows8(temp, clScheme10_Background, clScheme10_Selection);
289     ssWindows8_11: BCButtonWindows8(temp, clScheme11_Background, clScheme11_Selection);
290     ssWindows8_12: BCButtonWindows8(temp, clScheme12_Background, clScheme12_Selection);
291     ssWindows8_13: BCButtonWindows8(temp, clScheme13_Background, clScheme13_Selection);
292     ssWindows8_14: BCButtonWindows8(temp, clScheme14_Background, clScheme14_Selection);
293     ssWindows8_15: BCButtonWindows8(temp, clScheme15_Background, clScheme15_Selection);
294     ssWindows8_16: BCButtonWindows8(temp, clScheme16_Background, clScheme16_Selection);
295     ssWindows8_17: BCButtonWindows8(temp, clScheme17_Background, clScheme17_Selection);
296     ssWindows8_18: BCButtonWindows8(temp, clScheme18_Background, clScheme18_Selection);
297     ssWindows8_19: BCButtonWindows8(temp, clScheme19_Background, clScheme19_Selection);
298     ssWindows8_20: BCButtonWindows8(temp, clScheme20_Background, clScheme20_Selection);
299     ssWindows8_21: BCButtonWindows8(temp, clScheme21_Background, clScheme21_Selection);
300     ssWindows8_22: BCButtonWindows8(temp, clScheme22_Background, clScheme22_Selection);
301     ssWindows8_23: BCButtonWindows8(temp, clScheme23_Background, clScheme23_Selection);
302     ssWindows8_24: BCButtonWindows8(temp, clScheme24_Background, clScheme24_Selection);
303     ssWindows8_25: BCButtonWindows8(temp, clScheme25_Background, clScheme25_Selection);
304     ssMaterialRed: BCButtonWindows8(temp, MaterialRed.M500, MaterialRed.M300, 5);
305     ssMaterialPink: BCButtonWindows8(temp, MaterialPink.M500, MaterialPink.M300, 5);
306     ssMaterialPurple: BCButtonWindows8(temp, MaterialPurple.M500,
307         MaterialPurple.M300, 5);
308     ssMaterialDeepPurple: BCButtonWindows8(temp, MaterialDeepPurple.M500,
309         MaterialDeepPurple.M300, 5);
310     ssMaterialIndigo: BCButtonWindows8(temp, MaterialIndigo.M500,
311         MaterialIndigo.M300, 5);
312     ssMaterialBlue: BCButtonWindows8(temp, MaterialBlue.M500, MaterialBlue.M300, 5);
313     ssMaterialLightBlue: BCButtonWindows8(temp, MaterialLightBlue.M500,
314         MaterialLightBlue.M300, 5);
315     ssMaterialCyan: BCButtonWindows8(temp, MaterialCyan.M500, MaterialCyan.M300, 5);
316     ssMaterialTeal: BCButtonWindows8(temp, MaterialTeal.M500, MaterialTeal.M300, 5);
317     ssMaterialGreen: BCButtonWindows8(temp, MaterialGreen.M500, MaterialGreen.M300, 5);
318     ssMaterialLightGreen: BCButtonWindows8(temp, MaterialLightGreen.M500,
319         MaterialLightGreen.M300, 5);
320     ssMaterialLime: BCButtonWindows8(temp, MaterialLime.M500, MaterialLime.M300, 5);
321     ssMaterialYellow: BCButtonWindows8(temp, MaterialYellow.M500,
322         MaterialYellow.M300, 5);
323     ssMaterialAmber: BCButtonWindows8(temp, MaterialAmber.M500, MaterialAmber.M300, 5);
324     ssMaterialOrange: BCButtonWindows8(temp, MaterialOrange.M500,
325         MaterialOrange.M300, 5);
326     ssMaterialDeepOrange: BCButtonWindows8(temp, MaterialDeepOrange.M500,
327         MaterialDeepOrange.M300, 5);
328     ssMaterialBrown: BCButtonWindows8(temp, MaterialBrown.M500, MaterialBrown.M300, 5);
329     ssMaterialGrey: BCButtonWindows8(temp, MaterialGrey.M500, MaterialGrey.M300, 5);
330     ssMaterialBlueGrey: BCButtonWindows8(temp, MaterialBlueGrey.M500,
331         MaterialBlueGrey.M300, 5);
332   end;
333   StyleButtons(AControl, temp);
334   temp.Free;
335 end;
336 
337 procedure StyleButtonsFocusSample(AControl: TControl; AStyle: TBCSampleStyle);
338 var
339   temp: TBCButtonFocus;
340 begin
341   temp := TBCButtonFocus.Create(nil);
342   case AStyle of
343     ssWindows7: BCButtonWindows7(temp);
344     ssWindows7ToolBar: BCButtonWindows7ToolBar(temp);
345     ssOffice2010: BCButtonOffice2010(temp);
346     ssFlashPlayer: BCButtonFlashPlayer(temp);
347     ssMacOSXLion: BCButtonMacOSXLion(temp);
348     ssWindows8_1: BCButtonWindows8(temp, clScheme1_Background, clScheme1_Selection);
349     ssWindows8_2: BCButtonWindows8(temp, clScheme2_Background, clScheme2_Selection);
350     ssWindows8_3: BCButtonWindows8(temp, clScheme3_Background, clScheme3_Selection);
351     ssWindows8_4: BCButtonWindows8(temp, clScheme4_Background, clScheme4_Selection);
352     ssWindows8_5: BCButtonWindows8(temp, clScheme5_Background, clScheme5_Selection);
353     ssWindows8_6: BCButtonWindows8(temp, clScheme6_Background, clScheme6_Selection);
354     ssWindows8_7: BCButtonWindows8(temp, clScheme7_Background, clScheme7_Selection);
355     ssWindows8_8: BCButtonWindows8(temp, clScheme8_Background, clScheme8_Selection);
356     ssWindows8_9: BCButtonWindows8(temp, clScheme9_Background, clScheme9_Selection);
357     ssWindows8_10: BCButtonWindows8(temp, clScheme10_Background, clScheme10_Selection);
358     ssWindows8_11: BCButtonWindows8(temp, clScheme11_Background, clScheme11_Selection);
359     ssWindows8_12: BCButtonWindows8(temp, clScheme12_Background, clScheme12_Selection);
360     ssWindows8_13: BCButtonWindows8(temp, clScheme13_Background, clScheme13_Selection);
361     ssWindows8_14: BCButtonWindows8(temp, clScheme14_Background, clScheme14_Selection);
362     ssWindows8_15: BCButtonWindows8(temp, clScheme15_Background, clScheme15_Selection);
363     ssWindows8_16: BCButtonWindows8(temp, clScheme16_Background, clScheme16_Selection);
364     ssWindows8_17: BCButtonWindows8(temp, clScheme17_Background, clScheme17_Selection);
365     ssWindows8_18: BCButtonWindows8(temp, clScheme18_Background, clScheme18_Selection);
366     ssWindows8_19: BCButtonWindows8(temp, clScheme19_Background, clScheme19_Selection);
367     ssWindows8_20: BCButtonWindows8(temp, clScheme20_Background, clScheme20_Selection);
368     ssWindows8_21: BCButtonWindows8(temp, clScheme21_Background, clScheme21_Selection);
369     ssWindows8_22: BCButtonWindows8(temp, clScheme22_Background, clScheme22_Selection);
370     ssWindows8_23: BCButtonWindows8(temp, clScheme23_Background, clScheme23_Selection);
371     ssWindows8_24: BCButtonWindows8(temp, clScheme24_Background, clScheme24_Selection);
372     ssWindows8_25: BCButtonWindows8(temp, clScheme25_Background, clScheme25_Selection);
373     ssMaterialRed: BCButtonWindows8(temp, MaterialRed.M500, MaterialRed.M300, 5);
374     ssMaterialPink: BCButtonWindows8(temp, MaterialPink.M500, MaterialPink.M300, 5);
375     ssMaterialPurple: BCButtonWindows8(temp, MaterialPurple.M500,
376         MaterialPurple.M300, 5);
377     ssMaterialDeepPurple: BCButtonWindows8(temp, MaterialDeepPurple.M500,
378         MaterialDeepPurple.M300, 5);
379     ssMaterialIndigo: BCButtonWindows8(temp, MaterialIndigo.M500,
380         MaterialIndigo.M300, 5);
381     ssMaterialBlue: BCButtonWindows8(temp, MaterialBlue.M500, MaterialBlue.M300, 5);
382     ssMaterialLightBlue: BCButtonWindows8(temp, MaterialLightBlue.M500,
383         MaterialLightBlue.M300, 5);
384     ssMaterialCyan: BCButtonWindows8(temp, MaterialCyan.M500, MaterialCyan.M300, 5);
385     ssMaterialTeal: BCButtonWindows8(temp, MaterialTeal.M500, MaterialTeal.M300, 5);
386     ssMaterialGreen: BCButtonWindows8(temp, MaterialGreen.M500, MaterialGreen.M300, 5);
387     ssMaterialLightGreen: BCButtonWindows8(temp, MaterialLightGreen.M500,
388         MaterialLightGreen.M300, 5);
389     ssMaterialLime: BCButtonWindows8(temp, MaterialLime.M500, MaterialLime.M300, 5);
390     ssMaterialYellow: BCButtonWindows8(temp, MaterialYellow.M500,
391         MaterialYellow.M300, 5);
392     ssMaterialAmber: BCButtonWindows8(temp, MaterialAmber.M500, MaterialAmber.M300, 5);
393     ssMaterialOrange: BCButtonWindows8(temp, MaterialOrange.M500,
394         MaterialOrange.M300, 5);
395     ssMaterialDeepOrange: BCButtonWindows8(temp, MaterialDeepOrange.M500,
396         MaterialDeepOrange.M300, 5);
397     ssMaterialBrown: BCButtonWindows8(temp, MaterialBrown.M500, MaterialBrown.M300, 5);
398     ssMaterialGrey: BCButtonWindows8(temp, MaterialGrey.M500, MaterialGrey.M300, 5);
399     ssMaterialBlueGrey: BCButtonWindows8(temp, MaterialBlueGrey.M500,
400         MaterialBlueGrey.M300, 5);
401   end;
402   StyleButtons(AControl, temp);
403   temp.Free;
404 end;
405 
406 procedure DrawItem(Control: TWinControl; Index: integer; ARect: TRect;
407   State: TOwnerDrawState; Style: TBCSampleDrawing);
408 var
409   temp: TBGRABitmap;
410   str: string;
411 begin
412   if Control is TListBox then
413     str := TListBox(Control).Items[Index]
414   else if Control is TComboBox then
415     str := TComboBox(Control).Items[Index];
416 
417   temp := TBGRABitmap.Create(ARect.Right - ARect.Left, ARect.Bottom -
418     ARect.Top, {$IFNDEF FPC}TWinControlHack(Control).{$ELSE}Control.{$ENDIF}Color);
419 
420   temp.FontAntialias := True;
421   temp.FontHeight := 0;
422   temp.FontQuality := fqSystemClearType;
423 
424   if odSelected in State then
425     DrawSample(temp, Style, alNone);
426 
427   temp.TextOut(2, 0, {%H-}str, BGRABlack);
428 
429   if Control is TListBox then
430     temp.Draw(TListBox(Control).Canvas, ARect, False)
431   else if Control is TComboBox then
432     temp.Draw(TComboBox(Control).Canvas, ARect, False);
433 
434   temp.Free;
435 end;
436 
437 procedure BCButtonWindows7(AButton: TBCButton);
438 begin
439   AButton.Rounding.RoundX := 3;
440   AButton.Rounding.RoundY := 3;
441   AButton.RoundingDropDown.Assign(AButton.Rounding);
442 
443   with AButton.StateNormal do
444   begin
445     Background.Gradient1EndPercent := 50;
446     Background.Gradient2.Point1XPercent := 0;
447     Background.Gradient2.Point1YPercent := 0;
448     Background.Gradient2.Point2YPercent := 100;
449     Background.Gradient2.GradientType := gtLinear;
450     Border.Color := RGBToColor(112, 112, 112);
451     Border.LightWidth := 1;
452     Border.LightOpacity := 175;
453     Border.Style := bboSolid;
454     FontEx.Color := clBlack;
455     FontEx.Shadow := False;
456     FontEx.Style := [];
457   end;
458 
459   AButton.StateHover.Assign(AButton.StateNormal);
460   AButton.StateClicked.Assign(AButton.StateNormal);
461 
462   with AButton.StateNormal do
463   begin
464     Background.Gradient1.StartColor := RGBToColor(242, 242, 242);
465     Background.Gradient1.EndColor := RGBToColor(235, 235, 235);
466     Background.Gradient2.StartColor := RGBToColor(221, 221, 221);
467     Background.Gradient2.EndColor := RGBToColor(207, 207, 207);
468   end;
469 
470   with AButton.StateHover do
471   begin
472     Background.Gradient1.StartColor := RGBToColor(234, 246, 253);
473     Background.Gradient1.EndColor := RGBToColor(217, 240, 252);
474     Background.Gradient2.StartColor := RGBToColor(190, 230, 253);
475     Background.Gradient2.EndColor := RGBToColor(167, 217, 245);
476     Border.Color := RGBToColor(60, 127, 177);
477   end;
478 
479   with AButton.StateClicked do
480   begin
481     Background.Gradient1.StartColor := RGBToColor(229, 244, 252);
482     Background.Gradient1.EndColor := RGBToColor(196, 229, 246);
483     Background.Gradient2.StartColor := RGBToColor(152, 209, 239);
484     Background.Gradient2.EndColor := RGBToColor(104, 179, 219);
485     Background.Gradient1EndPercent := 55;
486     Border.Color := RGBToColor(44, 98, 139);
487     Border.LightOpacity := 100;
488     Border.LightColor := clBlack;
489   end;
490 end;
491 
492 procedure BCButtonWindows7ToolBar(AButton: TBCButton);
493 begin
494   AButton.Rounding.RoundX := 2;
495   AButton.Rounding.RoundY := 2;
496   AButton.RoundingDropDown.Assign(AButton.Rounding);
497 
498   with AButton.StateNormal do
499   begin
500     Background.Gradient1EndPercent := 50;
501     Background.Gradient2.Point1XPercent := 0;
502     Background.Gradient2.Point1YPercent := 0;
503     Background.Gradient2.Point2YPercent := 100;
504     Background.Gradient2.GradientType := gtLinear;
505     Border.Color := RGBToColor(187, 202, 219);
506     Border.LightWidth := 1;
507     Border.LightOpacity := 200;
508     Border.Style := bboSolid;
509     FontEx.Color := RGBToColor(30, 57, 91);
510     FontEx.Shadow := False;
511     FontEx.Style := [];
512   end;
513 
514   AButton.StateHover.Assign(AButton.StateNormal);
515   AButton.StateClicked.Assign(AButton.StateNormal);
516 
517   with AButton.StateNormal do
518   begin
519     Background.Gradient1.StartColor := RGBToColor(245, 250, 255);
520     Background.Gradient1.EndColor := RGBToColor(230, 240, 250);
521     Background.Gradient2.StartColor := RGBToColor(220, 230, 244);
522     Background.Gradient2.EndColor := RGBToColor(221, 233, 247);
523   end;
524 
525   with AButton.StateHover do
526   begin
527     Background.Gradient1.StartColor := RGBToColor(248, 251, 254);
528     Background.Gradient1.EndColor := RGBToColor(237, 242, 250);
529     Background.Gradient2.StartColor := RGBToColor(215, 228, 244);
530     Background.Gradient2.EndColor := RGBToColor(193, 210, 232);
531   end;
532 
533   with AButton.StateClicked do
534   begin
535     Background.Gradient1.StartColor := RGBToColor(226, 236, 245);
536     Background.Gradient1.EndColor := RGBToColor(216, 228, 241);
537     Background.Gradient2.StartColor := RGBToColor(207, 219, 236);
538     Background.Gradient2.EndColor := RGBToColor(207, 220, 237);
539   end;
540 end;
541 
542 procedure BCButtonOffice2010(AButton: TBCButton);
543 begin
544   AButton.Rounding.RoundX := 3;
545   AButton.Rounding.RoundY := 3;
546   AButton.RoundingDropDown.Assign(AButton.Rounding);
547 
548   with AButton.StateNormal do
549   begin
550     Background.Gradient1EndPercent := 50;
551     Background.Gradient2.Point1XPercent := 0;
552     Background.Gradient2.Point1YPercent := 0;
553     Background.Gradient2.Point2YPercent := 100;
554     Background.Gradient2.GradientType := gtLinear;
555     Border.Color := RGBToColor(207, 208, 210);
556     Border.LightWidth := 1;
557     Border.LightOpacity := 175;
558     Border.Style := bboSolid;
559     FontEx.Color := clBlack;
560     FontEx.Shadow := False;
561     FontEx.Style := [];
562   end;
563 
564   AButton.StateHover.Assign(AButton.StateNormal);
565   AButton.StateClicked.Assign(AButton.StateNormal);
566 
567   with AButton.StateNormal do
568   begin
569     Background.Gradient1.StartColor := RGBToColor(255, 255, 255);
570     Background.Gradient1.EndColor := RGBToColor(237, 239, 241);
571     Background.Gradient1EndPercent := 100;
572   end;
573 
574   with AButton.StateHover do
575   begin
576     Background.Gradient1.StartColor := RGBToColor(254, 241, 189);
577     Background.Gradient1.EndColor := RGBToColor(254, 228, 134);
578     Background.Gradient2.StartColor := RGBToColor(254, 228, 134);
579     Background.Gradient2.EndColor := RGBToColor(254, 248, 196);
580     Border.Color := RGBToColor(244, 210, 81);
581   end;
582 
583   with AButton.StateClicked do
584   begin
585     Background.Gradient1.StartColor := RGBToColor(255, 229, 117);
586     Background.Gradient1.EndColor := RGBToColor(255, 216, 107);
587     Background.Gradient2.StartColor := RGBToColor(255, 216, 107);
588     Background.Gradient2.EndColor := RGBToColor(255, 239, 129);
589     Border.Color := RGBToColor(194, 161, 63);
590     Border.LightWidth := 0;
591   end;
592 end;
593 
594 procedure BCButtonFlashPlayer(AButton: TBCButton);
595 begin
596   AButton.Rounding.RoundX := 1;
597   AButton.Rounding.RoundY := 1;
598   AButton.RoundingDropDown.Assign(AButton.Rounding);
599 
600   with AButton.StateNormal do
601   begin
602     Background.Gradient1EndPercent := 50;
603     Background.Gradient2.Point1XPercent := 0;
604     Background.Gradient2.Point1YPercent := 0;
605     Background.Gradient2.Point2YPercent := 100;
606     Background.Gradient2.GradientType := gtLinear;
607     Border.Color := RGBToColor(24, 24, 24);
608     Border.LightWidth := 1;
609     Border.LightOpacity := 20;
610     Border.Style := bboSolid;
611     FontEx.Color := clWhite;
612     FontEx.Shadow := True;
613     FontEx.ShadowRadius := 1;
614     FontEx.ShadowOffsetX := 1;
615     FontEx.ShadowOffsetY := 1;
616     FontEx.Style := [];
617   end;
618 
619   AButton.StateHover.Assign(AButton.StateNormal);
620   AButton.StateClicked.Assign(AButton.StateNormal);
621 
622   with AButton.StateNormal do
623   begin
624     Background.Gradient1.StartColor := RGBToColor(104, 104, 104);
625     Background.Gradient1.EndColor := RGBToColor(104, 104, 104);
626     Background.Gradient2.StartColor := RGBToColor(103, 103, 103);
627     Background.Gradient2.EndColor := RGBToColor(71, 71, 71);
628   end;
629 
630   with AButton.StateHover do
631   begin
632     Background.Gradient1.StartColor := RGBToColor(118, 118, 118);
633     Background.Gradient1.EndColor := RGBToColor(118, 118, 118);
634     Background.Gradient2.StartColor := RGBToColor(117, 117, 117);
635     Background.Gradient2.EndColor := RGBToColor(81, 81, 81);
636     Border.Color := RGBToColor(24, 24, 24);
637   end;
638 
639   with AButton.StateClicked do
640   begin
641     Background.Gradient1.StartColor := RGBToColor(92, 92, 92);
642     Background.Gradient1.EndColor := RGBToColor(92, 92, 92);
643     Background.Gradient2.StartColor := RGBToColor(91, 91, 91);
644     Background.Gradient2.EndColor := RGBToColor(62, 62, 62);
645     Background.Gradient1EndPercent := 55;
646     Border.Color := RGBToColor(24, 24, 24);
647   end;
648 end;
649 
650 procedure BCButtonMacOSXLion(AButton: TBCButton);
651 begin
652   AButton.Rounding.RoundX := 3;
653   AButton.Rounding.RoundY := 3;
654   AButton.RoundingDropDown.Assign(AButton.Rounding);
655 
656   with AButton.StateNormal do
657   begin
658     Background.Gradient1EndPercent := 50;
659     Background.Gradient2.Point1XPercent := 0;
660     Background.Gradient2.Point1YPercent := 0;
661     Background.Gradient2.Point2YPercent := 100;
662     Background.Gradient2.GradientType := gtLinear;
663     Border.Color := RGBToColor(154, 154, 154);
664     Border.LightWidth := 1;
665     Border.LightOpacity := 175;
666     Border.Style := bboSolid;
667     FontEx.Color := clBlack;
668     FontEx.Shadow := False;
669     FontEx.Style := [];
670   end;
671 
672   AButton.StateHover.Assign(AButton.StateNormal);
673   AButton.StateClicked.Assign(AButton.StateNormal);
674 
675   with AButton.StateNormal do
676   begin
677     Background.Gradient1.StartColor := RGBToColor(255, 255, 255);
678     Background.Gradient1.EndColor := RGBToColor(243, 243, 243);
679     Background.Gradient2.StartColor := RGBToColor(236, 236, 236);
680     Background.Gradient2.EndColor := RGBToColor(235, 235, 235);
681   end;
682 
683   with AButton.StateHover do
684   begin
685     Background.Gradient1.StartColor := RGBToColor(204, 229, 252);
686     Background.Gradient1.EndColor := RGBToColor(161, 209, 249);
687     Background.Gradient2.StartColor := RGBToColor(143, 202, 251);
688     Background.Gradient2.EndColor := RGBToColor(207, 245, 253);
689     Border.Color := RGBToColor(86, 87, 143);
690   end;
691 
692   with AButton.StateClicked do
693   begin
694     Background.Gradient1.StartColor := RGBToColor(144, 195, 241);
695     Background.Gradient1.EndColor := RGBToColor(113, 180, 239);
696     Background.Gradient2.StartColor := RGBToColor(97, 173, 240);
697     Background.Gradient2.EndColor := RGBToColor(147, 206, 241);
698     Background.Gradient1EndPercent := 55;
699     Border.Color := RGBToColor(86, 87, 143);
700     Border.LightWidth := 0;
701   end;
702 end;
703 
704 procedure BCButtonWindows8(AButton: TBCButton; cl1, cl2: TColor; rounding: integer = 1);
705 begin
706   AButton.Rounding.RoundX := rounding;
707   AButton.Rounding.RoundY := rounding;
708   AButton.RoundingDropDown.Assign(AButton.Rounding);
709 
710   with AButton.StateNormal do
711   begin
712     Background.Style := bbsColor;
713     Background.Color := cl1;
714     Border.Style := bboSolid;
715     Border.Width := 1;
716     Border.Color := cl1;
717     Border.LightWidth := 0;
718     Border.LightOpacity := 255;
719     Border.Style := bboSolid;
720     FontEx.Color := GetContrastColor(cl1);
721     FontEx.Shadow := False;
722     FontEx.Style := [];
723   end;
724 
725   AButton.StateHover.Assign(AButton.StateNormal);
726   AButton.StateClicked.Assign(AButton.StateNormal);
727 
728   with AButton.StateHover do
729   begin
730     Background.Color := cl2;
731     Border.Color := cl2;
732   end;
733 
734   with AButton.StateClicked do
735   begin
736     Background.Color := cl2;
737     Border.Color := cl2;
738   end;
739 end;
740 
741 procedure BCButtonWindows7(AButton: TBCButtonFocus);
742 begin
743   AButton.Rounding.RoundX := 3;
744   AButton.Rounding.RoundY := 3;
745   AButton.RoundingDropDown.Assign(AButton.Rounding);
746 
747   with AButton.StateNormal do
748   begin
749     Background.Gradient1EndPercent := 50;
750     Background.Gradient2.Point1XPercent := 0;
751     Background.Gradient2.Point1YPercent := 0;
752     Background.Gradient2.Point2YPercent := 100;
753     Background.Gradient2.GradientType := gtLinear;
754     Border.Color := RGBToColor(112, 112, 112);
755     Border.LightWidth := 1;
756     Border.LightOpacity := 175;
757     Border.Style := bboSolid;
758     FontEx.Color := clBlack;
759     FontEx.Shadow := False;
760     FontEx.Style := [];
761   end;
762 
763   AButton.StateHover.Assign(AButton.StateNormal);
764   AButton.StateClicked.Assign(AButton.StateNormal);
765 
766   with AButton.StateNormal do
767   begin
768     Background.Gradient1.StartColor := RGBToColor(242, 242, 242);
769     Background.Gradient1.EndColor := RGBToColor(235, 235, 235);
770     Background.Gradient2.StartColor := RGBToColor(221, 221, 221);
771     Background.Gradient2.EndColor := RGBToColor(207, 207, 207);
772   end;
773 
774   with AButton.StateHover do
775   begin
776     Background.Gradient1.StartColor := RGBToColor(234, 246, 253);
777     Background.Gradient1.EndColor := RGBToColor(217, 240, 252);
778     Background.Gradient2.StartColor := RGBToColor(190, 230, 253);
779     Background.Gradient2.EndColor := RGBToColor(167, 217, 245);
780     Border.Color := RGBToColor(60, 127, 177);
781   end;
782 
783   with AButton.StateClicked do
784   begin
785     Background.Gradient1.StartColor := RGBToColor(229, 244, 252);
786     Background.Gradient1.EndColor := RGBToColor(196, 229, 246);
787     Background.Gradient2.StartColor := RGBToColor(152, 209, 239);
788     Background.Gradient2.EndColor := RGBToColor(104, 179, 219);
789     Background.Gradient1EndPercent := 55;
790     Border.Color := RGBToColor(44, 98, 139);
791     Border.LightOpacity := 100;
792     Border.LightColor := clBlack;
793   end;
794 end;
795 
796 procedure BCButtonWindows7ToolBar(AButton: TBCButtonFocus);
797 begin
798   AButton.Rounding.RoundX := 2;
799   AButton.Rounding.RoundY := 2;
800   AButton.RoundingDropDown.Assign(AButton.Rounding);
801 
802   with AButton.StateNormal do
803   begin
804     Background.Gradient1EndPercent := 50;
805     Background.Gradient2.Point1XPercent := 0;
806     Background.Gradient2.Point1YPercent := 0;
807     Background.Gradient2.Point2YPercent := 100;
808     Background.Gradient2.GradientType := gtLinear;
809     Border.Color := RGBToColor(187, 202, 219);
810     Border.LightWidth := 1;
811     Border.LightOpacity := 200;
812     Border.Style := bboSolid;
813     FontEx.Color := RGBToColor(30, 57, 91);
814     FontEx.Shadow := False;
815     FontEx.Style := [];
816   end;
817 
818   AButton.StateHover.Assign(AButton.StateNormal);
819   AButton.StateClicked.Assign(AButton.StateNormal);
820 
821   with AButton.StateNormal do
822   begin
823     Background.Gradient1.StartColor := RGBToColor(245, 250, 255);
824     Background.Gradient1.EndColor := RGBToColor(230, 240, 250);
825     Background.Gradient2.StartColor := RGBToColor(220, 230, 244);
826     Background.Gradient2.EndColor := RGBToColor(221, 233, 247);
827   end;
828 
829   with AButton.StateHover do
830   begin
831     Background.Gradient1.StartColor := RGBToColor(248, 251, 254);
832     Background.Gradient1.EndColor := RGBToColor(237, 242, 250);
833     Background.Gradient2.StartColor := RGBToColor(215, 228, 244);
834     Background.Gradient2.EndColor := RGBToColor(193, 210, 232);
835   end;
836 
837   with AButton.StateClicked do
838   begin
839     Background.Gradient1.StartColor := RGBToColor(226, 236, 245);
840     Background.Gradient1.EndColor := RGBToColor(216, 228, 241);
841     Background.Gradient2.StartColor := RGBToColor(207, 219, 236);
842     Background.Gradient2.EndColor := RGBToColor(207, 220, 237);
843   end;
844 end;
845 
846 procedure BCButtonOffice2010(AButton: TBCButtonFocus);
847 begin
848   AButton.Rounding.RoundX := 3;
849   AButton.Rounding.RoundY := 3;
850   AButton.RoundingDropDown.Assign(AButton.Rounding);
851 
852   with AButton.StateNormal do
853   begin
854     Background.Gradient1EndPercent := 50;
855     Background.Gradient2.Point1XPercent := 0;
856     Background.Gradient2.Point1YPercent := 0;
857     Background.Gradient2.Point2YPercent := 100;
858     Background.Gradient2.GradientType := gtLinear;
859     Border.Color := RGBToColor(207, 208, 210);
860     Border.LightWidth := 1;
861     Border.LightOpacity := 175;
862     Border.Style := bboSolid;
863     FontEx.Color := clBlack;
864     FontEx.Shadow := False;
865     FontEx.Style := [];
866   end;
867 
868   AButton.StateHover.Assign(AButton.StateNormal);
869   AButton.StateClicked.Assign(AButton.StateNormal);
870 
871   with AButton.StateNormal do
872   begin
873     Background.Gradient1.StartColor := RGBToColor(255, 255, 255);
874     Background.Gradient1.EndColor := RGBToColor(237, 239, 241);
875     Background.Gradient1EndPercent := 100;
876   end;
877 
878   with AButton.StateHover do
879   begin
880     Background.Gradient1.StartColor := RGBToColor(254, 241, 189);
881     Background.Gradient1.EndColor := RGBToColor(254, 228, 134);
882     Background.Gradient2.StartColor := RGBToColor(254, 228, 134);
883     Background.Gradient2.EndColor := RGBToColor(254, 248, 196);
884     Border.Color := RGBToColor(244, 210, 81);
885   end;
886 
887   with AButton.StateClicked do
888   begin
889     Background.Gradient1.StartColor := RGBToColor(255, 229, 117);
890     Background.Gradient1.EndColor := RGBToColor(255, 216, 107);
891     Background.Gradient2.StartColor := RGBToColor(255, 216, 107);
892     Background.Gradient2.EndColor := RGBToColor(255, 239, 129);
893     Border.Color := RGBToColor(194, 161, 63);
894     Border.LightWidth := 0;
895   end;
896 end;
897 
898 procedure BCButtonFlashPlayer(AButton: TBCButtonFocus);
899 begin
900   AButton.Rounding.RoundX := 1;
901   AButton.Rounding.RoundY := 1;
902   AButton.RoundingDropDown.Assign(AButton.Rounding);
903 
904   with AButton.StateNormal do
905   begin
906     Background.Gradient1EndPercent := 50;
907     Background.Gradient2.Point1XPercent := 0;
908     Background.Gradient2.Point1YPercent := 0;
909     Background.Gradient2.Point2YPercent := 100;
910     Background.Gradient2.GradientType := gtLinear;
911     Border.Color := RGBToColor(24, 24, 24);
912     Border.LightWidth := 1;
913     Border.LightOpacity := 20;
914     Border.Style := bboSolid;
915     FontEx.Color := clWhite;
916     FontEx.Shadow := True;
917     FontEx.ShadowRadius := 1;
918     FontEx.ShadowOffsetX := 1;
919     FontEx.ShadowOffsetY := 1;
920     FontEx.Style := [];
921   end;
922 
923   AButton.StateHover.Assign(AButton.StateNormal);
924   AButton.StateClicked.Assign(AButton.StateNormal);
925 
926   with AButton.StateNormal do
927   begin
928     Background.Gradient1.StartColor := RGBToColor(104, 104, 104);
929     Background.Gradient1.EndColor := RGBToColor(104, 104, 104);
930     Background.Gradient2.StartColor := RGBToColor(103, 103, 103);
931     Background.Gradient2.EndColor := RGBToColor(71, 71, 71);
932   end;
933 
934   with AButton.StateHover do
935   begin
936     Background.Gradient1.StartColor := RGBToColor(118, 118, 118);
937     Background.Gradient1.EndColor := RGBToColor(118, 118, 118);
938     Background.Gradient2.StartColor := RGBToColor(117, 117, 117);
939     Background.Gradient2.EndColor := RGBToColor(81, 81, 81);
940     Border.Color := RGBToColor(24, 24, 24);
941   end;
942 
943   with AButton.StateClicked do
944   begin
945     Background.Gradient1.StartColor := RGBToColor(92, 92, 92);
946     Background.Gradient1.EndColor := RGBToColor(92, 92, 92);
947     Background.Gradient2.StartColor := RGBToColor(91, 91, 91);
948     Background.Gradient2.EndColor := RGBToColor(62, 62, 62);
949     Background.Gradient1EndPercent := 55;
950     Border.Color := RGBToColor(24, 24, 24);
951   end;
952 end;
953 
954 procedure BCButtonMacOSXLion(AButton: TBCButtonFocus);
955 begin
956   AButton.Rounding.RoundX := 3;
957   AButton.Rounding.RoundY := 3;
958   AButton.RoundingDropDown.Assign(AButton.Rounding);
959 
960   with AButton.StateNormal do
961   begin
962     Background.Gradient1EndPercent := 50;
963     Background.Gradient2.Point1XPercent := 0;
964     Background.Gradient2.Point1YPercent := 0;
965     Background.Gradient2.Point2YPercent := 100;
966     Background.Gradient2.GradientType := gtLinear;
967     Border.Color := RGBToColor(154, 154, 154);
968     Border.LightWidth := 1;
969     Border.LightOpacity := 175;
970     Border.Style := bboSolid;
971     FontEx.Color := clBlack;
972     FontEx.Shadow := False;
973     FontEx.Style := [];
974   end;
975 
976   AButton.StateHover.Assign(AButton.StateNormal);
977   AButton.StateClicked.Assign(AButton.StateNormal);
978 
979   with AButton.StateNormal do
980   begin
981     Background.Gradient1.StartColor := RGBToColor(255, 255, 255);
982     Background.Gradient1.EndColor := RGBToColor(243, 243, 243);
983     Background.Gradient2.StartColor := RGBToColor(236, 236, 236);
984     Background.Gradient2.EndColor := RGBToColor(235, 235, 235);
985   end;
986 
987   with AButton.StateHover do
988   begin
989     Background.Gradient1.StartColor := RGBToColor(204, 229, 252);
990     Background.Gradient1.EndColor := RGBToColor(161, 209, 249);
991     Background.Gradient2.StartColor := RGBToColor(143, 202, 251);
992     Background.Gradient2.EndColor := RGBToColor(207, 245, 253);
993     Border.Color := RGBToColor(86, 87, 143);
994   end;
995 
996   with AButton.StateClicked do
997   begin
998     Background.Gradient1.StartColor := RGBToColor(144, 195, 241);
999     Background.Gradient1.EndColor := RGBToColor(113, 180, 239);
1000     Background.Gradient2.StartColor := RGBToColor(97, 173, 240);
1001     Background.Gradient2.EndColor := RGBToColor(147, 206, 241);
1002     Background.Gradient1EndPercent := 55;
1003     Border.Color := RGBToColor(86, 87, 143);
1004     Border.LightWidth := 0;
1005   end;
1006 end;
1007 
1008 procedure BCButtonWindows8(AButton: TBCButtonFocus; cl1, cl2: TColor;
1009   rounding: integer = 1);
1010 begin
1011   AButton.Rounding.RoundX := rounding;
1012   AButton.Rounding.RoundY := rounding;
1013   AButton.RoundingDropDown.Assign(AButton.Rounding);
1014 
1015   with AButton.StateNormal do
1016   begin
1017     Background.Style := bbsColor;
1018     Background.Color := cl1;
1019     Border.Style := bboSolid;
1020     Border.Width := 1;
1021     Border.Color := cl1;
1022     Border.LightWidth := 0;
1023     Border.LightOpacity := 255;
1024     Border.Style := bboSolid;
1025     FontEx.Color := GetContrastColor(cl1);
1026     FontEx.Shadow := False;
1027     FontEx.Style := [];
1028   end;
1029 
1030   AButton.StateHover.Assign(AButton.StateNormal);
1031   AButton.StateClicked.Assign(AButton.StateNormal);
1032 
1033   with AButton.StateHover do
1034   begin
1035     Background.Color := cl2;
1036     Border.Color := cl2;
1037   end;
1038 
1039   with AButton.StateClicked do
1040   begin
1041     Background.Color := cl2;
1042     Border.Color := cl2;
1043   end;
1044 end;
1045 
1046 procedure DrawFlashPlayerBody(ABitmap: TBGRABitmap);
1047 begin
1048   with ABitmap do
1049   begin
1050     GradientFill(0, 0, Width, Height, BGRA(203, 19, 23, 255), BGRA(110, 3, 20, 255),
1051       gtLinear, PointF(0, 0), PointF(0, Height), dmSet);
1052     Rectangle(0, 0, Width, Height + 1, BGRA(0, 0, 0, 215), dmDrawWithTransparency);
1053   end;
1054 end;
1055 
1056 procedure DrawFlashPlayerButtonPanel(ABitmap: TBGRABitmap);
1057 begin
1058   with ABitmap do
1059   begin
1060     DrawHorizLine(0, 0, Width, BGRA(30, 30, 30, 255));
1061     DrawHorizLine(0, Height - 1, Width, BGRA(62, 62, 62, 255));
1062     Rectangle(0, 1, Width, Height - 1, BGRA(91, 91, 91, 255),
1063       BGRA(76, 76, 76, 255), dmSet);
1064   end;
1065 end;
1066 
1067 procedure DrawWindows7ToolBar(ABitmap: TBGRABitmap; ADir: TAlign;
1068   Smooth: boolean = False);
1069 var
1070   tempBmp: TBGRABitmap;
1071 begin
1072   if Smooth then
1073     tempBmp := DoubleGradientAlphaFill(Rect(0, 0, ABitmap.Width, ABitmap.Height),
1074       BGRA(245, 249, 255, 255), BGRA(222, 232, 245, 255), BGRA(220, 230, 245, 255),
1075       BGRA(222, 230, 245, 255), gdVertical, gdVertical, gdVertical, 0.50)
1076   else
1077     tempBmp := DoubleGradientAlphaFill(Rect(0, 0, ABitmap.Width, ABitmap.Height),
1078       BGRA(245, 250, 255, 255), BGRA(230, 240, 250, 255), BGRA(220, 230, 244, 255),
1079       BGRA(221, 233, 247, 255), gdVertical, gdVertical, gdVertical, 0.50);
1080 
1081   ABitmap.BlendImage(0, 0, tempBmp, boLinearBlend);
1082   tempBmp.Free;
1083 
1084   case ADir of
1085     alLeft: with ABitmap do
1086       begin
1087         if not Smooth then
1088           Rectangle(0, 0, Width - 2, Height, BGRA(255, 255, 255, 100),
1089             dmDrawWithTransparency);
1090         SetVertLine(Width - 1, 0, Height - 1, BGRA(160, 175, 195, 255));
1091         SetVertLine(Width - 2, 0, Height - 1, BGRA(205, 218, 234, 255));
1092       end;
1093     alTop: with ABitmap do
1094       begin
1095         if not Smooth then
1096           Rectangle(0, 0, Width, Height - 2, BGRA(255, 255, 255, 100),
1097             dmDrawWithTransparency);
1098         SetHorizLine(0, Height - 1, Width - 1, BGRA(160, 175, 195, 255));
1099         SetHorizLine(0, Height - 2, Width - 1, BGRA(205, 218, 234, 255));
1100       end;
1101     alRight: with ABitmap do
1102       begin
1103         if not Smooth then
1104           Rectangle(2, 0, Width, Height, BGRA(255, 255, 255, 100),
1105             dmDrawWithTransparency);
1106         SetVertLine(0, 0, Height, BGRA(160, 175, 195, 255));
1107         SetVertLine(1, 0, Height, BGRA(205, 218, 234, 255));
1108       end;
1109     alBottom: with ABitmap do
1110       begin
1111         if not Smooth then
1112           Rectangle(0, 2, Width, Height, BGRA(255, 255, 255, 100),
1113             dmDrawWithTransparency);
1114         SetHorizLine(0, 0, Width - 1, BGRA(160, 175, 195, 255));
1115         SetHorizLine(0, 1, Width - 1, BGRA(205, 218, 234, 255));
1116       end;
1117     alClient, alCustom, alNone: with ABitmap do
1118       begin
1119         if not Smooth then
1120           Rectangle(0, 0, Width, Height, BGRA(255, 255, 255, 100),
1121             dmDrawWithTransparency);
1122       end;
1123   end;
1124 end;
1125 
StrToTBCSampleDrawingnull1126 function StrToTBCSampleDrawing(const s: ansistring): TBCSampleDrawing;
1127 var
1128   ss: TBCSampleDrawing;
1129   ls: ansistring;
1130 begin
1131   Result := sdDefault;
1132   ls := {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(s);
1133   for ss := low(TBCSampleDrawing) to high(TBCSampleDrawing) do
1134     if ls = {$IFDEF FPC}UTF8LowerCase{$ELSE}LowerCase{$ENDIF}(BCSampleDrawingStr[ss]) then
1135     begin
1136       Result := ss;
1137       break;
1138     end;
1139 end;
1140 
1141 procedure BCSampleDrawingStrList(s: TStrings);
1142 var
1143   ss: TBCSampleDrawing;
1144 begin
1145   for ss := low(TBCSampleDrawing) to high(TBCSampleDrawing) do
1146     s.Add(BCSampleDrawingStr[ss]);
1147 end;
1148 
1149 procedure DrawSample(ABitmap: TBGRABitmap; Element: TBCSampleDrawing;
1150   Align: TAlign = alNone);
1151 begin
1152   case Element of
1153     sdFlashPlayerBody: DrawFlashPlayerBody(ABitmap);
1154     sdFlashPlayerButtonPanel: DrawFlashPlayerButtonPanel(ABitmap);
1155     sdWindows7Toolbar: DrawWindows7ToolBar(ABitmap, Align);
1156     sdiOSBar: DrawiOSBar(ABitmap);
1157     sdiOSToolBar: DrawiOSToolBar(ABitmap, False);
1158     sdiOSBackground: DrawiOSBackground(ABitmap);
1159     sdWindows8_1: DrawWindows8Background(ABitmap, clScheme1_Background,
1160         clScheme1_Selection);
1161     sdWindows8_2: DrawWindows8Background(ABitmap, clScheme2_Background,
1162         clScheme2_Selection);
1163     sdWindows8_3: DrawWindows8Background(ABitmap, clScheme3_Background,
1164         clScheme3_Selection);
1165     sdWindows8_4: DrawWindows8Background(ABitmap, clScheme4_Background,
1166         clScheme4_Selection);
1167     sdWindows8_5: DrawWindows8Background(ABitmap, clScheme5_Background,
1168         clScheme5_Selection);
1169     sdWindows8_6: DrawWindows8Background(ABitmap, clScheme6_Background,
1170         clScheme6_Selection);
1171     sdWindows8_7: DrawWindows8Background(ABitmap, clScheme7_Background,
1172         clScheme7_Selection);
1173     sdWindows8_8: DrawWindows8Background(ABitmap, clScheme8_Background,
1174         clScheme8_Selection);
1175     sdWindows8_9: DrawWindows8Background(ABitmap, clScheme9_Background,
1176         clScheme9_Selection);
1177     sdWindows8_10: DrawWindows8Background(ABitmap, clScheme10_Background,
1178         clScheme10_Selection);
1179     sdWindows8_11: DrawWindows8Background(ABitmap, clScheme11_Background,
1180         clScheme11_Selection);
1181     sdWindows8_12: DrawWindows8Background(ABitmap, clScheme12_Background,
1182         clScheme12_Selection);
1183     sdWindows8_13: DrawWindows8Background(ABitmap, clScheme13_Background,
1184         clScheme13_Selection);
1185     sdWindows8_14: DrawWindows8Background(ABitmap, clScheme14_Background,
1186         clScheme14_Selection);
1187     sdWindows8_15: DrawWindows8Background(ABitmap, clScheme15_Background,
1188         clScheme15_Selection);
1189     sdWindows8_16: DrawWindows8Background(ABitmap, clScheme16_Background,
1190         clScheme16_Selection);
1191     sdWindows8_17: DrawWindows8Background(ABitmap, clScheme17_Background,
1192         clScheme17_Selection);
1193     sdWindows8_18: DrawWindows8Background(ABitmap, clScheme18_Background,
1194         clScheme18_Selection);
1195     sdWindows8_19: DrawWindows8Background(ABitmap, clScheme19_Background,
1196         clScheme19_Selection);
1197     sdWindows8_20: DrawWindows8Background(ABitmap, clScheme20_Background,
1198         clScheme20_Selection);
1199     sdWindows8_21: DrawWindows8Background(ABitmap, clScheme21_Background,
1200         clScheme21_Selection);
1201     sdWindows8_22: DrawWindows8Background(ABitmap, clScheme22_Background,
1202         clScheme22_Selection);
1203     sdWindows8_23: DrawWindows8Background(ABitmap, clScheme23_Background,
1204         clScheme23_Selection);
1205     sdWindows8_24: DrawWindows8Background(ABitmap, clScheme24_Background,
1206         clScheme24_Selection);
1207     sdWindows8_25: DrawWindows8Background(ABitmap, clScheme25_Background,
1208         clScheme25_Selection);
1209   end;
1210 end;
1211 
DrawSamplenull1212 function DrawSample(AWidth, AHeight: integer; Element: TBCSampleDrawing;
1213   Align: TAlign = alNone): TBGRABitmap;
1214 var
1215   ABitmap: TBGRABitmap;
1216 begin
1217   ABitmap := TBGRABitmap.Create(AWidth, AHeight);
1218   DrawSample(ABitmap, Element, Align);
1219   Result := ABitmap;
1220 end;
1221 
1222 procedure DrawiOSBar(ABitmap: TBGRABitmap);
1223 begin
1224   ABitmap.GradientFill(0, 0, ABitmap.Width, ABitmap.Height - 4,
1225     BGRA(238, 245, 248, 255), BGRA(196, 204, 208, 255), gtLinear,
1226     PointF(0, 0), PointF(0, ABitmap.Height - 4), dmSet);
1227   with ABitmap do
1228   begin
1229     // Bottom Bevel
1230     SetHorizLine(0, Height - 4, Width - 1, BGRA(190, 198, 202, 255));
1231     SetHorizLine(0, Height - 3, Width - 1, BGRA(201, 209, 213, 255));
1232     SetHorizLine(0, Height - 2, Width - 1, BGRA(134, 142, 147, 255));
1233     SetHorizLine(0, Height - 1, Width - 1, BGRA(177, 180, 182, 255));
1234   end;
1235 end;
1236 
1237 procedure DrawiOSToolBar(ABitmap: TBGRABitmap; Shadow: boolean = True);
1238 begin
1239   if Shadow then
1240   begin
1241     DoubleGradientAlphaFill(ABitmap, Rect(0, 3, ABitmap.Width, ABitmap.Height - 6),
1242       BGRA(172, 185, 201), BGRA(134, 153, 178, 255),
1243       BGRA(125, 147, 175, 255), BGRA(110, 132, 162, 255),
1244       gdVertical, gdVertical, gdVertical, 0.5);
1245     with ABitmap do
1246     begin
1247       // Top Bevel
1248       SetHorizLine(0, 0, Width - 1, BGRA(201, 210, 221, 255));
1249       SetHorizLine(0, 1, Width - 1, BGRA(173, 184, 200, 255));
1250       SetHorizLine(0, 2, Width - 1, BGRA(179, 190, 205, 255));
1251       // Bottom Bevel
1252       SetHorizLine(0, Height - 6, Width - 1, BGRA(107, 129, 158, 255));
1253       SetHorizLine(0, Height - 5, Width - 1, BGRA(116, 139, 170, 255));
1254       SetHorizLine(0, Height - 4, Width - 1, BGRA(48, 54, 62, 255));
1255       // Bottom Shadow
1256       SetHorizLine(0, Height - 3, Width - 1, BGRA(0, 0, 0, 75));
1257       SetHorizLine(0, Height - 2, Width - 1, BGRA(255, 255, 255, 50));
1258       SetHorizLine(0, Height - 1, Width - 1, BGRA(0, 0, 0, 10));
1259     end;
1260   end
1261   else
1262   begin
1263     DoubleGradientAlphaFill(ABitmap, Rect(0, 3, ABitmap.Width, ABitmap.Height - 3),
1264       BGRA(172, 185, 201), BGRA(134, 153, 178, 255),
1265       BGRA(125, 147, 175, 255), BGRA(110, 132, 162, 255),
1266       gdVertical, gdVertical, gdVertical, 0.5);
1267     with ABitmap do
1268     begin
1269       // Top Bevel
1270       SetHorizLine(0, 0, Width - 1, BGRA(201, 210, 221, 255));
1271       SetHorizLine(0, 1, Width - 1, BGRA(173, 184, 200, 255));
1272       SetHorizLine(0, 2, Width - 1, BGRA(179, 190, 205, 255));
1273       // Bottom Bevel
1274       SetHorizLine(0, Height - 3, Width - 1, BGRA(107, 129, 158, 255));
1275       SetHorizLine(0, Height - 2, Width - 1, BGRA(116, 139, 170, 255));
1276       SetHorizLine(0, Height - 1, Width - 1, BGRA(48, 54, 62, 255));
1277     end;
1278   end;
1279 end;
1280 
1281 procedure DrawiOSBackground(ABitmap: TBGRABitmap);
1282 var
1283   temp: TBGRABitmap;
1284 begin
1285   temp := TBGRABitmap.Create(16, 1, BGRA(197, 204, 211));
1286   with temp do
1287   begin
1288     SetPixel(7, 0, BGRA(203, 210, 217));
1289     SetPixel(14, 0, BGRA(204, 211, 218));
1290     BGRAReplace(temp, temp.FilterBlurRadial(1, rbFast));
1291     BGRAReplace(temp, temp.FilterSharpen);
1292   end;
1293   ABitmap.Fill(temp);
1294   temp.Free;
1295 end;
1296 
1297 procedure DrawWindows8Background(ABitmap: TBGRABitmap; cl1, cl2: TColor);
1298 begin
1299   ABitmap.Fill(cl2);
1300 end;
1301 
1302 end.
1303