Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <windows.h></windows.h>
Toshihiro Shimizu 890ddd
#include "assert.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ttwainP.h"
Toshihiro Shimizu 890ddd
#include "ttwain_utilPD.h"
Toshihiro Shimizu 890ddd
#include "ttwain_global_def.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
static int getColorCount(LPBITMAPINFOHEADER pbi) {
Shinya Kitaoka 120a6e
  if (pbi->biSize == sizeof(BITMAPCOREHEADER)) {
Shinya Kitaoka 120a6e
    LPBITMAPCOREHEADER lpbc = ((LPBITMAPCOREHEADER)pbi);
Shinya Kitaoka 120a6e
    return 1 << lpbc->bcBitCount;
Shinya Kitaoka 120a6e
  } else if (pbi->biClrUsed == 0)
Shinya Kitaoka 120a6e
    return 0xFFF & (1 << pbi->biBitCount);
Shinya Kitaoka 120a6e
  else
Shinya Kitaoka 120a6e
    return (int)pbi->biClrUsed;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Shinya Kitaoka 120a6e
static size_t BmiColorTableBytes(LPBITMAPINFOHEADER pbi) {
Shinya Kitaoka 120a6e
  return getColorCount(pbi) * sizeof(RGBQUAD);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Shinya Kitaoka 120a6e
static LPBYTE get_buffer(LPBITMAPINFOHEADER lpbi, int *iud) {
Shinya Kitaoka 120a6e
  LPBYTE buf = (LPBYTE)lpbi + lpbi->biSize + BmiColorTableBytes(lpbi);
Shinya Kitaoka 120a6e
  *iud       = (lpbi->biHeight > 0);
Shinya Kitaoka 120a6e
  return buf;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Toshihiro Shimizu 890ddd
#define PelsPerMeter2DPI(ppm) (((float)ppm * 2.54) / 100.0)
Toshihiro Shimizu 890ddd
/*---------------------------------------------------------------------------*/
Shinya Kitaoka 120a6e
int TTWAIN_Native2RasterPD(void *handle, void *the_ras, int *lx, int *ly) {
Shinya Kitaoka 120a6e
  assert(!"DAFARE");
Shinya Kitaoka 120a6e
  return 1;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif