|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.geom.BasicGeometry com.bbn.openmap.omGraphics.OMGraphicAdapter com.bbn.openmap.omGraphics.OMRasterObject com.bbn.openmap.omGraphics.OMBitmap
public class OMBitmap
The OMBitmap lets you create a two color image. The display color is the foreground color, and the fill color is the background color. OMColors can be used, and their transparency values will be implemented.
The array of bytes is used to create the picture. Each bit, representing a pixel, is examined, and the color is set to the display or fill color, depending on the bit value. There isn't a height and width restriction on OMBitmaps, but you do have to be careful about the byte array that is used for one. The OMBitmap is based on an X bitmap, not a Windows bmp file. Again, each bit of the bytes corresponds to a pixel. If the height and/or width of the bitmap isn't a multiple of 8, you have to round up the number of bytes used so that the excess bits are covered in that extra byte for the row.
So, for a 4x4 bitmap, you need:
ooooxxxx|ooooxxxx|ooooxxxx|ooooxxxx -> 1 by 4 bytes, 4 bytes totalwhere x's are the bits being used for the bitmap ( and whether they are 1 or 0 dictates either foreground or background color), and o's are the leftover bits (they are ignored). The '|' are byte boundaries.
The bits, per byte, look like they are used in reverse order because they are - least significant bit, per byte, is used in that order.
For a 6x6 bitmap:
ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx|ooxxxxxx -> 1 x 6 bytes, 6 bytes totalfor a 10x10 bitmap:
xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx|xxxxxxxx|ooooooxx -> 2 by 10 bytes, 20 bytes totalThere is the ability to add a filter to the OMBitmap, to change it's appearance for rendering. The most common filter, which is included as a kind of default, is the scale filter. Filtering the OMRasterObject replaces the bitmap variable, which is the internal java.awt.Image used for rendering.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
OMRasterObject.TrimScaleFilter |
Field Summary |
---|
Fields inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
bitmap, bits, colorModel, COLORMODEL_DIRECT, COLORMODEL_IMAGEICON, COLORMODEL_INDEXED, DEBUG, FAST_SCALING, filteredHeight, filteredWidth, height, imageFilter, lat, logger, lon, needToReposition, pixels, point1, point2, renderRotationAngle, rotationAngle, SMOOTH_SCALING, width, x, y |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter |
---|
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
attributes, lineType, needToRegenerate, shape, visible |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
OMBitmap()
Create empty, and add parameters later. |
|
OMBitmap(double lt,
double ln,
int w,
int h,
byte[] bytes)
Created a OMBitmap with a Lat/lon placement. |
|
OMBitmap(double lt,
double ln,
int offset_x1,
int offset_y1,
int w,
int h,
byte[] bytes)
Create an OMBitmap, located at a Lat/lon with a X/Y offset placement. |
|
OMBitmap(int x1,
int y1,
int w,
int h,
byte[] bytes)
Create an OMBitmap with a X/Y window placement. |
Method Summary | |
---|---|
protected int[] |
computePixels(byte[] bits)
Create the image pixels from the display color and the fill color values, and the bitmap bytes. |
void |
deselect()
Set the selected attribute to false, sets the color to the line color. |
boolean |
generate(Projection proj)
Create the rendered image from the pixel values. |
void |
select()
Set the selected attribute to true, and sets the color to the select color. |
void |
setBits(byte[] values)
Set the bytes used to create the pixels used to create the image. |
void |
setFillPaint(java.awt.Paint value)
This sets the bitmap to recompute the pixels if the background color is changed. |
void |
setLinePaint(java.awt.Paint value)
This sets the bitmap to recompute the pixels if the foreground paint is changed. |
void |
setSelectPaint(java.awt.Paint value)
This sets the bitmap to recompute the pixels if the foreground paint is changed. |
Methods inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
adjustShapeForRotation, filterImage, getBits, getColorModel, getFilteredHeight, getFilteredWidth, getHeight, getImage, getImageFilter, getLat, getLon, getMapLocation, getNeedToReposition, getPixels, getRotationAngle, getWidth, getX, getY, hasLineTypeChoice, imageUpdate, position, regenerate, render, renderImage, restore, rotate, scaleTo, setColorModel, setHeight, setImage, setImageFilter, setLat, setLon, setNeedToReposition, setPixels, setRotationAngle, setShape, setWidth, setX, setY, shouldRenderFill |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic |
---|
clone, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, isMatted, isSelected, normalizeDistanceForLineWidth, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setMatted, setMattingPaint, setRenderType, setSelected, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry |
---|
clearAttributes, contains, distance, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible |
Constructor Detail |
---|
public OMBitmap()
public OMBitmap(double lt, double ln, int w, int h, byte[] bytes)
lt
- latitude of upper left corner of bitmap.ln
- longitude of upper left corner of bitmap.w
- width of bitmap.h
- height of bitmap.bytes
- byte array of bitmap, each bit representing a pixel.public OMBitmap(int x1, int y1, int w, int h, byte[] bytes)
x1
- window pixel x location of upper left corner of bitmap.y1
- window pixel y location of upper left corner of bitmap.w
- width of bitmap.h
- height of bitmap.bytes
- byte array of bitmap, each bit representing a pixel.public OMBitmap(double lt, double ln, int offset_x1, int offset_y1, int w, int h, byte[] bytes)
lt
- latitude of upper left corner of bitmap.ln
- longitude of upper left corner of bitmap.offset_x1
- window pixel x location from ln of upper left corner of
bitmap.offset_y1
- window pixel y location from lt of upper left corner of
bitmap.w
- width of bitmap.h
- height of bitmap.bytes
- byte array of bitmap, each bit representing a pixel.Method Detail |
---|
public void setBits(byte[] values)
setBits
in class OMRasterObject
values
- byte values containing bit pixel values.protected int[] computePixels(byte[] bits)
computePixels
in class OMRasterObject
public boolean generate(Projection proj)
generate
in interface OMGeometry
generate
in class OMGraphicAdapter
proj
- Projection
OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)
public void setLinePaint(java.awt.Paint value)
setLinePaint
in interface OMGraphic
setLinePaint
in class OMGraphicAdapter
value
- the new line color.public void setSelectPaint(java.awt.Paint value)
setSelectPaint
in interface OMGraphic
setSelectPaint
in class OMGraphicAdapter
value
- the new select color.public void setFillPaint(java.awt.Paint value)
setFillPaint
in interface OMGraphic
setFillPaint
in class OMGraphicAdapter
value
- the new background colorpublic void select()
select
in interface OMGeometry
select
in interface OMGraphic
select
in class OMGraphicAdapter
public void deselect()
deselect
in interface OMGeometry
deselect
in interface OMGraphic
deselect
in class OMGraphicAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |