tahoma2d/toonz/sources/common/twain/ttwain_utilW.c

44 lines
1.3 KiB
C
Raw Normal View History

2016-03-19 06:57:51 +13:00
#include <windows.h>
#include "assert.h"
#include "ttwainP.h"
#include "ttwain_utilPD.h"
#include "ttwain_global_def.h"
#ifdef __cplusplus
extern "C" {
#endif
2016-06-15 18:43:10 +12:00
static int getColorCount(LPBITMAPINFOHEADER pbi) {
if (pbi->biSize == sizeof(BITMAPCOREHEADER)) {
LPBITMAPCOREHEADER lpbc = ((LPBITMAPCOREHEADER)pbi);
return 1 << lpbc->bcBitCount;
} else if (pbi->biClrUsed == 0)
return 0xFFF & (1 << pbi->biBitCount);
else
return (int)pbi->biClrUsed;
2016-03-19 06:57:51 +13:00
}
/*---------------------------------------------------------------------------*/
2016-06-15 18:43:10 +12:00
static size_t BmiColorTableBytes(LPBITMAPINFOHEADER pbi) {
return getColorCount(pbi) * sizeof(RGBQUAD);
2016-03-19 06:57:51 +13:00
}
/*---------------------------------------------------------------------------*/
2016-06-15 18:43:10 +12:00
static LPBYTE get_buffer(LPBITMAPINFOHEADER lpbi, int *iud) {
LPBYTE buf = (LPBYTE)lpbi + lpbi->biSize + BmiColorTableBytes(lpbi);
*iud = (lpbi->biHeight > 0);
return buf;
2016-03-19 06:57:51 +13:00
}
/*---------------------------------------------------------------------------*/
#define PelsPerMeter2DPI(ppm) (((float)ppm * 2.54) / 100.0)
/*---------------------------------------------------------------------------*/
2016-06-15 18:43:10 +12:00
int TTWAIN_Native2RasterPD(void *handle, void *the_ras, int *lx, int *ly) {
assert(!"DAFARE");
return 1;
2016-03-19 06:57:51 +13:00
}
#ifdef __cplusplus
}
#endif