$Id$ changes
[swftools.git] / installer / background.c
1 static void tball(HDC hdc, double px, double py, double sx, double sy)
2 {
3     MoveToEx(hdc, 75.25*sx+px, -32.50*sy+py, 0);
4     LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 74.95*sx+px, -3.45*sy+py); LineTo(hdc, 75.25*sx+px, -32.50*sy+py);
5     LineTo(hdc, 44.85*sx+px, -104.30*sy+py); LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 17.30*sx+px, -91.80*sy+py);
6     LineTo(hdc, 29.35*sx+px, -10.10*sy+py); LineTo(hdc, 74.75*sx+px, -24.80*sy+py); LineTo(hdc, 47.60*sx+px, 63.80*sy+py);
7     LineTo(hdc, 74.75*sx+px, 51.10*sy+py); LineTo(hdc, 74.95*sx+px, -3.45*sy+py);
8     MoveToEx(hdc, 74.75*sx+px, 51.10*sy+py, 0);
9     LineTo(hdc, 29.35*sx+px, 118.75*sy+py); LineTo(hdc, -45.20*sx+px, 155.35*sy+py);
10     LineTo(hdc, -127.95*sx+px, 145.10*sy+py); LineTo(hdc, -194.85*sx+px, 104.30*sy+py);
11     LineTo(hdc, -225.25*sx+px, 32.50*sy+py); LineTo(hdc, -224.75*sx+px, -51.10*sy+py);
12     LineTo(hdc, -179.35*sx+px, -118.75*sy+py); LineTo(hdc, -104.80*sx+px, -155.35*sy+py);
13     LineTo(hdc, -22.05*sx+px, -145.10*sy+py); LineTo(hdc, 44.85*sx+px, -104.30*sy+py);
14     LineTo(hdc, 17.30*sx+px, -91.80*sy+py); LineTo(hdc, -75.00*sx+px, -122.60*sy+py);
15     LineTo(hdc, -45.20*sx+px, -43.70*sy+py); LineTo(hdc, 17.30*sx+px, -91.80*sy+py);
16     LineTo(hdc, -22.05*sx+px, -145.10*sy+py); LineTo(hdc, -75.00*sx+px, -122.60*sy+py);
17     LineTo(hdc, -104.80*sx+px, -155.35*sy+py); LineTo(hdc, -167.30*sx+px, -107.25*sy+py);
18     LineTo(hdc, -75.00*sx+px, -122.60*sy+py); LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
19     LineTo(hdc, -45.20*sx+px, -43.70*sy+py); LineTo(hdc, 29.35*sx+px, -10.10*sy+py);
20     LineTo(hdc, 47.60*sx+px, 63.80*sy+py); LineTo(hdc, -25.70*sx+px, 52.45*sy+py);
21     LineTo(hdc, -25.70*sx+px, 128.45*sy+py); LineTo(hdc, 47.60*sx+px, 63.80*sy+py);
22     LineTo(hdc, 29.35*sx+px, 118.75*sy+py); LineTo(hdc, -25.70*sx+px, 128.45*sy+py);
23     LineTo(hdc, -45.20*sx+px, 155.35*sy+py); LineTo(hdc, -118.85*sx+px, 143.85*sy+py);
24     LineTo(hdc, -127.95*sx+px, 145.10*sy+py);
25     MoveToEx(hdc, -179.35*sx+px, -118.75*sy+py, 0);
26     LineTo(hdc, -167.30*sx+px, -107.25*sy+py); LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
27     LineTo(hdc, -118.85*sx+px, 21.65*sy+py); LineTo(hdc, -45.20*sx+px, -43.70*sy+py);
28     LineTo(hdc, -25.70*sx+px, 52.45*sy+py); LineTo(hdc, 29.35*sx+px, -10.10*sy+py);
29     MoveToEx(hdc, -225.25*sx+px, 32.50*sy+py, 0);
30     LineTo(hdc, -194.85*sx+px, -17.85*sy+py); LineTo(hdc, -224.75*sx+px, -51.10*sy+py);
31     LineTo(hdc, -167.30*sx+px, -107.25*sy+py); LineTo(hdc, -194.85*sx+px, -17.85*sy+py);
32     LineTo(hdc, -127.95*sx+px, -63.55*sy+py);
33     MoveToEx(hdc, -175.85*sx+px, 77.60*sy+py, 0);
34     LineTo(hdc, -96.35*sx+px, 99.55*sy+py); LineTo(hdc, -118.85*sx+px, 21.65*sy+py);
35     LineTo(hdc, -175.85*sx+px, 77.60*sy+py); LineTo(hdc, -225.25*sx+px, 32.50*sy+py);
36     MoveToEx(hdc, -118.85*sx+px, 143.85*sy+py, 0);
37     LineTo(hdc, -175.85*sx+px, 77.60*sy+py); LineTo(hdc, -194.85*sx+px, 104.30*sy+py);
38     LineTo(hdc, -118.85*sx+px, 143.85*sy+py); LineTo(hdc, -96.35*sx+px, 99.55*sy+py);
39     LineTo(hdc, -25.70*sx+px, 52.45*sy+py); LineTo(hdc, -118.85*sx+px, 21.65*sy+py);
40     LineTo(hdc, -194.85*sx+px, -17.85*sy+py); LineTo(hdc, -175.85*sx+px, 77.60*sy+py);
41     MoveToEx(hdc, -96.35*sx+px, 99.55*sy+py, 0);
42     LineTo(hdc, -25.70*sx+px, 128.45*sy+py); LineTo(hdc, -118.85*sx+px, 143.85*sy+py);
43 }
44
45 static HWND wnd_background = 0;
46 LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
47 {
48     if(message == WM_CREATE) {
49         CREATESTRUCT*cs = ((LPCREATESTRUCT)lParam);
50         if(cs->lpCreateParams && !strcmp((char*)cs->lpCreateParams, "background")) {
51             wnd_background = hwnd;
52         }
53     }
54     if(hwnd == wnd_background && message == WM_PAINT) {
55         HDC hdc;
56         PAINTSTRUCT ps;
57         RECT rc;
58         GetWindowRect(hwnd, &rc);
59         int width = rc.right - rc.left;
60         int height = rc.bottom - rc.top;
61
62         hdc = BeginPaint(hwnd, &ps);
63         SetBkMode(hdc, TRANSPARENT);
64
65         double s = width / 1282.0;
66         
67         HPEN pen0 = CreatePen(PS_SOLID, 2, RGB(0, 32, 128));
68         HPEN oldPen = (HPEN)SelectObject(hdc, pen0);
69         tball(hdc, 0.7*width,0.2*height,s,s);
70
71         HPEN pen1 = CreatePen(PS_SOLID, 2, RGB(0, 48, 128));
72         (HPEN)SelectObject(hdc, pen1);
73         tball(hdc, 0.233*width,0.3*height,s*2,s*2);
74         
75         HPEN pen2 = CreatePen(PS_SOLID, 2, RGB(0, 64, 128));
76         (HPEN)SelectObject(hdc, pen2);
77         tball(hdc, width, 1.2*height,s*3,-s*3);
78
79         SelectObject(hdc, oldPen); 
80         DeleteObject(pen1);
81         DeleteObject(pen2);
82         EndPaint(hwnd, &ps);
83         return 1;
84     }
85     return DefWindowProc(hwnd, message, wParam, lParam);
86 }
87
88