Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions
com.google.scrollview.ui.SVImageHandler Class Reference

List of all members.

## Static Public Member Functions

static void | createImage (String name, int width, int height, int bitsPerPixel)
static void | openImage (String location)
static PImage | getImage (String name)
static void | parseData (String inputLine)
static boolean | getReadImageData ()
static int | getMissingRemainingBytes ()

## Detailed Description

The ScrollViewImageHandler is a helper class which takes care of image processing. It is used to construct an Image from the message-stream and basically consists of a number of utility functions to process the input stream.

Author:
  wanke.nosp@m.@goo.nosp@m.gle.c.nosp@m.om

Definition at line 26 of file SVImageHandler.java.

## Member Function Documentation

static void com.google.scrollview.ui.SVImageHandler.createImage | ( | String | name,
|  | int | width,
|  | int | height,
|  | int | bitsPerPixel
| ) |  |

inline static

Starts creation of a new image.

Definition at line 146 of file SVImageHandler.java.

{
// Create buffered image that does not support transparency
bpp = bitsPerPixel;
if (bpp == 1) {
bytePerPixel = 1;
} else if (bpp == 8) {
bytePerPixel = 2;
} else if (bpp == 32) {
bytePerPixel = 7;
} else {
throw new IllegalArgumentException(
"bpp should be 1 (binary), 8 (gray) or 32 (argb), is " + bpp);
}
if (imageName != null) {
throw new IllegalArgumentException("Image " + imageName + " already opened!");
}
else {
imageName = name;
bytesRead = 0;
readImageData = true;
SVImageHandler.height = height;
SVImageHandler.width = width;
pictureArray = new int[width * height];
}
System.out.println("Processing Image with " + bpp + " bpp, size " + width + "x" + height);
}

static PImage com.google.scrollview.ui.SVImageHandler.getImage | ( | String | name | ) |

inline static

Find the image corresponding to a given name

Definition at line 189 of file SVImageHandler.java.

{
return images.get(name);
}

static int com.google.scrollview.ui.SVImageHandler.getMissingRemainingBytes | ( |  | ) |

inline static

Computes how many bytes of the image data are still missing

Definition at line 225 of file SVImageHandler.java.

{
return (height * width * bytePerPixel) - bytesRead;
}

static boolean com.google.scrollview.ui.SVImageHandler.getReadImageData | ( |  | ) |

inline static

Returns whether we a currently reading image data or not

Definition at line 220 of file SVImageHandler.java.

{
return readImageData;
}

static void com.google.scrollview.ui.SVImageHandler.openImage | ( | String | location | ) |

inline static

Opens an Image from location. This means the image does not have to be actually transfered over the network. Thus, it is a lot faster than using the createImage method.

Parameters:

  location | The (local) location from where to open the file. This is also the internal name associated with the image (if you want to draw it).

Definition at line 183 of file SVImageHandler.java.

{
PImage img = new PImage(location);
images.put(location, img);
}

static void com.google.scrollview.ui.SVImageHandler.parseData | ( | String | inputLine | ) |

inline static

Gets called while currently reading image data. Decides, how to process it (which image type, whether all data is there).

Definition at line 197 of file SVImageHandler.java.

{
int[] data = null;
if (bpp == 1) {
data = processBinaryImage(inputLine);
} else if (bpp == 8) {
data = processGrayImage(inputLine);
} else if (bpp == 32) {
data = process32bppImage(inputLine);
} else {
System.out.println("Unsupported Bit Type: " + bpp);
}
System.arraycopy(data, 0, pictureArray, bytesRead, data.length);
bytesRead += data.length;
// We have read all image data - close the image
if (bytesRead == (height * width)) {
closeImage();
}
}

The documentation for this class was generated from the following file:

- /mnt/data/src/tesseract-ocr/java/com/google/scrollview/ui/SVImageHandler.java