Tesseract
3.02
|
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 () |
Static Package Attributes | |
static HashMap< String, PImage > | images = new HashMap<String, PImage>() |
static boolean | readImageData = false |
static String | imageName = null |
static int | bytesRead = 0 |
static int | bpp = 0 |
static int | pictureArray [] |
static int | bytePerPixel = 0 |
static int | width = 0 |
static int | height = 0 |
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.
Definition at line 26 of file SVImageHandler.java.
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.
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(); } }
int com.google.scrollview.ui.SVImageHandler.bpp = 0 [static, package] |
Definition at line 40 of file SVImageHandler.java.
int com.google.scrollview.ui.SVImageHandler.bytePerPixel = 0 [static, package] |
Definition at line 43 of file SVImageHandler.java.
int com.google.scrollview.ui.SVImageHandler.bytesRead = 0 [static, package] |
Definition at line 39 of file SVImageHandler.java.
int com.google.scrollview.ui.SVImageHandler.height = 0 [static, package] |
Definition at line 46 of file SVImageHandler.java.
String com.google.scrollview.ui.SVImageHandler.imageName = null [static, package] |
These are all values belonging to the image which is currently being read
Definition at line 38 of file SVImageHandler.java.
HashMap<String, PImage> com.google.scrollview.ui.SVImageHandler.images = new HashMap<String, PImage>() [static, package] |
Stores a mapping from the name of the string to its actual image. It enables us to re-use images without having to load or transmit them again
Definition at line 31 of file SVImageHandler.java.
int com.google.scrollview.ui.SVImageHandler.pictureArray[] [static, package] |
Definition at line 41 of file SVImageHandler.java.
boolean com.google.scrollview.ui.SVImageHandler.readImageData = false [static, package] |
A global flag stating whether we are currently expecting Image data
Definition at line 34 of file SVImageHandler.java.
int com.google.scrollview.ui.SVImageHandler.width = 0 [static, package] |
Definition at line 45 of file SVImageHandler.java.