|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Graphics | +--sub_arctic.output.drawable | +--sub_arctic.output.drawable_wrapper | +--sub_arctic.output.text_extractor
This class creates a drawable_wrapper object which extracts any text drawn (including text within images created by the style system). All drawing operations are forwarded to the wrapped drawable.
Currently, this does not create a spatial model of the text drawing to try to paste things together in the right order (and with the right word breaks), it just saves the text in a Vector in the order it is drawn.
Note: this drawable (and many others) will not work with a top_level object (because top_level draws to its in-memory image which it creates its own drawable for).
Graphics
Field Summary | |
protected java.util.Vector |
_captured_text
Vector containing strings extracted from the drawing. |
protected boolean |
_extraction_enabled
Is string extraction turned on |
Fields inherited from class sub_arctic.output.drawable_wrapper |
_wrappee |
Fields inherited from class sub_arctic.output.drawable |
_ignore,
g |
Constructor Summary | |
text_extractor(drawable rappee)
Simple constructor that creates a new internal vector to capture text into. |
|
text_extractor(drawable rappee,
java.util.Vector capture)
Full constructor. |
|
text_extractor(java.awt.Graphics rappee)
Constructor working from a Graphics. |
|
text_extractor(java.awt.Graphics rappee,
java.util.Vector capture)
Constructor working from a Graphics. |
Method Summary | |
protected void |
alternate_report_string(java.lang.String str,
int x,
int y)
"Manually" report a string. |
java.util.Vector |
captured_text()
Vector containing strings extracted from the drawing. |
void |
clear_captured_text()
Clear the captured text. |
java.awt.Graphics |
create()
Override create() to create the properly typed wrapper around a copy of the object we wrap. |
java.awt.Graphics |
create(int x,
int y,
int w,
int h)
Override create() to create the properly typed wrapper around a copy of the object we wrap. |
void |
draw_bytes(byte[] data,
int off,
int len,
int x,
int y)
Draw an array of bytes as a string (sets high byte of char to 0). |
void |
draw_chars(char[] data,
int off,
int len,
int x,
int y)
Draw an array of characters as a string. |
void |
draw_string(java.lang.String str,
int x,
int y)
Draw a string. |
void |
drawBytes(byte[] data,
int off,
int len,
int x,
int y)
Draw an array of bytes as a string (sets high byte of char to 0). |
void |
drawChars(char[] data,
int off,
int len,
int x,
int y)
Draw an array of characters as a string. |
boolean |
drawImage(loaded_image img,
int x,
int y)
Extended draw image that can deal with a loaded_image w/o an observer. |
boolean |
drawImage(loaded_image img,
int x,
int y,
java.awt.Color bgcolor)
Extended draw image that can deal with a loaded_image w/o an observer. |
boolean |
drawImage(loaded_image img,
int x,
int y,
int w,
int h)
Extended draw image that can deal with a loaded_image w/o an observer. |
boolean |
drawImage(loaded_image img,
int x,
int y,
int w,
int h,
java.awt.Color bgcolor)
Extended draw image that can deal with a loaded_image w/o an observer. |
void |
drawString(java.lang.String str,
int x,
int y)
Draw a string. |
protected void |
extract_bytes(byte[] data,
int off,
int len,
int x,
int y)
Extract a string being drawn as an array of bytes at the given location. |
protected void |
extract_chars(char[] data,
int off,
int len,
int x,
int y)
Extract a string being drawn as an array of chars at the given location. |
protected void |
extract_image_text(loaded_image img,
int x,
int y)
Extract text from an image. |
protected void |
extract_string(java.lang.String str,
int x,
int y)
Extract a string being drawn at the given location. |
boolean |
extraction_enabled()
Is string extraction turned on |
protected void |
report_string(java.lang.String str,
int x,
int y)
This method is called to report the output of a string at a given location. |
void |
set_captured_text(java.util.Vector external_vector)
Replace the captured text vector with another. |
void |
set_extraction_enabled(boolean val)
Turn string extraction on or off. |
java.lang.String |
toString()
Convert to a human readable string. |
Methods inherited from class sub_arctic.output.drawable_wrapper |
arrowhead_bound,
clearRect,
clipRect,
copy,
copy,
copyArea,
dispose,
draw_arrowhead,
draw3DRect,
drawArc,
drawImage,
drawImage,
drawImage,
drawImage,
drawLine,
drawOval,
drawPolygon,
drawPolygon,
drawRect,
drawRoundRect,
end_interactor_draw,
fill_arrowhead,
fill3DRect,
fillArc,
fillOval,
fillPolygon,
fillPolygon,
fillRect,
fillRoundRect,
finalize,
getClipBounds,
getColor,
getFont,
getFontMetrics,
getFontMetrics,
graphics,
mark_interactor_draw,
setClip,
setColor,
setFont,
setPaintMode,
setXORMode,
start_interactor_draw,
tileImage,
translate,
wrappee |
Methods inherited from class sub_arctic.output.drawable |
arrowhead_bound,
clear_rect,
clip_rect,
copy_area,
draw_3D_rect,
draw_arc,
draw_arrowhead,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_image,
draw_line,
draw_oval,
draw_polygon,
draw_polygon,
draw_polyline,
draw_rect,
draw_round_rect,
drawImage,
drawImage,
drawImage,
drawImage,
drawPolyline,
drawString,
fill_3D_rect,
fill_arc,
fill_arrowhead,
fill_oval,
fill_polygon,
fill_polygon,
fill_rect,
fill_round_rect,
get_clip_bounds,
get_clip,
get_color,
get_font_metrics,
get_font_metrics,
get_font,
getClip,
set_clip,
set_clip,
set_color,
set_font,
set_paint_mode,
set_XOR_mode,
setClip,
tile_image |
Methods inherited from class java.awt.Graphics |
getClipBounds,
getClipRect,
hitClip |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected java.util.Vector _captured_text
protected boolean _extraction_enabled
Constructor Detail |
public text_extractor(drawable rappee)
drawable
- rappee the drawable we create a wrapper around.public text_extractor(drawable rappee, java.util.Vector capture)
drawable
- rappee the drawable we create a wrapper around.Vector
- capture Where we place captured text (if this is null,
an internal vector will be allocated).public text_extractor(java.awt.Graphics rappee, java.util.Vector capture)
Graphics
- rappee the object we are wrapper around.Vector
- capture Where we place captured text (if this is null,
an internal vector will be allocated).public text_extractor(java.awt.Graphics rappee)
Graphics
- rappee the object we are wrapper around.Method Detail |
public java.awt.Graphics create()
set_captured_text(java.util.Vector)
public java.awt.Graphics create(int x, int y, int w, int h)
int
- x x component of origin of new drawableint
- y y component of origin of new drawableint
- w width of new drawableint
- h height of new drawableset_captured_text(java.util.Vector)
public java.util.Vector captured_text()
public void clear_captured_text()
public void set_captured_text(java.util.Vector external_vector)
Vector
- external_vector new Vector to place captured text.public boolean extraction_enabled()
public void set_extraction_enabled(boolean val)
boolean
- val new enable status.alternate_report_string(java.lang.String, int, int)
protected void alternate_report_string(java.lang.String str, int x, int y)
String
- str the string being (virtually) drawnint
- x x coodinate where we (virtually) draw it.int
- y y coodinate where we (virtually) draw it.set_extraction_enabled(boolean)
,
report_string(java.lang.String, int, int)
protected void report_string(java.lang.String str, int x, int y)
String
- str the string being drawnint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.protected void extract_image_text(loaded_image img, int x, int y)
loaded_image
- img the image in questionint
- x x coordinate where image is being drawnint
- y y coordinate where image is being drawnprotected void extract_string(java.lang.String str, int x, int y)
String
- str the string being drawnint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.protected void extract_chars(char[] data, int off, int len, int x, int y)
char[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.protected void extract_bytes(byte[] data, int off, int len, int x, int y)
byte[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public boolean drawImage(loaded_image img, int x, int y)
loaded_image
- img the image to be drawn.int
- x x position to place the image at.int
- y y position to place the image at.public boolean drawImage(loaded_image img, int x, int y, int w, int h)
loaded_image
- img the image to be drawn.int
- x x position to place the image at.int
- y y position to place the image at.int
- w width image will be scaled to.int
- h height image will be scaled to.public boolean drawImage(loaded_image img, int x, int y, java.awt.Color bgcolor)
loaded_image
- img the image to be drawn.int
- x x position to place the image at.int
- y y position to place the image at.Color
- bgcolor background color.public boolean drawImage(loaded_image img, int x, int y, int w, int h, java.awt.Color bgcolor)
loaded_image
- img the image to be drawn.int
- x x position to place the image at.int
- y y position to place the image at.int
- w width image will be scaled to.int
- h height image will be scaled to.Color
- bgcolor background color.public void drawString(java.lang.String str, int x, int y)
String
- str the string being drawnint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public void draw_string(java.lang.String str, int x, int y)
String
- str the string being drawnint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public void drawChars(char[] data, int off, int len, int x, int y)
char[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public void draw_chars(char[] data, int off, int len, int x, int y)
char[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public void drawBytes(byte[] data, int off, int len, int x, int y)
byte[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public void draw_bytes(byte[] data, int off, int len, int x, int y)
byte[]
- data the string being drawnint
- off offset into array to start drawing withint
- len number of characters to drawint
- x x coodinate where we draw it.int
- y y coodinate where we draw it.public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |