| 1 | unit uallofthem;
|
|---|
| 2 |
|
|---|
| 3 | {$mode objfpc}{$H+}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, BGRAButton,
|
|---|
| 9 | BGRAFlashProgressBar, BGRAGraphicControl, BGRAImageButton, BGRAKnob,
|
|---|
| 10 | BGRALabel, BGRALabelFX, BCPanel, BGRAShape, BGRASpeedButton,
|
|---|
| 11 | BGRAVirtualScreen, BGRAWin7ToolBar, BGRABitmap,
|
|---|
| 12 | BGRABitmapThemeUtils, BGRAImageList, BGRABitmapTypes;
|
|---|
| 13 |
|
|---|
| 14 | type
|
|---|
| 15 |
|
|---|
| 16 | { TfrmAllOfThem }
|
|---|
| 17 |
|
|---|
| 18 | TfrmAllOfThem = class(TForm)
|
|---|
| 19 | BGRAButton1: TBGRAButton;
|
|---|
| 20 | BGRAFlashProgressBar1: TBGRAFlashProgressBar;
|
|---|
| 21 | BGRAGraphicControl1: TBGRAGraphicControl;
|
|---|
| 22 | BGRAImageButton1: TBGRAImageButton;
|
|---|
| 23 | BGRAImageList1: TBGRAImageList;
|
|---|
| 24 | BGRAKnob1: TBGRAKnob;
|
|---|
| 25 | BGRALabel1: TBGRALabel;
|
|---|
| 26 | BGRALabelFX1: TBGRALabelFX;
|
|---|
| 27 | BCPanel1: TBCPanel;
|
|---|
| 28 | BGRAShape1: TBGRAShape;
|
|---|
| 29 | BGRASpeedButton1: TBGRASpeedButton;
|
|---|
| 30 | BGRAVirtualScreen1: TBGRAVirtualScreen;
|
|---|
| 31 | BGRAWin7ToolBar1: TBGRAWin7ToolBar;
|
|---|
| 32 | procedure BGRAGraphicControl1Click(Sender: TObject);
|
|---|
| 33 | procedure BGRAGraphicControl1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
|---|
| 34 | procedure BGRAKnob1ValueChanged(Sender: TObject; Value: single);
|
|---|
| 35 | procedure BGRAVirtualScreen1MouseDown(Sender: TObject;
|
|---|
| 36 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|---|
| 37 | procedure BGRAVirtualScreen1MouseMove(Sender: TObject; Shift: TShiftState;
|
|---|
| 38 | X, Y: Integer);
|
|---|
| 39 | procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
|---|
| 40 | procedure FormCreate(Sender: TObject);
|
|---|
| 41 | procedure FormDestroy(Sender: TObject);
|
|---|
| 42 | private
|
|---|
| 43 | { private declarations }
|
|---|
| 44 | public
|
|---|
| 45 | { public declarations }
|
|---|
| 46 | PrevPos: TPoint;
|
|---|
| 47 | image: TBGRABitmapThemeUtil;
|
|---|
| 48 | number: integer;
|
|---|
| 49 | end;
|
|---|
| 50 |
|
|---|
| 51 | var
|
|---|
| 52 | frmAllOfThem: TfrmAllOfThem;
|
|---|
| 53 |
|
|---|
| 54 | implementation
|
|---|
| 55 |
|
|---|
| 56 | {$R *.lfm}
|
|---|
| 57 |
|
|---|
| 58 | { TfrmAllOfThem }
|
|---|
| 59 |
|
|---|
| 60 | procedure TfrmAllOfThem.FormCreate(Sender: TObject);
|
|---|
| 61 | begin
|
|---|
| 62 | BGRAImageButton1.BitmapLoadFromFile(BGRAImageButton1.BitmapFile);
|
|---|
| 63 |
|
|---|
| 64 | image := TBGRABitmapThemeUtil.Create('sample_4.png',
|
|---|
| 65 | 4, // the number of images in the bitmap vertically
|
|---|
| 66 | 6, // the number of horizontal pixels used as border
|
|---|
| 67 | 6 // the number of vertical pixels used as border
|
|---|
| 68 | );
|
|---|
| 69 |
|
|---|
| 70 | number := 0; // the default image
|
|---|
| 71 |
|
|---|
| 72 | BGRAGraphicControl1.Align := alLeft;
|
|---|
| 73 |
|
|---|
| 74 | BGRAImageList1.GetBitmap(0, BGRAButton1.Glyph);
|
|---|
| 75 | BGRAImageList1.GetBitmap(0, BGRASpeedButton1.Glyph);
|
|---|
| 76 | end;
|
|---|
| 77 |
|
|---|
| 78 | procedure TfrmAllOfThem.FormDestroy(Sender: TObject);
|
|---|
| 79 | begin
|
|---|
| 80 | image.Free;
|
|---|
| 81 | end;
|
|---|
| 82 |
|
|---|
| 83 | procedure TfrmAllOfThem.BGRAKnob1ValueChanged(Sender: TObject; Value: single);
|
|---|
| 84 | begin
|
|---|
| 85 | BGRAFlashProgressBar1.Value := Trunc(BGRAKnob1.Value);
|
|---|
| 86 | end;
|
|---|
| 87 |
|
|---|
| 88 | procedure TfrmAllOfThem.BGRAGraphicControl1Redraw(Sender: TObject;
|
|---|
| 89 | Bitmap: TBGRABitmap);
|
|---|
| 90 | begin
|
|---|
| 91 | bitmap.Fill(BGRAPixelTransparent);
|
|---|
| 92 | image.Draw(bitmap, 0, 0, bitmap.Width, bitmap.Height, number);
|
|---|
| 93 | end;
|
|---|
| 94 |
|
|---|
| 95 | procedure TfrmAllOfThem.BGRAGraphicControl1Click(Sender: TObject);
|
|---|
| 96 | begin
|
|---|
| 97 | if number = 3 then
|
|---|
| 98 | number := 0
|
|---|
| 99 | else
|
|---|
| 100 | Inc(number, +1);
|
|---|
| 101 |
|
|---|
| 102 | BGRAGraphicControl1.DiscardBitmap;
|
|---|
| 103 | end;
|
|---|
| 104 |
|
|---|
| 105 | procedure TfrmAllOfThem.BGRAVirtualScreen1MouseDown(Sender: TObject;
|
|---|
| 106 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|---|
| 107 | begin
|
|---|
| 108 | if Button = mbLeft then
|
|---|
| 109 | begin
|
|---|
| 110 | BGRAVirtualScreen1.Bitmap.SetPixel(X, Y, BGRABlack);
|
|---|
| 111 | PrevPos := Point(X, Y);
|
|---|
| 112 | BGRAVirtualScreen1.Repaint;
|
|---|
| 113 | end;
|
|---|
| 114 | end;
|
|---|
| 115 |
|
|---|
| 116 | procedure TfrmAllOfThem.BGRAVirtualScreen1MouseMove(Sender: TObject;
|
|---|
| 117 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 118 | begin
|
|---|
| 119 | if ssLeft in Shift then
|
|---|
| 120 | begin
|
|---|
| 121 | BGRAVirtualScreen1.Bitmap.DrawLineAntialias(X, Y, PrevPos.X,
|
|---|
| 122 | PrevPos.Y, BGRABlack, False);
|
|---|
| 123 | PrevPos := Point(X, Y);
|
|---|
| 124 | BGRAVirtualScreen1.Repaint;
|
|---|
| 125 | end;
|
|---|
| 126 | end;
|
|---|
| 127 |
|
|---|
| 128 | procedure TfrmAllOfThem.BGRAVirtualScreen1Redraw(Sender: TObject;
|
|---|
| 129 | Bitmap: TBGRABitmap);
|
|---|
| 130 | begin
|
|---|
| 131 | Bitmap.DrawLineAntialias(0, 0, Bitmap.Width - 1, Bitmap.Height - 1, BGRABlack, 1);
|
|---|
| 132 | end;
|
|---|
| 133 |
|
|---|
| 134 | end.
|
|---|
| 135 |
|
|---|