Home › Forums › TWAIN Classic › From Java with user interface Twain › Re: what I have so far
February 14, 2009 at 11:27 pm #24760
/*
* Class: ocr_zarf
* Method: zarf_AcquireNative
* Signature: ()[B
*/
__declspec(dllexport) jbyteArray __stdcall Java_ocr_zarf_zarf_1AcquireNative (JNIEnv * JEnvironmentPointer, jobject jayObject)
{ // 1
static jfieldID fid_s = NULL; /* cached field ID for s */
jclass cls = (*JEnvironmentPointer)->GetObjectClass(JEnvironmentPointer, jayObject);
jclass localRefBufferClass = (*JEnvironmentPointer)->FindClass(JEnvironmentPointer, "java/awt/image/DataBufferByte");
if(availability > 0x00000000)
{ // 2
void * ImageHandle_hnative=(void *)TWAIN_AcquireNative(0x00000000,TWAIN_GRAY);
if(ImageHandle_hnative) // 0 == NULL == no entry
{ // 3
//
void * bitMapHandle=(void *)GlobalLock(ImageHandle_hnative);
if(bitMapHandle)
{
LPSTR pBitmapInfo;
PBITMAPINFOHEADER pBitmapInfoPointer = (PBITMAPINFOHEADER)bitMapHandle;
KalyttaPointer = ( KalyttaPointer ) pBitmapInfoPointer;
LONG const widthOfImage=(LONG)pBitmapInfoPointer->biWidth;
LONG const heightOfImage=(LONG)pBitmapInfoPointer->biHeight;
int bitsPerPixel=(int)pBitmapInfoPointer->biBitCount;
if((widthOfImage > 0x00000000)&&(heightOfImage > 0x00000000))
{
int RowScanIndex=heightOfImage;
unsigned char * imageData= ( unsigned char * ) malloc( heightOfImage * widthOfImage );
do
{
DIB_ReadRow((void *)pBitmapInfoPointer,--RowScanIndex, ( unsigned char * ) imageData[RowScanIndex]);
}
while(RowScanIndex > 0x00000000);
// begin image ops
// end image ops
free(imageData);
GlobalFree(bitMapHandle);
}
}
}
}
}
this is going pretty slow, any suggestions on how to go about this?
🙂