Indentation corrected, new tests

svn path=/trunk/; revision=1755
This commit is contained in:
Jason Filby 2001-03-31 15:43:22 +00:00
parent 389375c4ee
commit f3b6ab3603

View file

@ -8,52 +8,80 @@ extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reser
int main (void) int main (void)
{ {
HDC Desktop, MyDC; HDC Desktop, MyDC, DC24;
HPEN RedPen, GreenPen; HPEN RedPen, GreenPen, BluePen;
HBITMAP MyBitmap; HBITMAP MyBitmap, DIB24;
DWORD shit; HFONT hf;
BITMAPINFOHEADER BitInf;
BITMAPINFO BitPalInf;
GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL); printf("Entering GDITest..\n");
// Set up a DC called Desktop that accesses DISPLAY // GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
if (Desktop == NULL)
return 1;
// Create a red pen and select it into the DC // Set up a DC called Desktop that accesses DISPLAY
RedPen = CreatePen(PS_SOLID, 8, 0x0000ff); Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
SelectObject(Desktop, RedPen); if (Desktop == NULL)
return 1;
// Draw a shap on the DC // Create a red pen and select it into the DC
MoveToEx(Desktop, 50, 50, NULL); BluePen = CreatePen(PS_SOLID, 8, 0x0000ff);
LineTo(Desktop, 200, 60); SelectObject(Desktop, BluePen);
LineTo(Desktop, 200, 300);
LineTo(Desktop, 50, 50);
// Create a DC that is compatible with the DISPLAY DC along with a bitmap that is selected into it // Draw a shape on the DC
MyDC = CreateCompatibleDC(Desktop); MoveToEx(Desktop, 50, 50, NULL);
MyBitmap = CreateCompatibleBitmap(Desktop, 151, 251); LineTo(Desktop, 200, 60);
SelectObject(MyDC, MyBitmap); LineTo(Desktop, 200, 300);
LineTo(Desktop, 50, 50);
MoveToEx(Desktop, 50, 50, NULL);
LineTo(Desktop, 200, 50);
// Bitblt from the DISPLAY DC to MyDC and then back again in a different location // TEST 1: Copy from the VGA into a device compatible DC, draw on it, then blt it to the VGA again
BitBlt(MyDC, 0, 0, 151, 251, Desktop, 50, 50, SRCCOPY); MyDC = CreateCompatibleDC(Desktop);
MyBitmap = CreateCompatibleBitmap(Desktop, 151, 251);
SelectObject(MyDC, MyBitmap);
BitBlt(MyDC, 0, 0, 152, 251, Desktop, 50, 50, SRCCOPY);
// Draw a rectangle on the memory DC before bltting back with a green pen GreenPen = CreatePen(PS_SOLID, 3, 0x00ff00);
GreenPen = CreatePen(PS_SOLID, 3, 0x00ff00); SelectObject(MyDC, GreenPen);
SelectObject(MyDC, GreenPen); Rectangle(MyDC, 10, 10, 50, 50);
Rectangle(MyDC, 10, 10, 50, 50);
BitBlt(Desktop, 400, 100, 151, 251, MyDC, 0, 0, SRCCOPY); // TEST 2: Copy from the device compatible DC into a 24BPP bitmap, draw on it, then blt to the VGA again
BitInf.biSize = sizeof(BITMAPINFOHEADER);
BitInf.biWidth = 152;
BitInf.biHeight = -252; // it's top down (since BI_RGB is used, the sign is operative of direction)
BitInf.biPlanes = 1;
BitInf.biBitCount = 24;
BitInf.biCompression = BI_RGB;
BitInf.biSizeImage = 0;
BitInf.biXPelsPerMeter = 0;
BitInf.biYPelsPerMeter = 0;
BitInf.biClrUsed = 0;
BitInf.biClrImportant = 0;
BitPalInf.bmiHeader = BitInf;
DIB24 = (HBITMAP) CreateDIBSection(NULL, &BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
DC24 = CreateCompatibleDC(NULL);
SelectObject(DC24, DIB24);
TextOutA(Desktop, 200, 0, "ReactOS", 7); BitBlt(DC24, 0, 0, 101, 201, MyDC, 0, 0, SRCCOPY);
TextOutA(Desktop, 200, 9, "This is a test of the ReactOS GDI functionality", 47); RedPen = CreatePen(PS_SOLID, 3, 0xff0000);
TextOutA(Desktop, 200, 18, "The font being used is an internal static one", 45); SelectObject(DC24, RedPen);
Sleep( 10000 ); Rectangle(DC24, 80, 90, 100, 110);
// Free up everything MoveToEx(DC24, 80, 90, NULL);
DeleteDC(Desktop); LineTo(DC24, 100, 110);
DeleteDC(MyDC); BitBlt(Desktop, 200, 200, 110, 120, DC24, 0, 0, SRCCOPY);
return 0;
// Text tests
/* hf = CreateFontA(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "System"); */
// TextOutA(Desktop, 200, 0, "ReactOS", 7);
// TextOutA(Desktop, 200, 9, "This is a test of the ReactOS GDI functionality", 47);
// TextOutA(Desktop, 200, 18, "The font being used is an internal static one", 45);
Sleep( 10000 );
// Free up everything
DeleteDC(Desktop);
DeleteDC(MyDC);
return 0;
} }