public class TiledCanvas
extends android.graphics.Canvas
Modifier and Type | Class and Description |
---|---|
static interface |
TiledCanvas.ProgressCallback |
Modifier and Type | Field and Description |
---|---|
protected int |
_channels |
protected java.io.File |
_file |
protected int |
_fullHeight |
protected int |
_fullWidth |
protected boolean |
_postDrawn |
protected int |
_tileHeight |
protected int |
_tileWidth |
protected boolean |
_valid |
Constructor and Description |
---|
TiledCanvas(java.io.File file,
int tileWidth,
int tileHeight) |
Modifier and Type | Method and Description |
---|---|
static void |
bitmapToBytes(android.graphics.Bitmap bmp,
java.nio.ByteBuffer dest,
boolean recycle)
Convert a bitmap to an array of bytes
|
static android.graphics.Bitmap |
bytesToBitmap(java.nio.ByteBuffer byteData,
int width,
int height,
int channels)
Convert an array of RGB or RGBA data to an ARGB bitmap
|
boolean |
copyToFile(java.io.File file,
android.graphics.Bitmap.CompressFormat format,
int quality) |
boolean |
copyToFile(java.io.File file,
java.lang.String format,
java.lang.String[] options)
Copy the entire image to another file type
|
android.graphics.Bitmap |
createThumbnail(int width,
int height)
Create a thumbnail of the entire image
Aspect ratio will be maintained, meaning desired width/height
may not be the same as the output width/height
|
int |
getChannels() |
java.io.File |
getFile() |
int |
getHeight() |
int |
getTileCount() |
int |
getTileCountX() |
int |
getTileCountY() |
int |
getTileHeight() |
int |
getTileWidth() |
int |
getWidth() |
boolean |
postDraw(CapturePP postDraw)
Run post-processing drawing on the entire image (1 tile at a time)
Result is automatically saved back to the original image
NOTE: This is meant to be run once per canvas.
|
boolean |
postDraw(CapturePP postDraw,
TiledCanvas.ProgressCallback callback)
Run post-processing drawing on the entire image (1 tile at a time)
Result is automatically saved back to the original image
NOTE: This is meant to be run once per canvas.
|
android.graphics.Bitmap |
readTile(int tileX,
int tileY)
Read a tile based on its cell position
I.e.
|
android.graphics.Bitmap |
readTile(int x,
int y,
int width,
int height)
Read a tile from the image into a bitmap
|
boolean |
valid() |
boolean |
writeTile(android.graphics.Bitmap bmp,
int tileX,
int tileY)
Write a bitmap to the tile at the specified cell position
See
readTile(int, int) for more info. |
boolean |
writeTile(android.graphics.Bitmap bmp,
int x,
int y,
boolean tileCell,
boolean recycle)
Write a bitmap to the image at a specified position
|
clipOutPath, clipOutRect, clipOutRect, clipOutRect, clipOutRect, clipPath, clipPath, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, clipRect, concat, disableZ, drawArc, drawArc, drawARGB, drawBitmap, drawBitmap, drawBitmap, drawBitmap, drawBitmap, drawBitmap, drawBitmapMesh, drawCircle, drawColor, drawColor, drawColor, drawColor, drawColor, drawDoubleRoundRect, drawDoubleRoundRect, drawLine, drawLines, drawLines, drawOval, drawOval, drawPaint, drawPath, drawPicture, drawPicture, drawPicture, drawPoint, drawPoints, drawPoints, drawPosText, drawPosText, drawRect, drawRect, drawRect, drawRenderNode, drawRGB, drawRoundRect, drawRoundRect, drawText, drawText, drawText, drawText, drawTextOnPath, drawTextOnPath, drawTextRun, drawTextRun, drawTextRun, drawVertices, enableZ, getClipBounds, getClipBounds, getDensity, getDrawFilter, getMatrix, getMatrix, getMaximumBitmapHeight, getMaximumBitmapWidth, getSaveCount, isHardwareAccelerated, isOpaque, quickReject, quickReject, quickReject, restore, restoreToCount, rotate, rotate, save, saveLayer, saveLayer, saveLayer, saveLayer, saveLayerAlpha, saveLayerAlpha, saveLayerAlpha, saveLayerAlpha, scale, scale, setBitmap, setDensity, setDrawFilter, setMatrix, skew, translate
protected final java.io.File _file
protected final int _fullWidth
protected final int _fullHeight
protected final int _tileWidth
protected final int _tileHeight
protected final int _channels
protected final boolean _valid
protected boolean _postDrawn
public java.io.File getFile()
public int getWidth()
getWidth
in class android.graphics.Canvas
public int getHeight()
getHeight
in class android.graphics.Canvas
public int getTileWidth()
public int getTileHeight()
public int getChannels()
public int getTileCount()
public int getTileCountX()
public int getTileCountY()
public boolean valid()
public android.graphics.Bitmap readTile(int tileX, int tileY)
tileX
- X-position of the tiletileY
- Y-position of the tilepublic android.graphics.Bitmap readTile(int x, int y, int width, int height)
x
- Left-wise position to read fromy
- Top-wise position to read fromwidth
- Width of the tile to readheight
- Height of the tile to readpublic boolean writeTile(android.graphics.Bitmap bmp, int tileX, int tileY)
readTile(int, int)
for more info.bmp
- Bitmap to read fromtileX
- X-position of the tiletileY
- Y-position of the tilepublic boolean writeTile(android.graphics.Bitmap bmp, int x, int y, boolean tileCell, boolean recycle)
bmp
- Bitmap to read fromx
- Left-wise position to write toy
- Top-wise position to write totileCell
- True if the x,y pair is a tile cell locationrecycle
- True if it's okay to recycle the bitmappublic boolean copyToFile(java.io.File file, java.lang.String format, java.lang.String[] options)
file
- File to copy toformat
- File formatoptions
- List of options (key=value)public boolean copyToFile(java.io.File file, android.graphics.Bitmap.CompressFormat format, int quality)
public android.graphics.Bitmap createThumbnail(int width, int height)
width
- Desired widthheight
- Desired heightpublic boolean postDraw(CapturePP postDraw, TiledCanvas.ProgressCallback callback)
postDraw
- The post-processorcallback
- Progress callbackpublic boolean postDraw(CapturePP postDraw)
postDraw
- The post-processorpublic static android.graphics.Bitmap bytesToBitmap(java.nio.ByteBuffer byteData, int width, int height, int channels)
byteData
- Byte bufferwidth
- Width of the bitmapheight
- Height of the bitmapchannels
- Number of channelspublic static void bitmapToBytes(android.graphics.Bitmap bmp, java.nio.ByteBuffer dest, boolean recycle)
bmp
- Bitmap to convertdest
- Byte array to store converted RGBA pixelsrecycle
- True to recycle the bitmap