Skip to content

Commit 810d578

Browse files
committed
Add intro
1 parent cdc3f3e commit 810d578

File tree

8 files changed

+3237
-2
lines changed

8 files changed

+3237
-2
lines changed

AutoProcedureTableGenerator.exe

327 KB
Binary file not shown.

src/SplashScreen.pas

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
unit SplashScreen;
2+
3+
interface
4+
5+
uses Windows, PNGImage, Forms, Graphics;
6+
7+
type
8+
TSplashForm = TForm;
9+
10+
TSplash = class
11+
private
12+
FImage: TPNGImage;
13+
SplashForm: TSplashForm;
14+
procedure SetImage(value: TPNGImage);
15+
procedure ToLayeredWindow;
16+
public
17+
constructor Create; overload;
18+
constructor Create(Image: TPNGImage); overload;
19+
destructor Destroy;
20+
procedure Show(StayOnTop: Boolean);
21+
procedure Close;
22+
property Image: TPNGImage read FImage write SetImage;
23+
end;
24+
25+
implementation
26+
27+
procedure CreatePremultipliedBitmap(DstBitMap: TBitmap; SrcPngImage: TPNGImage);
28+
type
29+
TRGBTripleArray = ARRAY[Word] of TRGBTriple;
30+
pRGBTripleArray = ^TRGBTripleArray;
31+
TRGBAArray = array[Word] of TRGBQuad;
32+
PRGBAArray = ^TRGBAArray;
33+
var
34+
x, y: Integer;
35+
TripleAlpha: Double;
36+
pColor: pRGBTripleArray;
37+
pAlpha: pbytearray;
38+
pBmp: pRGBAArray;
39+
begin
40+
DstBitMap.Height := SrcPngImage.Height;
41+
DstBitMap.Width := SrcPngImage.Width;
42+
DstBitMap.PixelFormat := pf32bit;
43+
for y := 0 to SrcPngImage.Height - 1 do
44+
begin
45+
pAlpha := SrcPngImage.AlphaScanline[y];
46+
pColor := SrcPngImage.Scanline[y];
47+
pBmp := DstBitMap.ScanLine[y];
48+
for x := 0 to SrcPngImage.Width - 1 do
49+
begin
50+
pBmp[x].rgbReserved := pAlpha[x];
51+
// ïðåîáðàçóåì â íóæíûé ôîðìàò
52+
TripleAlpha := pBmp[x].rgbReserved / 255;
53+
pBmp[x].rgbBlue := byte(trunc(pColor[x].rgbtBlue * TripleAlpha));
54+
pBmp[x].rgbGreen := byte(trunc(pColor[x].rgbtGreen * TripleAlpha));
55+
pBmp[x].rgbRed := byte(trunc(pColor[x].rgbtRed * TripleAlpha));
56+
end;
57+
end;
58+
end;
59+
60+
constructor TSplash.Create;
61+
begin
62+
SplashForm := TSplashForm.Create(nil);
63+
FImage := TPNGImage.Create;
64+
end;
65+
66+
constructor TSplash.Create(Image: TPNGImage);
67+
begin
68+
SplashForm := TSplashForm.Create(nil);
69+
FImage := TPNGImage.Create;
70+
FImage.Assign(Image);
71+
end;
72+
73+
destructor TSplash.Destroy;
74+
begin
75+
SplashForm.Free;
76+
FImage.Free
77+
end;
78+
79+
procedure TSplash.SetImage(value: TPNGImage);
80+
begin
81+
FImage.Assign(value);
82+
end;
83+
84+
procedure TSplash.ToLayeredWindow;
85+
var
86+
BitMap: TBitMap;
87+
bf: TBlendFunction;
88+
BitmapSize: TSize;
89+
BitmapPos: TPoint;
90+
begin
91+
// ñîçäàíèå ïðàâèëüíîé áèòîâîé êàðòû(32 áèò íà ïèêñåëü, precalc àëüôà êàíàë)
92+
BitMap := TBitMap.Create;
93+
CreatePremultipliedBitmap(Bitmap,FImage);
94+
// îïèñàíèå BlendFunction
95+
with bf do
96+
begin
97+
BlendOp := AC_SRC_OVER;
98+
BlendFlags := 0;
99+
AlphaFormat := AC_SRC_ALPHA;
100+
SourceConstantAlpha := 255;
101+
end;
102+
// ïîëó÷àåì ðàçìåðû BitMap
103+
BitmapSize.cx := Bitmap.Width;
104+
BitmapSize.cy := Bitmap.Height;
105+
// ïîëó÷àåì êîîðäèíàòû BitMap
106+
BitmapPos.X := 0;
107+
BitmapPos.Y := 0;
108+
// ñëîèñòûé ñòèëü îêíà
109+
SetWindowLong(SplashForm.Handle, GWL_EXSTYLE,
110+
GetWindowLong(SplashForm.Handle, GWL_EXSTYLE) + WS_EX_LAYERED);
111+
// ïðåâðàùåíèå îêíà â ñëîèñòîå îêíî
112+
UpdateLayeredWindow(
113+
SplashForm.Handle,
114+
0,
115+
nil,//pos
116+
@BitmapSize,//size
117+
bitmap.Canvas.Handle,//src
118+
@BitmapPos,//pptsrc
119+
0,
120+
@bf,
121+
ULW_ALPHA
122+
);
123+
BitMap.Free;
124+
end;
125+
126+
procedure TSplash.Show(StayOnTop: Boolean);
127+
begin
128+
// óñòàíàâëèâàåì íóæíûå ïàðàìåòðû
129+
with SplashForm do
130+
begin
131+
BorderStyle := bsNone;
132+
Width := FImage.Width;
133+
Height := FImage.Height;
134+
Position := poDesktopCenter;
135+
if StayOnTop then formstyle := fsStayOnTop;
136+
end;
137+
// ïðåîáðàçóåì â "ñëîèñòîå" îêíî
138+
ToLayeredWindow;
139+
// ïîêàçûâàåì
140+
SplashForm.Show;
141+
end;
142+
143+
procedure TSplash.Close;
144+
begin
145+
SplashForm.Close;
146+
end;
147+
148+
end.
Binary file not shown.

src/Win32/Debug/SplashScreen.dcu

6.17 KB
Binary file not shown.

src/Win32/Debug/genTable.dcu

539 Bytes
Binary file not shown.

src/genTable.dfm

Lines changed: 3076 additions & 0 deletions
Large diffs are not rendered by default.

src/genTable.pas

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ interface
44

55
uses
66
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
7-
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls,ComObj,
8-
Vcl.ExtCtrls, Vcl.Menus, ShellAPI;
7+
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.StdCtrls,ComObj, pngimage,
8+
Vcl.ExtCtrls, Vcl.Menus, ShellAPI,SplashScreen;
99

1010
type
1111
TTableGenForm = class(TForm)
@@ -21,6 +21,7 @@ TTableGenForm = class(TForm)
2121
mnSupport: TMenuItem;
2222
mniConver: TMenuItem;
2323
mnToExcel: TMenuItem;
24+
ImgIntro: TImage;
2425
procedure btnToExcelClick(Sender: TObject);
2526
procedure btnGenTableClick(Sender: TObject);
2627
procedure FormCreate(Sender: TObject);
@@ -31,6 +32,7 @@ TTableGenForm = class(TForm)
3132
procedure mnClearClick(Sender: TObject);
3233
procedure mnSupportClick(Sender: TObject);
3334
private
35+
splash: TSplash;
3436
function GetExcelFileName: String;
3537
public
3638
{ Public declarations }
@@ -210,8 +212,17 @@ procedure TTableGenForm.FormCanResize(Sender: TObject; var NewWidth,
210212
end;
211213

212214
procedure TTableGenForm.FormCreate(Sender: TObject);
215+
var
216+
png: TPngImage;
213217
begin
214218
isOk := false;
219+
png:= TPngImage(ImgIntro.Picture);
220+
Splash := TSplash.Create(png);
221+
Splash.Show(true);
222+
223+
Sleep(2000);
224+
225+
Splash.Close;
215226
end;
216227

217228
end.

src/intro.png

98 KB
Loading

0 commit comments

Comments
 (0)