public class OMBitmap extends OMRasterObject implements java.io.Serializable
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.
OMRasterObject.TrimScaleFilter
bitmap, bits, colorModel, COLORMODEL_DIRECT, COLORMODEL_IMAGEICON, COLORMODEL_INDEXED, DEBUG, FAST_SCALING, filteredHeight, filteredWidth, height, imageFilter, lat, logger, lon, needToReposition, pixels, point1, point2, rotationAngle, SMOOTH_SCALING, width, x, y
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible
ADD_GRAPHIC_MASK, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
computePixels()
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.
|
filterImage, getBits, getColorModel, getFilteredHeight, getFilteredWidth, getHeight, getImage, getImageFilter, getLat, getLon, getMapLocation, getNeedToReposition, getPixels, getRotationAngle, getWidth, getX, getY, hasLineTypeChoice, imageUpdate, position, render, restore, rotate, scaleTo, setColorModel, setHeight, setImage, setImageFilter, setLat, setLon, setNeedToReposition, setPixels, setRotationAngle, setShape, setWidth, setX, setY, shouldRenderFill
clone, distance, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, regenerate, renderLabel, setDeclutterType, setEdgeMatchesFill, setFillColor, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setShape, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, writeStroke
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setMatted, setMattingPaint, setRenderType, setSelected, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge
clearAttributes, contains, distance, distanceToEdge, draw, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible
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.public void setBits(byte[] values)
setBits
in class OMRasterObject
values
- byte values containing bit pixel values.protected boolean computePixels()
computePixels
in class OMRasterObject
public boolean generate(Projection proj)
generate
in interface OMGeometry
generate
in class OMGraphicAdapter
proj
- ProjectionOMGraphicAdapter.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
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details