TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Re: what I have so far

Forums › TWAIN Classic › From Java with user interface Twain › Re: what I have so far

February 14, 2009 at 11:27 pm #24760
Nicholas Jordan
Participant
  • Topics - 0
  • Replies - 14
  • Total Posts - 14
    /*
* 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?
🙂

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • Girls of Desire: All babes in one place, crazy, art
  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in