cvs: gd /libgd/examples windows.c
[email protected] ("Pierre-Alain Joye") Sun, 20 Apr 2008 17:28:18 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvspajoye1208712498@cvsserver> |
pajoye Sun Apr 20 17:28:18 2008 UTC
Modified files:
/gd/libgd/examples windows.c
Log:
- encoding mess
http://cvs.php.net/viewvc.cgi/gd/libgd/examples/windows.c?r1=1.3&r2=1.4&diff_format=u
Index: gd/libgd/examples/windows.c
diff -u gd/libgd/examples/windows.c:1.3 gd/libgd/examples/windows.c:1.4
--- gd/libgd/examples/windows.c:1.3 Sun Jan 20 16:05:56 2008
+++ gd/libgd/examples/windows.c Sun Apr 20 17:28:18 2008
@@ -1,15 +1,16 @@
/*
-Sample usage of GD on windows. This little program opens a window, fetch its DIB
+Sample usage of GD on windows. This little program opens a window, fetch its DIB
and assigns to a GD truecolor image.
Thanks to Mateusz Loskot (http://mateusz.loskot.net) for the AttachBuffer function!
-$Id: windows.c,v 1.3 2008/01/20 16:05:56 pajoye Exp $
+$Id: windows.c,v 1.4 2008/04/20 17:28:18 pajoye Exp $
*/
#include <windows.h>
#include <gd.h>
#include <gdfontg.h>
#include <gdfontl.h>
+
gdImagePtr gdImageTrueColorAttachBuffer(int* buffer, int sx, int sy, int stride)
{
int i;
@@ -118,23 +119,23 @@
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
-
+
if (!RegisterClass (&wndclass))
- { // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit
- MessageBox (NULL, TEXT ("Programm arbeitet mit Unicode und setzt Windows NT voraus!"),
+ { // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit
+ MessageBox (NULL, TEXT ("Programm arbeitet mit Unicode und setzt Windows NT voraus!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
-
+
hwnd = CreateWindow (szAppName, TEXT ("Bezierkurven"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
-
+
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
-
+
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
@@ -146,10 +147,10 @@
void DrawBezier (HDC hdc, POINT apt[])
{
PolyBezier (hdc, apt, 4) ;
-
+
MoveToEx (hdc, apt[0].x, apt[0].y, NULL) ;
LineTo (hdc, apt[1].x, apt[1].y) ;
-
+
MoveToEx (hdc, apt[2].x, apt[2].y, NULL) ;
LineTo (hdc, apt[3].x, apt[3].y) ;
}
@@ -251,16 +252,16 @@
case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
-
+
apt[0].x = cxClient / 4 ;
apt[0].y = cyClient / 2 ;
-
+
apt[1].x = cxClient / 2 ;
apt[1].y = cyClient / 4 ;
-
+
apt[2].x = cxClient / 2 ;
apt[2].y = 3 * cyClient / 4 ;
-
+
apt[3].x = 3 * cxClient / 4 ;
apt[3].y = cyClient / 2 ;
return 0 ;
@@ -272,22 +273,22 @@
{
hdc = GetDC (hwnd) ;
- // alte Kurve löschen (mit Weiß übermalen)
+ // alte Kurve löschen (mit Weià übermalen)
SelectObject (hdc, GetStockObject (WHITE_PEN)) ;
DrawBezier (hdc, apt) ;
-
+
if (wParam & MK_LBUTTON)
{
apt[1].x = LOWORD (lParam) ;
apt[1].y = HIWORD (lParam) ;
}
-
+
if (wParam & MK_RBUTTON)
{
apt[2].x = LOWORD (lParam) ;
apt[2].y = HIWORD (lParam) ;
}
-
+
// neue Kurve (mit Schwarz) zeichnen
SelectObject (hdc, GetStockObject (BLACK_PEN)) ;
gdDrawImage(hdc, &rc);