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
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
32 /**********************************************************************/
34 PALETTE_DRIVER TTYDRV_PALETTE_Driver =
36 TTYDRV_PALETTE_SetMapping,
37 TTYDRV_PALETTE_UpdateMapping,
41 const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
43 /**********************************************************************
44 * TTYDRV_GDI_Initialize
46 BOOL TTYDRV_GDI_Initialize(void)
48 PALETTE_Driver = &TTYDRV_PALETTE_Driver;
50 return TTYDRV_PALETTE_Initialize();
53 /***********************************************************************
56 BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
57 LPCSTR output, const DEVMODEA *initData)
59 TTYDRV_PDEVICE *physDev;
62 TRACE("(%p, %s, %s, %s, %p)\n",
63 dc, debugstr_a(driver), debugstr_a(device),
64 debugstr_a(output), initData);
66 if (!TTYDRV_DC_Funcs) TTYDRV_DC_Funcs = dc->funcs; /* hack */
68 dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
69 sizeof(TTYDRV_PDEVICE));
71 ERR("Can't allocate physDev\n");
74 physDev = (TTYDRV_PDEVICE *) dc->physDev;
75 physDev->hdc = dc->hSelf;
78 if(dc->flags & DC_MEMORY){
79 physDev->window = NULL;
80 physDev->cellWidth = 1;
81 physDev->cellHeight = 1;
83 TTYDRV_DC_CreateBitmap(dc->hBitmap);
84 bmp = (BITMAPOBJ *) GDI_GetObjPtr(dc->hBitmap, BITMAP_MAGIC);
86 dc->bitsPerPixel = bmp->bitmap.bmBitsPixel;
88 dc->totalExtent.left = 0;
89 dc->totalExtent.top = 0;
90 dc->totalExtent.right = bmp->bitmap.bmWidth;
91 dc->totalExtent.bottom = bmp->bitmap.bmHeight;
92 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
94 GDI_ReleaseObj( dc->hBitmap );
96 physDev->window = root_window;
97 physDev->cellWidth = cell_width;
98 physDev->cellHeight = cell_height;
100 dc->bitsPerPixel = 1;
101 dc->totalExtent.left = 0;
102 dc->totalExtent.top = 0;
103 dc->totalExtent.right = cell_width * screen_cols;
104 dc->totalExtent.bottom = cell_height * screen_rows;
105 dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent );
111 /***********************************************************************
114 BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
116 TRACE("(%x)\n", physDev->hdc);
118 physDev->dc->physDev = NULL;
119 HeapFree( GetProcessHeap(), 0, physDev );
124 /***********************************************************************
125 * GetDeviceCaps (TTYDRV.@)
127 INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
134 return DT_RASDISPLAY;
136 return 0; /* FIXME: Screen width in mm */
138 return 0; /* FIXME: Screen height in mm */
140 return 640; /* FIXME: Screen width in pixel */
142 return 480; /* FIXME: Screen height in pixel */
144 return 1; /* FIXME */
158 return sizeof(TTYDRV_PDEVICE);
160 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
161 CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
163 return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
164 LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
166 return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
167 PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
173 return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
174 RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS);
182 return 72; /* FIXME */
184 return 256; /* FIXME */
191 case PHYSICALOFFSETX:
192 case PHYSICALOFFSETY:
201 FIXME("(%04x): unsupported capability %d, will return 0\n", physDev->hdc, cap );
207 /***********************************************************************
208 * TTYDRV_DC_SetDeviceClipping
210 void TTYDRV_DC_SetDeviceClipping(TTYDRV_PDEVICE *physDev)
212 TRACE("(%x)\n", physDev->hdc);