Added function table to GDI objects for better encapsulation.
[wine.git] / dlls / ttydrv / dc.c
blobf4d2c25cfe6c03d71e63adea96fc114e23cf5c43
1 /*
2 * TTY DC driver
4 * Copyright 1999 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include "gdi.h"
24 #include "ttydrv.h"
25 #include "winbase.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
31 /**********************************************************************
32 * TTYDRV_GDI_Initialize
34 BOOL TTYDRV_GDI_Initialize(void)
36 return TTYDRV_PALETTE_Initialize();
39 /***********************************************************************
40 * TTYDRV_DC_CreateDC
42 BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
43 LPCSTR output, const DEVMODEA *initData)
45 TTYDRV_PDEVICE *physDev;
47 TRACE("(%p, %s, %s, %s, %p)\n",
48 dc, debugstr_a(driver), debugstr_a(device),
49 debugstr_a(output), initData);
51 dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
52 sizeof(TTYDRV_PDEVICE));
53 if(!dc->physDev) {
54 ERR("Can't allocate physDev\n");
55 return FALSE;
57 physDev = (TTYDRV_PDEVICE *) dc->physDev;
58 physDev->hdc = dc->hSelf;
59 physDev->dc = dc;
61 if(dc->flags & DC_MEMORY){
62 physDev->window = NULL;
63 physDev->cellWidth = 1;
64 physDev->cellHeight = 1;
65 } else {
66 physDev->window = root_window;
67 physDev->cellWidth = cell_width;
68 physDev->cellHeight = cell_height;
70 dc->bitsPerPixel = 1;
73 return TRUE;
76 /***********************************************************************
77 * TTYDRV_DC_DeleteDC
79 BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
81 TRACE("(%x)\n", physDev->hdc);
83 physDev->dc->physDev = NULL;
84 HeapFree( GetProcessHeap(), 0, physDev );
85 return TRUE;
89 /***********************************************************************
90 * GetDeviceCaps (TTYDRV.@)
92 INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
94 switch(cap)
96 case DRIVERVERSION:
97 return 0x300;
98 case TECHNOLOGY:
99 return DT_RASDISPLAY;
100 case HORZSIZE:
101 return 0; /* FIXME: Screen width in mm */
102 case VERTSIZE:
103 return 0; /* FIXME: Screen height in mm */
104 case HORZRES:
105 return cell_width * screen_cols;
106 case VERTRES:
107 return cell_height * screen_rows;
108 case BITSPIXEL:
109 return 1; /* FIXME */
110 case PLANES:
111 return 1;
112 case NUMBRUSHES:
113 return 16 + 6;
114 case NUMPENS:
115 return 16;
116 case NUMMARKERS:
117 return 0;
118 case NUMFONTS:
119 return 0;
120 case NUMCOLORS:
121 return 100;
122 case PDEVICESIZE:
123 return sizeof(TTYDRV_PDEVICE);
124 case CURVECAPS:
125 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
126 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
127 case LINECAPS:
128 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
129 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
130 case POLYGONALCAPS:
131 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
132 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
133 case TEXTCAPS:
134 return 0;
135 case CLIPCAPS:
136 return CP_REGION;
137 case RASTERCAPS:
138 return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
139 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
140 case ASPECTX:
141 case ASPECTY:
142 return 36;
143 case ASPECTXY:
144 return 51;
145 case LOGPIXELSX:
146 case LOGPIXELSY:
147 return 72; /* FIXME */
148 case SIZEPALETTE:
149 return 256; /* FIXME */
150 case NUMRESERVED:
151 return 0;
152 case COLORRES:
153 return 0;
154 case PHYSICALWIDTH:
155 case PHYSICALHEIGHT:
156 case PHYSICALOFFSETX:
157 case PHYSICALOFFSETY:
158 case SCALINGFACTORX:
159 case SCALINGFACTORY:
160 case VREFRESH:
161 case DESKTOPVERTRES:
162 case DESKTOPHORZRES:
163 case BTLALIGNMENT:
164 return 0;
165 default:
166 FIXME("(%04x): unsupported capability %d, will return 0\n", physDev->hdc, cap );
167 return 0;