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 BITMAP_DRIVER TTYDRV_BITMAP_Driver
=
36 TTYDRV_BITMAP_SetDIBits
,
37 TTYDRV_BITMAP_GetDIBits
,
38 TTYDRV_BITMAP_DeleteDIBSection
,
39 TTYDRV_BITMAP_SetDIBColorTable
,
40 TTYDRV_BITMAP_GetDIBColorTable
,
45 PALETTE_DRIVER TTYDRV_PALETTE_Driver
=
47 TTYDRV_PALETTE_SetMapping
,
48 TTYDRV_PALETTE_UpdateMapping
,
52 const DC_FUNCTIONS
*TTYDRV_DC_Funcs
= NULL
; /* hack */
54 /**********************************************************************
55 * TTYDRV_GDI_Initialize
57 BOOL
TTYDRV_GDI_Initialize(void)
59 BITMAP_Driver
= &TTYDRV_BITMAP_Driver
;
60 PALETTE_Driver
= &TTYDRV_PALETTE_Driver
;
62 return TTYDRV_PALETTE_Initialize();
65 /***********************************************************************
68 BOOL
TTYDRV_DC_CreateDC(DC
*dc
, LPCSTR driver
, LPCSTR device
,
69 LPCSTR output
, const DEVMODEA
*initData
)
71 TTYDRV_PDEVICE
*physDev
;
74 TRACE("(%p, %s, %s, %s, %p)\n",
75 dc
, debugstr_a(driver
), debugstr_a(device
),
76 debugstr_a(output
), initData
);
78 if (!TTYDRV_DC_Funcs
) TTYDRV_DC_Funcs
= dc
->funcs
; /* hack */
80 dc
->physDev
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
81 sizeof(TTYDRV_PDEVICE
));
83 ERR("Can't allocate physDev\n");
86 physDev
= (TTYDRV_PDEVICE
*) dc
->physDev
;
88 if(dc
->flags
& DC_MEMORY
){
89 physDev
->window
= NULL
;
90 physDev
->cellWidth
= 1;
91 physDev
->cellHeight
= 1;
93 TTYDRV_DC_CreateBitmap(dc
->hBitmap
);
94 bmp
= (BITMAPOBJ
*) GDI_GetObjPtr(dc
->hBitmap
, BITMAP_MAGIC
);
96 dc
->bitsPerPixel
= bmp
->bitmap
.bmBitsPixel
;
98 dc
->totalExtent
.left
= 0;
99 dc
->totalExtent
.top
= 0;
100 dc
->totalExtent
.right
= bmp
->bitmap
.bmWidth
;
101 dc
->totalExtent
.bottom
= bmp
->bitmap
.bmHeight
;
102 dc
->hVisRgn
= CreateRectRgnIndirect( &dc
->totalExtent
);
104 GDI_ReleaseObj( dc
->hBitmap
);
106 physDev
->window
= root_window
;
107 physDev
->cellWidth
= cell_width
;
108 physDev
->cellHeight
= cell_height
;
110 dc
->bitsPerPixel
= 1;
111 dc
->totalExtent
.left
= 0;
112 dc
->totalExtent
.top
= 0;
113 dc
->totalExtent
.right
= cell_width
* screen_cols
;
114 dc
->totalExtent
.bottom
= cell_height
* screen_rows
;
115 dc
->hVisRgn
= CreateRectRgnIndirect( &dc
->totalExtent
);
121 /***********************************************************************
124 BOOL
TTYDRV_DC_DeleteDC(DC
*dc
)
128 HeapFree( GetProcessHeap(), 0, dc
->physDev
);
135 /***********************************************************************
136 * GetDeviceCaps (TTYDRV.@)
138 INT
TTYDRV_GetDeviceCaps( DC
*dc
, INT cap
)
145 return DT_RASDISPLAY
;
147 return 0; /* FIXME: Screen width in mm */
149 return 0; /* FIXME: Screen height in mm */
151 return 640; /* FIXME: Screen width in pixel */
153 return 480; /* FIXME: Screen height in pixel */
155 return 1; /* FIXME */
169 return sizeof(TTYDRV_PDEVICE
);
171 return (CC_CIRCLES
| CC_PIE
| CC_CHORD
| CC_ELLIPSES
| CC_WIDE
|
172 CC_STYLED
| CC_WIDESTYLED
| CC_INTERIORS
| CC_ROUNDRECT
);
174 return (LC_POLYLINE
| LC_MARKER
| LC_POLYMARKER
| LC_WIDE
|
175 LC_STYLED
| LC_WIDESTYLED
| LC_INTERIORS
);
177 return (PC_POLYGON
| PC_RECTANGLE
| PC_WINDPOLYGON
|
178 PC_SCANLINE
| PC_WIDE
| PC_STYLED
| PC_WIDESTYLED
| PC_INTERIORS
);
184 return (RC_BITBLT
| RC_BANDING
| RC_SCALING
| RC_BITMAP64
| RC_DI_BITMAP
|
185 RC_DIBTODEV
| RC_BIGFONT
| RC_STRETCHBLT
| RC_STRETCHDIB
| RC_DEVBITS
);
193 return 72; /* FIXME */
195 return 256; /* FIXME */
202 case PHYSICALOFFSETX
:
203 case PHYSICALOFFSETY
:
212 FIXME("(%04x): unsupported capability %d, will return 0\n", dc
->hSelf
, cap
);
218 /***********************************************************************
219 * TTYDRV_DC_SetDeviceClipping
221 void TTYDRV_DC_SetDeviceClipping(DC
*dc
)