Author: gschneider
Date: Mon Nov 17 11:28:14 2008
New Revision: 37412
URL:
http://svn.reactos.org/svn/reactos?rev=37412&view=rev
Log:
- Restructure dib related tests, 2nd try.
- Change build files accordingly
Added:
trunk/rostests/dibtests/bitblt/
trunk/rostests/dibtests/bitblt/bitblt.c (with props)
trunk/rostests/dibtests/bitblt/bitblt.rbuild (with props)
trunk/rostests/dibtests/bitblt/bitblt.rc (with props)
trunk/rostests/dibtests/bitblt/lena.bmp (with props)
trunk/rostests/dibtests/dibtest/
trunk/rostests/dibtests/dibtest/dibtest.c (with props)
trunk/rostests/dibtests/dibtest/dibtest.rbuild (with props)
trunk/rostests/dibtests/icontest/
trunk/rostests/dibtests/icontest/icon.ico (with props)
trunk/rostests/dibtests/icontest/icontest.c (with props)
trunk/rostests/dibtests/icontest/icontest.rbuild (with props)
trunk/rostests/dibtests/icontest/icontest.rc (with props)
trunk/rostests/dibtests/icontest/resource.h (with props)
trunk/rostests/dibtests/palbitblt/
trunk/rostests/dibtests/palbitblt/pal.c (with props)
trunk/rostests/dibtests/palbitblt/palbitblt.rbuild (with props)
trunk/rostests/dibtests/patblt/
trunk/rostests/dibtests/patblt/Penguin.bmp (with props)
trunk/rostests/dibtests/patblt/patblt.cpp (with props)
trunk/rostests/dibtests/patblt/patblt.rbuild (with props)
trunk/rostests/dibtests/stretchblt/
trunk/rostests/dibtests/stretchblt/lena.bmp (with props)
trunk/rostests/dibtests/stretchblt/stretchblt.cpp (with props)
trunk/rostests/dibtests/stretchblt/stretchblt.rbuild (with props)
Modified:
trunk/rostests/dibtests/directory.rbuild
trunk/rostests/directory.rbuild
trunk/rostests/tests/directory.rbuild
Added: trunk/rostests/dibtests/bitblt/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bitblt/bitblt.c?…
==============================================================================
--- trunk/rostests/dibtests/bitblt/bitblt.c (added)
+++ trunk/rostests/dibtests/bitblt/bitblt.c [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,139 @@
+
+/*
+ * Windows 2000 Graphics API Black Book
+ * (BitBlt Bitmap Rendering Demo)
+ *
+ * Created by Damon Chandler <dmc27(a)ee.cornell.edu>
+ * Updates can be downloaded at: <www.coriolis.com>
+ *
+ * Please do not hesistate to e-mail me at dmc27(a)ee.cornell.edu
+ * if you have any questions about this code.
+ */
+
+
+#include <windows.h>
+#include <string.h>
+
+HINSTANCE HInst;
+const char* WndClassName = "GMainWnd";
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam);
+
+
+int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance,
+ LPTSTR lpCmdLine, int nCmdShow)
+{
+ WNDCLASS wc;
+ MSG msg;
+
+ HInst = HInstance;
+
+ memset(&wc, 0, sizeof(WNDCLASS));
+
+ wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
+ wc.lpfnWndProc = MainWndProc;
+ wc.hInstance = HInstance;
+ wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
+ /* wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1); */
+ wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+ wc.lpszClassName = WndClassName;
+
+ if (RegisterClass(&wc))
+ {
+ HWND HWnd =
+ CreateWindow(
+ WndClassName, TEXT("BitBlt Bitmap Rendering Demo"),
+ WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
+ WS_VISIBLE | WS_CLIPSIBLINGS,
+ 0, 0, 220, 230,
+ NULL, NULL, HInst, NULL
+ );
+
+ if (HWnd)
+ {
+ ShowWindow(HWnd, nCmdShow);
+ UpdateWindow(HWnd);
+
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ }
+ return 0;
+}
+
+/* image related */
+BITMAP bmp;
+LPCSTR filename = TEXT("lena.bmp");
+HDC HMemDC = NULL;
+HBITMAP HOldBmp = NULL;
+
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam)
+{
+ switch (Msg)
+ {
+ case WM_CREATE:
+ {
+ /* create a memory DC */
+ HMemDC = CreateCompatibleDC(NULL);
+ if (HMemDC)
+ {
+ /* load a bitmap from file */
+ HBITMAP HBmp =
+ /* static_cast<HBITMAP> */(
+ LoadImage(HInst, MAKEINTRESOURCE(1000), IMAGE_BITMAP,
+ 0, 0, 0)
+ );
+ if (HBmp)
+ {
+ /* extract dimensions of the bitmap */
+ GetObject(HBmp, sizeof(BITMAP), &bmp);
+
+ /* associate the bitmap with the memory DC */
+ /* HOldBmp = static_cast<HBITMAP> */
+ (SelectObject(HMemDC, HBmp)
+ );
+ }
+ }
+ }
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ const HDC Hdc = BeginPaint(HWnd, &ps);
+#if 0
+ try
+#endif
+ {
+
+ /* TODO: add palette support (see Chapter 9)... */
+
+
+ BitBlt(Hdc, 20, 15,
+ bmp.bmWidth, bmp.bmHeight,
+ HMemDC, 0, 0,
+ SRCCOPY);
+ }
+#if 0
+ catch (...)
+#endif
+ {
+ EndPaint(HWnd, &ps);
+ }
+ EndPaint(HWnd, &ps);
+ break;
+ }
+ case WM_DESTROY:
+ {
+ /* clean up */
+ DeleteObject(SelectObject(HMemDC, HOldBmp));
+ DeleteDC(HMemDC);
+
+ PostQuitMessage(0);
+ return 0;
+ }
+ }
+ return DefWindowProc(HWnd, Msg, WParam, LParam);
+}
Propchange: trunk/rostests/dibtests/bitblt/bitblt.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bitblt/bitblt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bitblt/bitblt.rb…
==============================================================================
--- trunk/rostests/dibtests/bitblt/bitblt.rbuild (added)
+++ trunk/rostests/dibtests/bitblt/bitblt.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,9 @@
+<module name="bitblt" type="win32gui" installbase="bin"
installname="bitblt.exe">
+ <define name="__USE_W32API" />
+ <include base="bitblt">.</include>
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <file>bitblt.c</file>
+ <file>bitblt.rc</file>
+</module>
Propchange: trunk/rostests/dibtests/bitblt/bitblt.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bitblt/bitblt.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bitblt/bitblt.rc…
==============================================================================
--- trunk/rostests/dibtests/bitblt/bitblt.rc (added)
+++ trunk/rostests/dibtests/bitblt/bitblt.rc [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,2 @@
+1000 BITMAP MOVEABLE PURE "lena.bmp"
+
Propchange: trunk/rostests/dibtests/bitblt/bitblt.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/bitblt/lena.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/bitblt/lena.bmp?…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/bitblt/lena.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/dibtest/dibtest.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/dibtest/dibtest.…
==============================================================================
--- trunk/rostests/dibtests/dibtest/dibtest.c (added)
+++ trunk/rostests/dibtests/dibtest/dibtest.c [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,196 @@
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define CELL_SIZE 10
+
+static RGBQUAD Colors[] =
+{
+ { 0x00, 0x00, 0x00, 0x00 }, // black
+ { 0x00, 0x00, 0x80, 0x00 }, // red
+ { 0x00, 0x80, 0x00, 0x00 }, // green
+ { 0x00, 0x80, 0x80, 0x00 }, // brown
+ { 0x80, 0x00, 0x00, 0x00 }, // blue
+ { 0x80, 0x00, 0x80, 0x00 }, // magenta
+ { 0x80, 0x80, 0x00, 0x00 }, // cyan
+ { 0x80, 0x80, 0x80, 0x00 }, // dark gray
+ { 0xc0, 0xc0, 0xc0, 0x00 }, // light gray
+ { 0x00, 0x00, 0xFF, 0x00 }, // bright red
+ { 0x00, 0xFF, 0x00, 0x00 }, // bright green
+ { 0x00, 0xFF, 0xFF, 0x00 }, // bright yellow
+ { 0xFF, 0x00, 0x00, 0x00 }, // bright blue
+ { 0xFF, 0x00, 0xFF, 0x00 }, // bright magenta
+ { 0xFF, 0xFF, 0x00, 0x00 }, // bright cyan
+ { 0xFF, 0xFF, 0xFF, 0x00 } // bright white
+};
+
+LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
+
+int WINAPI
+WinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine,
+ int nCmdShow)
+{
+ WNDCLASS wc;
+ MSG msg;
+ HWND hWnd;
+
+ wc.lpszClassName = "DibTestClass";
+ wc.lpfnWndProc = MainWndProc;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ if (RegisterClass(&wc) == 0)
+ {
+ fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
+ GetLastError());
+ return(1);
+ }
+
+ hWnd = CreateWindow("DibTestClass",
+ "DIB Test",
+ WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 25 * CELL_SIZE + 5,
+ 25 * CELL_SIZE + 20,
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+ if (hWnd == NULL)
+ {
+ fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
+ GetLastError());
+ return(1);
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+
+ while(GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return msg.wParam;
+}
+
+static void PaintCells(HDC WindowDC, WORD BitCount1, WORD BitCount2,
+ int XDest, int YDest)
+{
+ HBRUSH Brush;
+ RECT Rect;
+ UINT row, col;
+ BITMAPINFO *BitmapInfo;
+ HBITMAP DIB1, DIB2;
+ HDC DC1, DC2;
+
+ BitmapInfo = malloc(sizeof(BITMAPINFO) + 15 * sizeof(RGBQUAD));
+ BitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ BitmapInfo->bmiHeader.biWidth = 4 * CELL_SIZE + 9;
+ BitmapInfo->bmiHeader.biHeight = -(4 * CELL_SIZE + 9); // it's top down (since
BI_RGB is used, the sign is operative of direction)
+ BitmapInfo->bmiHeader.biPlanes = 1;
+ BitmapInfo->bmiHeader.biBitCount = BitCount1;
+ BitmapInfo->bmiHeader.biCompression = BI_RGB;
+ BitmapInfo->bmiHeader.biSizeImage = 0;
+ BitmapInfo->bmiHeader.biXPelsPerMeter = 0;
+ BitmapInfo->bmiHeader.biYPelsPerMeter = 0;
+ BitmapInfo->bmiHeader.biClrUsed = 16;
+ BitmapInfo->bmiHeader.biClrImportant = 16;
+ for (col = 0; col < 16; col++) {
+ BitmapInfo->bmiColors[col] = Colors[col];
+ }
+ DIB1 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
+ DC1 = CreateCompatibleDC(NULL);
+ SelectObject(DC1, DIB1);
+
+ BitmapInfo->bmiHeader.biBitCount = BitCount2;
+ DIB2 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
+ DC2 = CreateCompatibleDC(NULL);
+ SelectObject(DC2, DIB2);
+ free(BitmapInfo);
+
+ /* Now paint on the first bitmap */
+ for (row = 0; row < 4; row++)
+ {
+ for (col = 0; col < 4; col++)
+ {
+ Brush = CreateSolidBrush(RGB(Colors[4 * row + col].rgbRed,
+ Colors[4 * row + col].rgbGreen,
+ Colors[4 * row + col].rgbBlue));
+ Rect.left = CELL_SIZE * col + 5;
+ Rect.top = CELL_SIZE * row + 5;
+ Rect.right = Rect.left + CELL_SIZE;
+ Rect.bottom = Rect.top + CELL_SIZE;
+ FillRect(DC1, &Rect, Brush);
+ DeleteObject(Brush);
+ }
+ }
+
+ /* Copy the first bitmap to the second */
+ BitBlt(DC2, 4, 4, 4 * CELL_SIZE, 4 * CELL_SIZE, DC1, 5, 5, SRCCOPY);
+
+ /* Show results on screen */
+ BitBlt(WindowDC, XDest, YDest, 4 * CELL_SIZE, 4 * CELL_SIZE, DC2, 4, 4, SRCCOPY);
+}
+
+LRESULT CALLBACK MainWndProc(HWND Wnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ PAINTSTRUCT ps;
+ HDC WindowDC;
+
+ switch(msg)
+ {
+ case WM_PAINT:
+ WindowDC = BeginPaint(Wnd, &ps);
+
+ PaintCells(WindowDC, 4, 4, 0, 0);
+ PaintCells(WindowDC, 4, 8, 5 * CELL_SIZE, 0);
+ PaintCells(WindowDC, 4, 16, 10 * CELL_SIZE, 0);
+ PaintCells(WindowDC, 4, 24, 15 * CELL_SIZE, 0);
+ PaintCells(WindowDC, 4, 32, 20 * CELL_SIZE, 0);
+
+ PaintCells(WindowDC, 8, 4, 0, 5 * CELL_SIZE);
+ PaintCells(WindowDC, 8, 8, 5 * CELL_SIZE, 5 * CELL_SIZE);
+ PaintCells(WindowDC, 8, 16, 10 * CELL_SIZE, 5 * CELL_SIZE);
+ PaintCells(WindowDC, 8, 24, 15 * CELL_SIZE, 5 * CELL_SIZE);
+ PaintCells(WindowDC, 8, 32, 20 * CELL_SIZE, 5 * CELL_SIZE);
+
+ PaintCells(WindowDC, 16, 4, 0, 10 * CELL_SIZE);
+ PaintCells(WindowDC, 16, 8, 5 * CELL_SIZE, 10 * CELL_SIZE);
+ PaintCells(WindowDC, 16, 16, 10 * CELL_SIZE, 10 * CELL_SIZE);
+ PaintCells(WindowDC, 16, 24, 15 * CELL_SIZE, 10 * CELL_SIZE);
+ PaintCells(WindowDC, 16, 32, 20 * CELL_SIZE, 10 * CELL_SIZE);
+
+ PaintCells(WindowDC, 24, 4, 0, 15 * CELL_SIZE);
+ PaintCells(WindowDC, 24, 8, 5 * CELL_SIZE, 15 * CELL_SIZE);
+ PaintCells(WindowDC, 24, 16, 10 * CELL_SIZE, 15 * CELL_SIZE);
+ PaintCells(WindowDC, 24, 24, 15 * CELL_SIZE, 15 * CELL_SIZE);
+ PaintCells(WindowDC, 24, 32, 20 * CELL_SIZE, 15 * CELL_SIZE);
+
+ PaintCells(WindowDC, 32, 4, 0, 20 * CELL_SIZE);
+ PaintCells(WindowDC, 32, 8, 5 * CELL_SIZE, 20 * CELL_SIZE);
+ PaintCells(WindowDC, 32, 16, 10 * CELL_SIZE, 20 * CELL_SIZE);
+ PaintCells(WindowDC, 32, 24, 15 * CELL_SIZE, 20 * CELL_SIZE);
+ PaintCells(WindowDC, 32, 32, 20 * CELL_SIZE, 20 * CELL_SIZE);
+
+ EndPaint(Wnd, &ps);
+ break;
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefWindowProc(Wnd, msg, wParam, lParam);
+ }
+
+ return 0;
+}
Propchange: trunk/rostests/dibtests/dibtest/dibtest.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/dibtest/dibtest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/dibtest/dibtest.…
==============================================================================
--- trunk/rostests/dibtests/dibtest/dibtest.rbuild (added)
+++ trunk/rostests/dibtests/dibtest/dibtest.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,7 @@
+<module name="dibtest" type="win32gui" installbase="bin"
installname="dibtest.exe">
+ <define name="__USE_W32API" />
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <file>dibtest.c</file>
+</module>
Propchange: trunk/rostests/dibtests/dibtest/dibtest.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/dibtests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/directory.rbuild…
==============================================================================
--- trunk/rostests/dibtests/directory.rbuild [iso-8859-1] (original)
+++ trunk/rostests/dibtests/directory.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,8 +1,29 @@
<?xml version="1.0"?>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <directory name="alphablend">
+ <xi:include href="alphablend/alphablend.rbuild" />
+ </directory>
+ <directory name="bitblt">
+ <xi:include href="bitblt/bitblt.rbuild" />
+ </directory>
<directory name="bltrop">
<xi:include href="bltrop/bltrop.rbuild" />
+ </directory>
+ <directory name="dibtest">
+ <xi:include href="dibtest/dibtest.rbuild" />
+ </directory>
+ <directory name="icontest">
+ <xi:include href="icontest/icontest.rbuild" />
+ </directory>
+ <directory name="palbitblt">
+ <xi:include href="palbitblt/palbitblt.rbuild" />
+ </directory>
+ <directory name="patblt">
+ <xi:include href="patblt/patblt.rbuild" />
+ </directory>
+ <directory name="stretchblt">
+ <xi:include href="stretchblt/stretchblt.rbuild" />
</directory>
<directory name="vbltest">
<xi:include href="vbltest/vbltest.rbuild" />
Added: trunk/rostests/dibtests/icontest/icon.ico
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/icontest/icon.ic…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/icontest/icon.ico
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/icontest/icontest.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/icontest/icontes…
==============================================================================
--- trunk/rostests/dibtests/icontest/icontest.c (added)
+++ trunk/rostests/dibtests/icontest/icontest.c [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,208 @@
+#include <windows.h>
+#include "resource.h"
+#include <string.h>
+#include <stdio.h>
+
+ULONG __cdecl DbgPrint(IN PCH Format, IN ...);
+
+const char titleDrwIco[] = "DrawIcon Output";
+const char titleMask[] = "Mask(AND image)";
+const char titleXor[] = "XOR(color image)";
+const char file[] = "Icon from file:";
+const char res[] = "Icon from Resorce:";
+const char cursor[] = "Current Cursor:";
+const char cursormask[] = "Cursor Mask Bitmap";
+const char cursorcolor[] = "Cursor Color Bitmap";
+
+HFONT tf;
+HINSTANCE hInst;
+
+LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
+
+int WINAPI
+WinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpszCmdLine,
+ int nCmdShow)
+{
+ WNDCLASS wc;
+ MSG msg;
+ HWND hWnd;
+
+ hInst = hInstance;
+
+ #ifdef _GetCursorInfo
+ GetCursorInfo =
(GETCURSORINFO)GetProcAddress(GetModuleHandleW(L"user32.dll"),
"GetCursorInfo");
+ #endif
+
+ wc.lpszClassName = "IconTestClass";
+ wc.lpfnWndProc = MainWndProc;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+ wc.lpszMenuName = NULL;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ if (RegisterClass(&wc) == 0)
+ {
+ DbgPrint("RegisterClass failed (last error 0x%X)\n", GetLastError());
+ return(1);
+ }
+
+ hWnd = CreateWindow("IconTestClass",
+ "Icon Test",
+ WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ 480,
+ 480,
+ NULL,
+ NULL,
+ hInstance,
+ NULL);
+ if (hWnd == NULL)
+ {
+ DbgPrint("CreateWindow failed (last error 0x%X)\n", GetLastError());
+ return(1);
+ }
+
+ tf = CreateFontA(14,0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
+ ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
+
+ ShowWindow(hWnd, nCmdShow);
+
+ SetTimer(hWnd, 1, 1000, NULL);
+
+ while(GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return msg.wParam;
+}
+
+LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ HICON hIcon;
+ HGDIOBJ hOld;
+ HDC hMemDC;
+ CURSORINFO cursorinfo;
+ ICONINFO iconinfo;
+ BITMAP bmp;
+ RECT rc;
+ CHAR str[20];
+
+ switch(msg)
+ {
+ case WM_PAINT:
+ hDC = BeginPaint(hWnd, &ps);
+ SelectObject(hDC, tf);
+ SetBkMode(hDC, TRANSPARENT);
+
+ TextOut(hDC, 160, 10, file, strlen(file));
+ TextOut(hDC, 15, 85, titleDrwIco, strlen(titleDrwIco));
+ TextOut(hDC, 160, 85, titleMask, strlen(titleMask));
+ TextOut(hDC, 300, 85, titleXor, strlen(titleXor));
+
+ hIcon = LoadImage(NULL, "icon.ico", IMAGE_ICON, 0, 0,
LR_DEFAULTSIZE|LR_LOADFROMFILE);
+ DrawIcon(hDC,50,50,hIcon);
+
+ hMemDC = CreateCompatibleDC(hDC);
+ GetIconInfo(hIcon, &iconinfo);
+ DestroyIcon(hIcon);
+
+ hOld = SelectObject(hMemDC, iconinfo.hbmMask);
+ BitBlt(hDC, 200, 50, 32, 32, hMemDC, 0, 0, SRCCOPY);
+ SelectObject(hMemDC, iconinfo.hbmColor);
+ BitBlt(hDC, 350, 50, 32, 32, hMemDC, 0, 0, SRCCOPY);
+
+ DeleteObject(iconinfo.hbmMask);
+ DeleteObject(iconinfo.hbmColor);
+
+ TextOut(hDC, 145, 150, res, strlen(res));
+ TextOut(hDC, 15, 225, titleDrwIco, strlen(titleDrwIco));
+ TextOut(hDC, 160, 225, titleMask, strlen(titleMask));
+ TextOut(hDC, 300, 225, titleXor, strlen(titleXor));
+
+ hIcon = LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0,
LR_DEFAULTSIZE);
+ DrawIcon(hDC,50,190,hIcon);
+
+ GetIconInfo(hIcon, &iconinfo);
+ DestroyIcon(hIcon);
+
+ SelectObject(hMemDC, iconinfo.hbmMask);
+ BitBlt(hDC, 200, 190, 32, 32, hMemDC, 0, 0, SRCCOPY);
+ SelectObject(hMemDC, iconinfo.hbmColor);
+ BitBlt(hDC, 350, 190, 32, 32, hMemDC, 0, 0, SRCCOPY);
+
+ DeleteObject(iconinfo.hbmMask);
+ DeleteObject(iconinfo.hbmColor);
+
+ cursorinfo.cbSize = sizeof(CURSORINFO);
+ if(GetCursorInfo(&cursorinfo))
+ {
+ if(cursorinfo.hCursor && cursorinfo.flags)
+ {
+ TextOut(hDC, 160, 290, cursor, strlen(cursor));
+ DrawIcon(hDC, 50, 330, cursorinfo.hCursor);
+ GetIconInfo(cursorinfo.hCursor, &iconinfo);
+ TextOut(hDC, 15, 365, titleDrwIco, strlen(titleDrwIco));
+
+ sprintf(str, "Hotspot: %ld; %ld", iconinfo.xHotspot,
iconinfo.yHotspot);
+ TextOut(hDC, 15, 380, str, strlen(str));
+
+ if(iconinfo.hbmMask)
+ {
+ GetObjectW(iconinfo.hbmMask, sizeof(BITMAP), &bmp);
+ SelectObject(hMemDC, iconinfo.hbmMask);
+ BitBlt(hDC, 200, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY);
+ DeleteObject(iconinfo.hbmMask);
+ TextOut(hDC, 160, 365 - 32 + bmp.bmHeight, cursormask, strlen(cursormask));
+
+ sprintf(str, "%dBPP", bmp.bmBitsPixel);
+ TextOut(hDC, 160, 380 - 32 + bmp.bmHeight, str, strlen(str));
+ }
+
+ if(iconinfo.hbmColor)
+ {
+ GetObjectW(iconinfo.hbmColor, sizeof(BITMAP), &bmp);
+ SelectObject(hMemDC, iconinfo.hbmColor);
+ BitBlt(hDC, 350, 330, bmp.bmWidth, bmp.bmHeight, hMemDC, 0, 0, SRCCOPY);
+ DeleteObject(iconinfo.hbmColor);
+ TextOut(hDC, 300, 365 - 32 + bmp.bmHeight, cursorcolor,
strlen(cursorcolor));
+
+ sprintf(str, "%dBPP", bmp.bmBitsPixel);
+ TextOut(hDC, 300, 380 - 32 + bmp.bmHeight, str, strlen(str));
+ }
+ }
+ }
+
+ SelectObject(hMemDC, hOld);
+
+ DeleteObject(hMemDC);
+ EndPaint(hWnd, &ps);
+ break;
+
+ case WM_TIMER:
+ rc.left = 0;
+ rc.top = 330;
+ rc.right = 480;
+ rc.bottom = 480;
+ InvalidateRect(hWnd, &rc, TRUE);
+ break;
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefWindowProc(hWnd, msg, wParam, lParam);
+ }
+ return 0;
+}
Propchange: trunk/rostests/dibtests/icontest/icontest.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/icontest/icontest.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/icontest/icontes…
==============================================================================
--- trunk/rostests/dibtests/icontest/icontest.rbuild (added)
+++ trunk/rostests/dibtests/icontest/icontest.rbuild [iso-8859-1] Mon Nov 17 11:28:14
2008
@@ -1,0 +1,10 @@
+<module name="icontest" type="win32gui"
installbase="bin" installname="icontest.exe">
+ <define name="__USE_W32API" />
+ <include base="icontest">.</include>
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <library>ntdll</library>
+ <file>icontest.c</file>
+ <file>icontest.rc</file>
+</module>
Propchange: trunk/rostests/dibtests/icontest/icontest.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/icontest/icontest.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/icontest/icontes…
==============================================================================
--- trunk/rostests/dibtests/icontest/icontest.rc (added)
+++ trunk/rostests/dibtests/icontest/icontest.rc [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,4 @@
+#include <windows.h>
+#include "resource.h"
+
+IDI_ICON ICON DISCARDABLE "icon.ico"
Propchange: trunk/rostests/dibtests/icontest/icontest.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/icontest/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/icontest/resourc…
==============================================================================
--- trunk/rostests/dibtests/icontest/resource.h (added)
+++ trunk/rostests/dibtests/icontest/resource.h [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,1 @@
+#define IDI_ICON 101
Propchange: trunk/rostests/dibtests/icontest/resource.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/palbitblt/pal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/palbitblt/pal.c?…
==============================================================================
--- trunk/rostests/dibtests/palbitblt/pal.c (added)
+++ trunk/rostests/dibtests/palbitblt/pal.c [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,201 @@
+/* The idea of this test app is inspired from tutorial *
+ * found at
http://www.theparticle.com/pgraph.html *
+ * *
+ * Developed by: Aleksey Bragin <aleksey(a)studiocerebral.com> *
+ * Version: 1.0 */
+
+#include <windows.h>
+#include <stdlib.h>
+
+#define W_WIDTH 320
+#define W_HEIGHT 240
+
+// special version of BITMAPINFO and LOGPALETTE for max of 256 palette entries
+typedef struct
+{
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[256];
+} BITMAPINFO256;
+
+typedef struct {
+ WORD palVersion;
+ WORD palNumEntries;
+ PALETTEENTRY palPalEntry[256];
+} LOGPALETTE256;
+
+// The only global variable --- contents of the DIBitmap
+BYTE* dibits;
+
+void GeneratePalette(RGBQUAD* p)
+{
+ int i;
+ for(i=0;i<256;i++)
+ {
+ p[i].rgbRed = i;
+ p[i].rgbGreen = i;
+ p[i].rgbBlue = i;
+ p[i].rgbReserved = 0;
+ }
+}
+
+void DoBlt(HBITMAP hBM)
+{
+ HDC hDC,Context;
+ HWND ActiveWindow;
+ RECT dest;
+ HBITMAP dflBmp;
+
+ if((ActiveWindow = GetActiveWindow()) == NULL)
+ return;
+
+ hDC = GetDC(ActiveWindow);
+ GetClientRect(ActiveWindow,&dest);
+
+ Context = CreateCompatibleDC(0);
+ dflBmp = SelectObject(Context, hBM);
+ BitBlt(hDC, 0, 0, dest.right, dest.bottom, Context, 0, 0, SRCCOPY);
+ SelectObject(Context, dflBmp);
+ DeleteDC(Context);
+ DeleteObject(dflBmp);
+ ReleaseDC(ActiveWindow, hDC);
+}
+
+void UpdatePalette(HBITMAP hBM){
+ int i,y;
+ static unsigned int c=0;
+
+ for(i=0;i<W_WIDTH;i++){
+ for(y=0;y<=W_HEIGHT-1;y++)
+ dibits[y*320+i] = c % 256;
+
+ if (c > 512)
+ c = 0;
+ else
+ c++; // It's operation of incrementing of c variable, not reference of a cool OO
language :-)
+ }
+
+ DoBlt(hBM);
+}
+
+void InitBitmap(HANDLE *hBM){
+ HPALETTE PalHan;
+ HWND ActiveWindow;
+ HDC hDC;
+ RGBQUAD palette[256];
+ int i;
+ BITMAPINFO256 bmInf;
+ LOGPALETTE256 palInf;
+
+ ActiveWindow = GetActiveWindow();
+ hDC = GetDC(ActiveWindow);
+
+ bmInf.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInf.bmiHeader.biWidth = W_WIDTH;
+ bmInf.bmiHeader.biHeight = -abs(W_HEIGHT);
+ bmInf.bmiHeader.biPlanes = 1;
+ bmInf.bmiHeader.biBitCount = 8;
+ bmInf.bmiHeader.biCompression = BI_RGB;
+ bmInf.bmiHeader.biSizeImage = 0;
+ bmInf.bmiHeader.biXPelsPerMeter = 0;
+ bmInf.bmiHeader.biYPelsPerMeter = 0;
+ bmInf.bmiHeader.biClrUsed = 256;
+ bmInf.bmiHeader.biClrImportant = 256;
+
+ GeneratePalette(palette);
+
+ for(i=0;i<256;i++)
+ bmInf.bmiColors[i] = palette[i];
+
+ palInf.palVersion = 0x300;
+ palInf.palNumEntries = 256;
+ for(i=0;i<256;i++){
+ palInf.palPalEntry[i].peRed = palette[i].rgbRed;
+ palInf.palPalEntry[i].peGreen = palette[i].rgbGreen;
+ palInf.palPalEntry[i].peBlue = palette[i].rgbBlue;
+ palInf.palPalEntry[i].peFlags = PC_NOCOLLAPSE;
+ }
+
+ // Create palette
+ PalHan = CreatePalette((LOGPALETTE*)&palInf);
+
+ // Select it into hDC
+ SelectPalette(hDC,PalHan,FALSE);
+
+ // Realize palette in hDC
+ RealizePalette(hDC);
+
+ // Delete handle to palette
+ DeleteObject(PalHan);
+
+ // Create dib section
+ *hBM = CreateDIBSection(hDC,(BITMAPINFO*)&bmInf,
+ DIB_RGB_COLORS,(void**)&dibits,0,0);
+
+ // Release dc
+ ReleaseDC(ActiveWindow,hDC);
+}
+
+LRESULT CALLBACK WndProc(HWND hWnd,UINT msg, WPARAM wParam,LPARAM lParam)
+{
+ switch(msg){
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+ default:
+ return DefWindowProc(hWnd,msg,wParam,lParam);
+ }
+}
+
+
+
+int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpszCmdParam,int
nCmdShow)
+{
+ WNDCLASS WndClass;
+ HWND hWnd;
+ MSG msg;
+ char szName[] = "Palette BitBlt test";
+ BOOL exit = FALSE;
+ HBITMAP hBM;
+
+ // Create and register window class (not modified!!!!!!!!!!!1)
+ WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
+ WndClass.lpfnWndProc = WndProc;
+ WndClass.cbClsExtra = 0;
+ WndClass.cbWndExtra = 0;
+ WndClass.hbrBackground = NULL;//GetStockObject(BLACK_BRUSH);
+ WndClass.hIcon = NULL;//LoadIcon(hInstance,NULL);
+ WndClass.hCursor = NULL;//LoadCursor(NULL,IDC_ARROW);
+ WndClass.hInstance = hInstance;
+ WndClass.lpszClassName = szName;
+ WndClass.lpszMenuName = 0;
+
+ RegisterClass(&WndClass);
+
+ // Create and show window (change styles !!!!!!!!)
+ hWnd = CreateWindow(szName, "ReactOS palette bitblt test",
+ WS_CAPTION|WS_MINIMIZEBOX|WS_SYSMENU,
+ CW_USEDEFAULT,CW_USEDEFAULT,W_WIDTH,W_HEIGHT,
+ 0,0,hInstance,0);
+ ShowWindow(hWnd,nCmdShow);
+
+ // Prepare bitmap to be bitblt
+ InitBitmap(&hBM);
+
+ // Main message loop
+ while (!exit)
+ {
+ UpdatePalette(hBM);
+ Sleep(200);
+
+ if(PeekMessage(&msg,0,0,0,PM_NOREMOVE) == TRUE)
+ {
+ if (!GetMessage(&msg,0,0,0))
+ exit = TRUE;
+
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+
+ return msg.wParam;
+}
Propchange: trunk/rostests/dibtests/palbitblt/pal.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/palbitblt/palbitblt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/palbitblt/palbit…
==============================================================================
--- trunk/rostests/dibtests/palbitblt/palbitblt.rbuild (added)
+++ trunk/rostests/dibtests/palbitblt/palbitblt.rbuild [iso-8859-1] Mon Nov 17 11:28:14
2008
@@ -1,0 +1,7 @@
+<module name="palbitblt" type="win32gui"
installbase="bin" installname="palbitblt.exe"
allowwarnings="true" stdlib="host">
+ <define name="__USE_W32API" />
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <file>pal.c</file>
+</module>
Propchange: trunk/rostests/dibtests/palbitblt/palbitblt.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/patblt/Penguin.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/patblt/Penguin.b…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/patblt/Penguin.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/patblt/patblt.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/patblt/patblt.cp…
==============================================================================
--- trunk/rostests/dibtests/patblt/patblt.cpp (added)
+++ trunk/rostests/dibtests/patblt/patblt.cpp [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,270 @@
+
+// ------------------------------------------------------------------
+// Windows 2000 Graphics API Black Book
+// Chapter 2 - Listing 2.1 (PatBlt Tracking Rect Demo)
+//
+// Created by Damon Chandler <dmc27(a)ee.cornell.edu>
+// Updates can be downloaded at: <www.coriolis.com>
+//
+// Please do not hesistate to e-mail me at dmc27(a)ee.cornell.edu
+// if you have any questions about this code.
+// ------------------------------------------------------------------
+
+
+//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+#include <windows.h>
+//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+HINSTANCE HInst;
+const char* WndClassName = "GMainWnd";
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam);
+
+
+int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE, LPTSTR,
+ int nCmdShow)
+{
+ HInst = HInstance;
+
+ WNDCLASS wc;
+ memset(&wc, 0, sizeof(WNDCLASS));
+
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.lpszClassName = WndClassName;
+ wc.lpfnWndProc = MainWndProc;
+ wc.hInstance = HInstance;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = static_cast<HBRUSH>(
+ GetStockObject(BLACK_BRUSH)
+ );
+
+ if (RegisterClass(&wc))
+ {
+ HWND HWnd =
+ CreateWindow(WndClassName,
+ TEXT("PatBlt Tracking Rect Demo"),
+ WS_OVERLAPPEDWINDOW | WS_CAPTION |
+ WS_VISIBLE | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
+ NULL, NULL, HInst, NULL);
+
+ if (HWnd)
+ {
+ ShowWindow(HWnd, nCmdShow);
+ UpdateWindow(HWnd);
+
+ MSG msg;
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ }
+ return 0;
+}
+//------------------------------------------------------------------
+
+
+// image related
+HDC HMemDC = NULL;
+HBITMAP HOldBmp = NULL;
+const char* filename = "PENGUIN.BMP";
+RECT RImage = {225, 110, 225, 110};
+
+// tracking related
+bool is_tracking = false;
+HDC HScreenDC = NULL;
+POINT PMouse = {0, 0};
+RECT RTrack = {0, 0, 0, 0};
+const int line_width = 5;
+
+
+// utility function to map to/from window coordinates
+void MapRect(IN HWND HWndFrom, IN HWND HWndTo, IN OUT RECT& RMap)
+{
+ MapWindowPoints(
+ HWndFrom, HWndTo,
+ reinterpret_cast<LPPOINT>(&RMap), 2
+ );
+}
+//------------------------------------------------------------------
+
+
+// utility function that uses the PatBlt function to
+// render a tracking rectangle
+void RenderTrackingRect(IN HDC HDestDC, IN const RECT& RRender)
+{
+ const int width = RRender.right - RRender.left;
+ const int height = RRender.bottom - RRender.top;
+ const DWORD dwROP3 = DSTINVERT; // experiment with others
+
+ // render top bar
+ PatBlt(HDestDC,
+ RRender.left, RRender.top,
+ width, line_width,
+ dwROP3);
+ // render bottom bar
+ PatBlt(HDestDC,
+ RRender.left, RRender.bottom - line_width,
+ width, line_width,
+ dwROP3);
+ // render left bar
+ PatBlt(HDestDC,
+ RRender.left, RRender.top + line_width,
+ line_width, height - (2 * line_width),
+ dwROP3);
+ // render right bar
+ PatBlt(HDestDC,
+ RRender.right - line_width, RRender.top + line_width,
+ line_width, height - (2 * line_width),
+ dwROP3);
+
+}
+//------------------------------------------------------------------
+
+
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam)
+{
+ switch (Msg)
+ {
+ case WM_CREATE:
+ {
+ // create a memory DC
+ HMemDC = CreateCompatibleDC(NULL);
+ if (HMemDC)
+ {
+ // load the penguin bitmap
+ HBITMAP HBmp = static_cast<HBITMAP>(
+ LoadImage(HInst, filename, IMAGE_BITMAP, 0, 0,
+ LR_LOADFROMFILE | LR_DEFAULTSIZE)
+ );
+ if (HBmp)
+ {
+ // get the bitmap's dimensions
+ BITMAP bmp;
+ if (GetObject(HBmp, sizeof(BITMAP), &bmp))
+ {
+ RImage.right += bmp.bmWidth;
+ RImage.bottom += bmp.bmHeight;
+
+ // realize the bitmap
+ HOldBmp = static_cast<HBITMAP>(
+ SelectObject(HMemDC, HBmp)
+ );
+ }
+ else DeleteObject(HBmp);
+ }
+ }
+ break;
+ }
+ case WM_LBUTTONDOWN:
+ {
+ PMouse.x = LOWORD(LParam);
+ PMouse.y = HIWORD(LParam);
+
+ RECT RClient;
+ if (PtInRect(&RImage, PMouse) &&
+ GetClientRect(HWnd, &RClient))
+ {
+ MapRect(HWnd, HWND_DESKTOP, RClient);
+ ClipCursor(&RClient);
+
+ // grab a handle to the screen DC and clip
+ // all output to the client area of our window
+ HScreenDC = GetDC(NULL);
+ HRGN HClipRgn = CreateRectRgnIndirect(&RClient);
+ SelectClipRgn(HScreenDC, HClipRgn);
+ DeleteObject(HClipRgn);
+
+ CopyRect(&RTrack, &RImage);
+ MapRect(HWnd, HWND_DESKTOP, RTrack);
+
+ // render the first tracking rect
+ RenderTrackingRect(HScreenDC, RTrack);
+ is_tracking = true;
+ }
+ break;
+ }
+ case WM_MOUSEMOVE:
+ {
+ if (HScreenDC && is_tracking)
+ {
+ POINT PCurrent = {LOWORD(LParam), HIWORD(LParam)};
+ const int dX = PCurrent.x - PMouse.x;
+ const int dY = PCurrent.y - PMouse.y;
+
+ // erase the previous rectangle
+ RenderTrackingRect(HScreenDC, RTrack);
+ // update the postion
+ OffsetRect(&RTrack, dX, dY);
+ // render the new tracking rectangle
+ RenderTrackingRect(HScreenDC, RTrack);
+
+ // update the mouse position
+ memcpy(&PMouse, &PCurrent, sizeof(POINT));
+ }
+ break;
+ }
+ case WM_LBUTTONUP:
+ {
+ // clean up
+ if (is_tracking)
+ {
+ is_tracking = false;
+ SelectClipRgn(HScreenDC, NULL);
+ ReleaseDC(NULL, HScreenDC);
+
+ InvalidateRect(HWnd, &RImage, true);
+ CopyRect(&RImage, &RTrack);
+ MapRect(HWND_DESKTOP, HWnd, RImage);
+ InvalidateRect(HWnd, &RImage, true);
+
+ ClipCursor(NULL);
+ }
+ break;
+ }
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ HDC Hdc = BeginPaint(HWnd, &ps);
+ try
+ {
+ //
+ // TODO: Add palette support...
+ //
+
+ // render the penguin
+ BitBlt(Hdc, RImage.left, RImage.top,
+ RImage.right - RImage.left,
+ RImage.bottom - RImage.top,
+ HMemDC, 0, 0,
+ SRCCOPY);
+ }
+ catch (...)
+ {
+ EndPaint(HWnd, &ps);
+ }
+ EndPaint(HWnd, &ps);
+ break;
+ }
+ case WM_DESTROY:
+ {
+ // clean up
+ if (HOldBmp)
+ {
+ DeleteObject(SelectObject(HMemDC, HOldBmp));
+ }
+ if (HMemDC)
+ {
+ DeleteDC(HMemDC);
+ }
+ PostQuitMessage(0);
+ return 0;
+ }
+ }
+ return DefWindowProc(HWnd, Msg, WParam, LParam);
+}
+//------------------------------------------------------------------
Propchange: trunk/rostests/dibtests/patblt/patblt.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/patblt/patblt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/patblt/patblt.rb…
==============================================================================
--- trunk/rostests/dibtests/patblt/patblt.rbuild (added)
+++ trunk/rostests/dibtests/patblt/patblt.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -1,0 +1,7 @@
+<module name="patblt" type="win32gui" installbase="bin"
installname="patblt.exe" allowwarnings="true"
stdlib="host">
+ <define name="__USE_W32API" />
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <file>patblt.cpp</file>
+</module>
Propchange: trunk/rostests/dibtests/patblt/patblt.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/stretchblt/lena.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/stretchblt/lena.…
==============================================================================
Binary file - no diff available.
Propchange: trunk/rostests/dibtests/stretchblt/lena.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/rostests/dibtests/stretchblt/stretchblt.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/stretchblt/stret…
==============================================================================
--- trunk/rostests/dibtests/stretchblt/stretchblt.cpp (added)
+++ trunk/rostests/dibtests/stretchblt/stretchblt.cpp [iso-8859-1] Mon Nov 17 11:28:14
2008
@@ -1,0 +1,380 @@
+
+// ------------------------------------------------------------------
+// Windows 2000 Graphics API Black Book
+// Chapter 1 - Listing 1.5 (StretchBlt Zooming Demo)
+//
+// Created by Damon Chandler <dmc27(a)ee.cornell.edu>
+// Updates can be downloaded at: <www.coriolis.com>
+//
+// Please do not hesistate to e-mail me at dmc27(a)ee.cornell.edu
+// if you have any questions about this code.
+// ------------------------------------------------------------------
+
+// Modified by Aleksey Bragin (aleksey at
studiocerebral.com)
+// to support non-uniform scaling, and output via sretchdibits
+// (type something in the command line to invoke this mode,
+// in future it will be source BPP)
+
+//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+#include <windows.h>
+#include <stdio.h>
+//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+HWND HListBox = NULL;
+HWND VListBox = NULL;
+const int ID_LISTBOX = 101;
+const int ID_LISTBOX2 = 102;
+BOOL useDIBits=FALSE; // How to display the image - via StretchDIBits
+
+HINSTANCE HInst;
+HINSTANCE HPrevInst;
+TCHAR *cmdline;
+const char* WndClassName = "GMainWnd";
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam);
+
+
+int APIENTRY WinMain(HINSTANCE HInstance, HINSTANCE HPrevInstance,
+ LPTSTR lpCmdLine, int nCmdShow)
+{
+ HInst = HInstance;
+ HPrevInst = HPrevInstance;
+ cmdline = lpCmdLine;
+
+ WNDCLASS wc;
+ memset(&wc, 0, sizeof(WNDCLASS));
+
+ wc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
+ wc.lpfnWndProc = MainWndProc;
+ wc.hInstance = HInstance;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1);
+ wc.lpszClassName = WndClassName;
+
+ if (RegisterClass(&wc))
+ {
+ HWND HWnd =
+ CreateWindow(WndClassName, TEXT("StretchBlt NonUniform Zooming
Demo"),
+ WS_OVERLAPPEDWINDOW | WS_CAPTION |
+ WS_VISIBLE | WS_CLIPSIBLINGS,
+ 0, 0, 675, 560,
+ NULL, NULL, HInst, NULL);
+
+ if (HWnd)
+ {
+ HListBox =
+ CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "",
+ LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
+ 530, 5, 130, 150, HWnd,
+ reinterpret_cast<HMENU>(ID_LISTBOX),
+ HInst, NULL);
+ VListBox =
+ CreateWindowEx(WS_EX_CLIENTEDGE, "LISTBOX", "",
+ LBS_NOTIFY | WS_CHILD | WS_VISIBLE,
+ 530, 5+170, 130, 150, HWnd,
+ reinterpret_cast<HMENU>(ID_LISTBOX2),
+ HInst, NULL);
+
+ if (HListBox && VListBox)
+ {
+// horizontal zoom
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 25%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 50%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 75%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 100%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 125%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 150%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 200%"));
+ SNDMSG(HListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 300%"));
+// vertical zoom
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 25%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 50%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 75%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 100%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 125%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 150%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 200%"));
+ SNDMSG(VListBox, LB_ADDSTRING, 0,
+ reinterpret_cast<LPARAM>("Zoom 300%"));
+
+ }
+
+ ShowWindow(HWnd, nCmdShow);
+ UpdateWindow(HWnd);
+
+ MSG msg;
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ }
+ return 0;
+}
+//------------------------------------------------------------------
+
+
+// image related
+BITMAP bmp;
+BITMAPINFO bmInfo;
+char *bbits = NULL; // bitmap bits
+const char* filename = "LENA.BMP";
+HDC HMemDC = NULL;
+HBITMAP HOldBmp = NULL;
+
+// zooming related
+float zoom_factor_h = 0.5;
+float zoom_factor_v = 0.5;
+RECT RDest = {5, 5, 0, 0};
+enum {ID_ZOOM25, ID_ZOOM50, ID_ZOOM75, ID_ZOOM100,
+ ID_ZOOM125, ID_ZOOM150, ID_ZOOM200, ID_ZOOM300};
+
+LRESULT CALLBACK MainWndProc(HWND HWnd, UINT Msg, WPARAM WParam,
+ LPARAM LParam)
+{
+ switch (Msg)
+ {
+ case WM_CREATE:
+ {
+ // check commandline
+ if (strlen(cmdline) != 0)
+ {
+
+ useDIBits = TRUE;
+ }
+ else
+ useDIBits = FALSE;
+
+ // create a memory DC
+ HMemDC = CreateCompatibleDC(NULL);
+ if (HMemDC)
+ {
+ // load a bitmap from file
+ HBITMAP HBmp =
+ static_cast<HBITMAP>(
+ LoadImage(HInst, filename, IMAGE_BITMAP,
+ 0, 0, LR_LOADFROMFILE)
+ );
+ if (HBmp)
+ {
+ // extract dimensions of the bitmap
+ GetObject(HBmp, sizeof(BITMAP), &bmp);
+
+ // fill the BITMAPINFO stucture for further use by StretchDIBits
+ bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo.bmiHeader.biWidth = bmp.bmWidth;
+ bmInfo.bmiHeader.biHeight = bmp.bmHeight;
+ bmInfo.bmiHeader.biPlanes = 1;//bmp.bmPlanes;
+ bmInfo.bmiHeader.biBitCount = bmp.bmBitsPixel;
+ bmInfo.bmiHeader.biCompression = BI_RGB;
+ bmInfo.bmiHeader.biSizeImage = 0;
+ bmInfo.bmiHeader.biXPelsPerMeter = 0;
+ bmInfo.bmiHeader.biClrImportant = 0;
+ bmInfo.bmiHeader.biClrUsed = 0;
+
+ // associate the bitmap with the memory DC
+ HOldBmp = static_cast<HBITMAP>(
+ SelectObject(HMemDC, HBmp)
+ );
+
+ if (useDIBits)
+ {
+ bbits = new char[bmp.bmHeight*bmp.bmWidthBytes*(bmp.bmBitsPixel / 8)];
+ //GetDIBits(HMemDC, HBmp, 0, bmp.bmHeight, bbits, &bmInfo, DIB_RGB_COLORS);
+
+ // Here goes a temp hack, since GetDIBits doesn't exist in ReactOS yet
+ FILE *f = fopen(filename, "rb");
+ BITMAPFILEHEADER bmpHeader;
+
+ fread(&bmpHeader, sizeof(BITMAPFILEHEADER), 1, f);
+ fread(&bmInfo, sizeof(BITMAPINFO), 1, f);
+ fseek(f, bmpHeader.bfOffBits, SEEK_SET);
+ fread(bbits, bmp.bmHeight*bmp.bmWidthBytes*(bmp.bmBitsPixel / 8), 1, f);
+
+ fclose(f);
+ }
+ }
+ }
+ }
+ case WM_COMMAND:
+ {
+ if (WParam == MAKEWPARAM(ID_LISTBOX, LBN_SELCHANGE) ||
+ WParam == MAKEWPARAM(ID_LISTBOX2, LBN_SELCHANGE))
+ {
+ switch (SNDMSG(HListBox, LB_GETCURSEL, 0, 0))
+ {
+ case ID_ZOOM25: zoom_factor_h = 0.25; break;
+ case ID_ZOOM50: zoom_factor_h = 0.50; break;
+ case ID_ZOOM75: zoom_factor_h = 0.75; break;
+ case ID_ZOOM100: zoom_factor_h = 1.00; break;
+ case ID_ZOOM125: zoom_factor_h = 1.25; break;
+ case ID_ZOOM150: zoom_factor_h = 1.50; break;
+ case ID_ZOOM200: zoom_factor_h = 2.00; break;
+ case ID_ZOOM300: zoom_factor_h = 3.00; break;
+ }
+
+ switch (SNDMSG(VListBox, LB_GETCURSEL, 0, 0))
+ {
+ case ID_ZOOM25: zoom_factor_v = 0.25; break;
+ case ID_ZOOM50: zoom_factor_v = 0.50; break;
+ case ID_ZOOM75: zoom_factor_v = 0.75; break;
+ case ID_ZOOM100: zoom_factor_v = 1.00; break;
+ case ID_ZOOM125: zoom_factor_v = 1.25; break;
+ case ID_ZOOM150: zoom_factor_v = 1.50; break;
+ case ID_ZOOM200: zoom_factor_v = 2.00; break;
+ case ID_ZOOM300: zoom_factor_v = 3.00; break;
+ }
+
+ // calculate the new width and height
+ const int new_width =
+ static_cast<int>(zoom_factor_h * bmp.bmWidth);
+ const int new_height =
+ static_cast<int>(zoom_factor_v * bmp.bmHeight);
+
+ // is zooming in?
+ bool zoom_in = (new_width > RDest.right - RDest.left);
+
+ // caculate the area that needs to be updated
+ RECT RUpdate = {
+ RDest.left, RDest.top,
+ RDest.left + max(new_width, RDest.right - RDest.left),
+ RDest.top + max(new_height, RDest.bottom - RDest.top)
+ };
+
+ // adjust the dimenstions of the
+ // destination rectangle
+ RDest.right = RDest.left + new_width;
+ RDest.bottom = RDest.top + new_height;
+
+ // create an update region from the XOR combination
+ // of the update and destination rectangles
+ HRGN HUpdateRgn = CreateRectRgnIndirect(&RUpdate);
+ HRGN HDestRgn = CreateRectRgnIndirect(&RDest);
+ int result =
+ CombineRgn(HUpdateRgn, HUpdateRgn, HDestRgn, RGN_XOR);
+
+ // incite a repaint
+ if (result != NULLREGION && result != ERROR)
+ {
+ InvalidateRgn(HWnd, HUpdateRgn, true);
+ RedrawWindow(HWnd, &RDest, NULL, RDW_NOERASE | RDW_INVALIDATE);
+ }
+ else if (result == NULLREGION)
+ {
+ InvalidateRect(HWnd, &RUpdate, zoom_in ? false : true);
+ }
+
+ // clean up
+ DeleteObject(HUpdateRgn);
+ DeleteObject(HDestRgn);
+ }
+ break;
+ }
+ case WM_PAINT:
+ {
+ PAINTSTRUCT ps;
+ const HDC Hdc = BeginPaint(HWnd, &ps);
+#if 0
+ try
+#endif
+ {
+ //
+ // TODO: add palette support (see Chapter 9)...
+ //
+ if (useDIBits)
+ {
+ if (RDest.right - RDest.left > 0)
+ {
+ if (zoom_factor_h < 1.0 || zoom_factor_v < 1.0)
+ {
+ SetStretchBltMode(Hdc, COLORONCOLOR);
+ }
+
+ // render the zoomed image
+ StretchDIBits(Hdc, RDest.left, RDest.top,
+ RDest.right - RDest.left,
+ RDest.bottom - RDest.top,
+ 0, 0,
+ bmp.bmWidth, bmp.bmHeight,
+ bbits, &bmInfo,
+ DIB_RGB_COLORS,
+ SRCCOPY);
+ }
+ }
+ else
+ {
+ if (RDest.right - RDest.left > 0)
+ {
+
+ // use BitBlt when not zooming
+ if (zoom_factor_h == 1.0 && zoom_factor_v == 1.0)
+ {
+ BitBlt(Hdc, RDest.left, RDest.top,
+ RDest.right - RDest.left,
+ RDest.bottom - RDest.top,
+ HMemDC, 0, 0,
+ SRCCOPY);
+ }
+ else
+ {
+ if (zoom_factor_h < 1.0 || zoom_factor_v < 1.0)
+ {
+ SetStretchBltMode(Hdc, COLORONCOLOR);
+ }
+
+ // render the zoomed image
+ StretchBlt(Hdc, RDest.left, RDest.top,
+ RDest.right - RDest.left,
+ RDest.bottom - RDest.top,
+ HMemDC, 0, 0,
+ bmp.bmWidth, bmp.bmHeight,
+ SRCCOPY);
+ }
+ }
+ }
+ }
+#if 0
+ catch (...)
+#endif
+ {
+ EndPaint(HWnd, &ps);
+ }
+ EndPaint(HWnd, &ps);
+ break;
+ }
+ case WM_DESTROY:
+ {
+ // clean up
+ DeleteObject(SelectObject(HMemDC, HOldBmp));
+ DeleteDC(HMemDC);
+
+ if (bbits)
+ delete[] bbits;
+
+ PostQuitMessage(0);
+ return 0;
+ }
+ }
+ return DefWindowProc(HWnd, Msg, WParam, LParam);
+}
+//------------------------------------------------------------------
+
+
+
Propchange: trunk/rostests/dibtests/stretchblt/stretchblt.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/rostests/dibtests/stretchblt/stretchblt.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dibtests/stretchblt/stret…
==============================================================================
--- trunk/rostests/dibtests/stretchblt/stretchblt.rbuild (added)
+++ trunk/rostests/dibtests/stretchblt/stretchblt.rbuild [iso-8859-1] Mon Nov 17 11:28:14
2008
@@ -1,0 +1,7 @@
+<module name="stretchblt" type="win32gui"
installbase="bin" installname="stretchblt.exe"
stdlib="host">
+ <define name="__USE_W32API" />
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>gdi32</library>
+ <file>stretchblt.cpp</file>
+</module>
Propchange: trunk/rostests/dibtests/stretchblt/stretchblt.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/directory.rbuild?rev=3741…
==============================================================================
--- trunk/rostests/directory.rbuild [iso-8859-1] (original)
+++ trunk/rostests/directory.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -3,6 +3,9 @@
<group
xmlns:xi="http://www.w3.org/2001/XInclude">
<directory name="drivers">
<xi:include href="drivers/directory.rbuild" />
+ </directory>
+ <directory name="dibtests">
+ <xi:include href="dibtests/directory.rbuild" />
</directory>
<directory name="dxtest">
<xi:include href="dxtest/directory.rbuild" />
Modified: trunk/rostests/tests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/directory.rbuild?re…
==============================================================================
--- trunk/rostests/tests/directory.rbuild [iso-8859-1] (original)
+++ trunk/rostests/tests/directory.rbuild [iso-8859-1] Mon Nov 17 11:28:14 2008
@@ -7,9 +7,6 @@
<directory name="alive">
<xi:include href="alive/alive.rbuild" />
</directory>
- <directory name="alphablend">
- <xi:include href="alphablend/alphablend.rbuild" />
- </directory>
<directory name="apc">
<xi:include href="apc/apc.rbuild" />
</directory>
@@ -25,9 +22,6 @@
<directory name="bench">
<xi:include href="bench/bench.rbuild" />
</directory>
- <directory name="bitblt">
- <xi:include href="bitblt/bitblt.rbuild" />
- </directory>
<directory name="button">
<xi:include href="button/button.rbuild" />
</directory>
@@ -55,9 +49,6 @@
<directory name="create-links">
<xi:include href="create-links/create-links.rbuild" />
</directory>
- <directory name="dibtest">
- <xi:include href="dibtest/dibtest.rbuild" />
- </directory>
<directory name="dirdlg">
<xi:include href="dirdlg/dirdlg.rbuild" />
</directory>
@@ -115,9 +106,6 @@
<directory name="hivetest">
<xi:include href="hivetest/hivetest.rbuild" />
</directory>
- <directory name="icontest">
- <xi:include href="icontest/icontest.rbuild" />
- </directory>
<directory name="Imagelistviewer">
<xi:include href="Imagelistviewer/imagelistviewer.rbuild" />
</directory>
@@ -177,12 +165,6 @@
<!-- fixme: oskittcp -->
- <directory name="palbitblt">
- <xi:include href="palbitblt/palbitblt.rbuild" />
- </directory>
- <directory name="patblt">
- <xi:include href="patblt/patblt.rbuild" />
- </directory>
<directory name="polytest">
<xi:include href="polytest/polytest.rbuild" />
</directory>
@@ -228,9 +210,6 @@
<directory name="statst2">
<xi:include href="statst2/statst2.rbuild" />
</directory>
- <directory name="stretchblt">
- <xi:include href="stretchblt/stretchblt.rbuild" />
- </directory>
<directory name="subclass">
<xi:include href="subclass/subclass.rbuild" />
</directory>