ReactOS 0.4.15-dev-8100-g1887773
linetest.c File Reference
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
Include dependency graph for linetest.c:

Go to the source code of this file.

Macros

#define red   RGB(255,0,0)
 
#define grn   RGB(0,255,0)
 
#define blu   RGB(0,0,255)
 
#define blk   RGB(0,0,0)
 

Functions

LRESULT WINAPI MainWndProc (HWND, UINT, WPARAM, LPARAM)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 
static void DrawLines (HDC hDC)
 

Variables

const TCHARCLASS_NAME = _T("LineTestClass")
 

Macro Definition Documentation

◆ blk

#define blk   RGB(0,0,0)

Definition at line 70 of file linetest.c.

◆ blu

#define blu   RGB(0,0,255)

Definition at line 69 of file linetest.c.

◆ grn

#define grn   RGB(0,255,0)

Definition at line 68 of file linetest.c.

◆ red

Definition at line 67 of file linetest.c.

Referenced by _mesa_ClearAccum(), _mesa_ClearColor(), _mesa_Color3b(), _mesa_Color3d(), _mesa_Color3f(), _mesa_Color3i(), _mesa_Color3s(), _mesa_Color3ub(), _mesa_Color3ui(), _mesa_Color3us(), _mesa_Color4b(), _mesa_Color4d(), _mesa_Color4f(), _mesa_Color4i(), _mesa_Color4s(), _mesa_Color4ub(), _mesa_Color4ui(), _mesa_Color4us(), _mesa_ColorMask(), antialiased_rgba_points(), apply_image_attributes(), apply_texture(), clear_color_buffer_with_masking(), ColorTest(), convert_r16g16(), convert_r32g32_float(), copy_depth_pixels(), copy_rgb_pixels(), copy_tex_sub_image(), copypixels_to_32bppBGRA(), d3drm1_CreateLightRGB(), d3drm2_CreateLightRGB(), d3drm3_CreateLightRGB(), d3drm_face1_SetColorRGB(), d3drm_face2_SetColorRGB(), d3drm_frame1_SetColorRGB(), d3drm_frame1_SetSceneBackgroundRGB(), d3drm_frame2_SetColorRGB(), d3drm_frame2_SetSceneBackgroundRGB(), d3drm_frame3_SetColorRGB(), d3drm_frame3_SetSceneBackgroundRGB(), d3drm_light_SetColorRGB(), d3drm_mesh_builder2_SetColorRGB(), d3drm_mesh_builder2_SetVertexColorRGB(), d3drm_mesh_builder3_SetColorRGB(), d3drm_mesh_builder3_SetVertexColorRGB(), d3drm_mesh_SetGroupColorRGB(), D3DRMCreateColorRGB(), D3DRMCreateColorRGBA(), DECLARE_INTERFACE_(), do_blend(), draw_color_pixels(), draw_depth_pixels(), draw_index_pixels(), DrawLines(), get_1d_texel(), get_2d_texel(), gl_Accum(), gl_blend_pixels(), gl_blend_span(), gl_ClearAccum(), gl_ClearColor(), gl_Color3f(), gl_Color3f8bit(), gl_Color4f(), gl_Color4f8bit(), gl_Color4ub(), gl_Color4ub8bit(), gl_ColorMask(), gl_ColorMat3f(), gl_ColorMat4f(), gl_ColorMat4ub(), gl_flush_pb(), gl_fog_color_pixels(), gl_logicop_rgba_pixels(), gl_logicop_rgba_span(), gl_mask_color_pixels(), gl_mask_color_span(), gl_read_color_span(), gl_save_ClearAccum(), gl_save_ClearColor(), gl_save_ColorMask(), gl_texture_pixels(), gl_write_color_span(), gl_write_monocolor_span(), gl_write_texture_span(), gl_write_zoomed_color_span(), image_to_texture(), map_rgba(), mi_fill_rect(), mi_line(), mi_paint_rect(), MSSTYLES_GetPropertyColor(), opt_sample_rgb_2d(), opt_sample_rgba_2d(), palette_sample(), quickdraw_rgb(), read_color_image(), read_color_pixels(), sample_1d_linear(), sample_1d_linear_mipmap_linear(), sample_1d_linear_mipmap_nearest(), sample_1d_nearest(), sample_1d_nearest_mipmap_linear(), sample_1d_nearest_mipmap_nearest(), sample_2d_linear(), sample_2d_linear_mipmap_linear(), sample_2d_linear_mipmap_nearest(), sample_2d_nearest(), sample_2d_nearest_mipmap_linear(), sample_2d_nearest_mipmap_nearest(), sample_lambda_1d(), sample_lambda_2d(), sample_linear_1d(), sample_linear_2d(), sample_nearest_1d(), sample_nearest_2d(), scale_and_bias_rgba(), SetDesktopBackColor(), size1_rgba_points(), test_D3DXSHEvalConeLight(), test_frame_mesh_materials(), textured_rgba_points(), ui_create_colourmap(), update_pixel_masking(), and wined3d_caps_gl_ctx_test_viewport_subpixel_bits().

Function Documentation

◆ DrawLines()

static void DrawLines ( HDC  hDC)
static

Definition at line 73 of file linetest.c.

74{
75 static struct
76 {
77 int fromx;
78 int fromy;
79 int tox;
80 int toy;
81 COLORREF clr;
82 }
83 points[ ] =
84 {
85 { 10, 10, 19, 10, red },
86 { 20, 10, 20, 19, grn },
87 { 20, 20, 11, 20, blu },
88 { 10, 20, 10, 11, blk },
89 { 12, 12, 15, 15, red },
90 { 18, 12, 15, 15, grn },
91 { 18, 18, 15, 15, blu },
92 { 12, 18, 15, 15, blk },
93
94 { 35, 10, 39, 14, red },
95 { 40, 15, 36, 19, grn },
96 { 35, 20, 31, 16, blu },
97 { 30, 15, 34, 11, blk },
98
99 { 2, 1, 5, 2, red },
100 { 6, 2, 5, 5, grn },
101 { 5, 6, 2, 5, blu },
102 { 1, 5, 2, 2, blk },
103
104 { 50, 1, 51, 1, red },
105 { 50, 2, 52, 2, grn },
106 { 50, 3, 53, 3, blu },
107 { 50, 4, 54, 4, blk },
108 { 50, 5, 55, 5, red },
109 { 50, 6, 56, 6, grn },
110 { 50, 7, 57, 7, blu },
111 { 50, 8, 58, 8, blk },
112 { 50, 9, 59, 9, red },
113 { 50, 10, 60, 10, grn },
114 { 50, 11, 61, 11, blu },
115 { 50, 12, 62, 12, blk },
116
117 { 50, 14, 62, 14, red },
118 { 51, 15, 62, 15, grn },
119 { 52, 16, 62, 16, blu },
120 { 53, 17, 62, 17, blk },
121 { 54, 18, 62, 18, red },
122 { 55, 19, 62, 19, grn },
123 { 56, 20, 62, 20, blu },
124 { 57, 21, 62, 21, blk },
125 { 58, 22, 62, 22, red },
126 { 59, 23, 62, 23, grn },
127 { 60, 24, 62, 24, blu },
128 { 61, 25, 62, 25, blk },
129 };
130 int i;
131
132 for (i = 0; i < sizeof(points) / sizeof(points[0]); i++)
133 {
134 HPEN hpen, hpenold;
135 hpen = CreatePen ( PS_SOLID, 0, points[i].clr );
136 hpenold = (HPEN)SelectObject ( hDC, hpen );
137 MoveToEx ( hDC, points[i].fromx, points[i].fromy, NULL );
138 LineTo ( hDC, points[i].tox, points[i].toy );
139 SelectObject ( hDC, hpenold );
140 DeleteObject ( hpen );
141 }
142}
static HDC hDC
Definition: 3dtext.c:33
static HPEN hpen
#define NULL
Definition: types.h:112
pKey DeleteObject()
GLsizei const GLfloat * points
Definition: glext.h:8112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define grn
Definition: linetest.c:68
#define blu
Definition: linetest.c:69
#define red
Definition: linetest.c:67
#define blk
Definition: linetest.c:70
DWORD COLORREF
Definition: windef.h:300
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586

Referenced by MainWndProc().

◆ MainWndProc()

LRESULT WINAPI MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 144 of file linetest.c.

145{
146 PAINTSTRUCT ps;
147 HDC hDC;
148 RECT clr;
149 HBRUSH hbr;
150
151 switch(msg)
152 {
153 case WM_PAINT:
154 GetClientRect(hWnd, &clr);
155 //ClipRgn = CreateRectRgnIndirect(&clr);
156 hDC = BeginPaint(hWnd, &ps);
157 //Rect.left = 100;
158 //Rect.top = 100;
159 //Rect.right = 250;
160 //Rect.bottom = 150;
161 //FillRect(hDC, &Rect, CreateSolidBrush(RGB(0xFF, 0x00, 0x00)));
162 //ExcludeRgn = CreateRectRgnIndirect(&Rect);
163 //CombineRgn(ClipRgn, ClipRgn, ExcludeRgn, RGN_DIFF);
164 //DeleteObject(ExcludeRgn);
165 //Rect.left = 150;
166 //Rect.top = 150;
167 //Rect.right = 200;
168 //Rect.bottom = 250;
169 hbr = CreateSolidBrush(RGB(255, 255, 255));
170 FillRect ( hDC, &clr, hbr );
171 DeleteObject ( hbr );
172 DrawLines(hDC);
173 EndPaint(hWnd, &ps);
174 break;
175
176 case WM_DESTROY:
178 break;
179
180 default:
182 }
183 return 0;
184}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define RGB(r, g, b)
Definition: precomp.h:71
static void DrawLines(HDC hDC)
Definition: linetest.c:73
static HDC
Definition: imagelist.c:92
#define DefWindowProc
Definition: ros2win.h:31
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define WM_PAINT
Definition: winuser.h:1620
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1609
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 12 of file linetest.c.

16{
17 WNDCLASS wc;
18 MSG msg;
19 HWND hWnd;
20
28 wc.lpszMenuName = NULL;
29 wc.cbClsExtra = 0;
30 wc.cbWndExtra = 0;
31 if (RegisterClass(&wc) == 0)
32 {
33 fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
34 GetLastError());
35 return(1);
36 }
37
39 _T("Line drawing test"),
41 0,
42 0,
45 NULL,
46 NULL,
48 NULL);
49 if (hWnd == NULL)
50 {
51 fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
52 GetLastError());
53 return(1);
54 }
55
56 ShowWindow(hWnd, nCmdShow);
57
58 while(GetMessage(&msg, NULL, 0, 0))
59 {
62 }
63
64 return msg.wParam;
65}
HINSTANCE hInstance
Definition: charmap.c:19
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
const TCHAR * CLASS_NAME
Definition: linetest.c:9
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: linetest.c:144
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define _T(x)
Definition: vfdio.h:22
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define GRAY_BRUSH
Definition: wingdi.h:898
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
#define CreateWindow
Definition: winuser.h:5754
#define GetMessage
Definition: winuser.h:5790
#define LoadIcon
Definition: winuser.h:5813
#define LoadCursor
Definition: winuser.h:5812
#define CW_USEDEFAULT
Definition: winuser.h:225
#define RegisterClass
Definition: winuser.h:5836
#define DispatchMessage
Definition: winuser.h:5765
const char * LPCSTR
Definition: xmlstorage.h:183

Variable Documentation

◆ CLASS_NAME

const TCHAR* CLASS_NAME = _T("LineTestClass")

Definition at line 9 of file linetest.c.

Referenced by WinMain().