1 
2 
3 #include <windows.h>
4 #include "assert.h"
5 
6 #include "ttwainP.h"
7 #include "ttwain_utilPD.h"
8 #include "ttwain_global_def.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
getColorCount(LPBITMAPINFOHEADER pbi)14 static int getColorCount(LPBITMAPINFOHEADER pbi) {
15   if (pbi->biSize == sizeof(BITMAPCOREHEADER)) {
16     LPBITMAPCOREHEADER lpbc = ((LPBITMAPCOREHEADER)pbi);
17     return 1 << lpbc->bcBitCount;
18   } else if (pbi->biClrUsed == 0)
19     return 0xFFF & (1 << pbi->biBitCount);
20   else
21     return (int)pbi->biClrUsed;
22 }
23 /*---------------------------------------------------------------------------*/
BmiColorTableBytes(LPBITMAPINFOHEADER pbi)24 static size_t BmiColorTableBytes(LPBITMAPINFOHEADER pbi) {
25   return getColorCount(pbi) * sizeof(RGBQUAD);
26 }
27 /*---------------------------------------------------------------------------*/
get_buffer(LPBITMAPINFOHEADER lpbi,int * iud)28 static LPBYTE get_buffer(LPBITMAPINFOHEADER lpbi, int *iud) {
29   LPBYTE buf = (LPBYTE)lpbi + lpbi->biSize + BmiColorTableBytes(lpbi);
30   *iud       = (lpbi->biHeight > 0);
31   return buf;
32 }
33 /*---------------------------------------------------------------------------*/
34 #define PelsPerMeter2DPI(ppm) (((float)ppm * 2.54) / 100.0)
35 /*---------------------------------------------------------------------------*/
TTWAIN_Native2RasterPD(void * handle,void * the_ras,int * lx,int * ly)36 int TTWAIN_Native2RasterPD(void *handle, void *the_ras, int *lx, int *ly) {
37   assert(!"DAFARE");
38   return 1;
39 }
40 
41 #ifdef __cplusplus
42 }
43 #endif
44