Represents a single bitmapped image, such as one loaded from a file.
Images retrieved by name or class are searched for using a robust and flexible search scheme.
This class cannot be a subclass of Bitmap, since Bitmap is a final class.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Image(Bitmap bitmap)
Create an image from a bitmap.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Bitmap
|
asBitmap()
Access the contents of this image in the form of an Android
Bitmap.
| ||||||||||
static
Image
|
getDefault()
Get a new Image object that renders as the default Sofia
image.
| ||||||||||
int
|
getHeight()
Return the height of this bitmap.
| ||||||||||
Color
|
getPixel(int x, int y)
Returns the Color at the specified location.
| ||||||||||
Color[]
|
getPixels()
Returns an array containing all of the Color of each pixel in the
image, arranged in row-major order.
| ||||||||||
boolean
|
getScaleForDpi()
Get whether this image will be automatically scaled up or down
based on the current device's pixel density when it is loaded.
| ||||||||||
int
|
getWidth()
Return the width of this bitmap.
| ||||||||||
void
|
resolveAgainstContext(Context context)
Provide an Android resource context to use for loading this
image (this must be called before any class/id/file name image
will be available).
| ||||||||||
void
|
setPixel(int x, int y, Color color)
Write the specified Color into the bitmap at the x,y coordinate.
| ||||||||||
void
|
setPixels(Color[] pixels)
Replace pixels in the bitmap with the colors in the array.
| ||||||||||
void
|
setScaleForDpi(boolean willScaleForDpi)
Determine whether this image will be automatically scaled up or down
based on the current device's pixel density when it is loaded.
| ||||||||||
void
|
setUseDefaultIfNotFound(boolean useDefault)
Determine whether this image should use the default Sofia
image/icon, if no image corresponding to the search criteria
(e.g., a class name, or a file name) is found.
| ||||||||||
boolean
|
useDefaultIfNotFound()
Says whether this object will use the default Sofia
image/icon, if no image corresponding to the search criteria
specified in its constructor call (e.g., a class name, or a
file name) is found.
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Create an image from a bitmap.
Access the contents of this image in the form of an Android Bitmap.
A Bitmap with this image's contents.
Get a new Image object that renders as the default Sofia image.
a new Image object that renders as the default image.
Return the height of this bitmap.
Before calling this method, the bitmap must be resolved (that is, loaded from a resource).
The height of this bitmap, in pixels.
Returns the Color at the specified location. Throws an exception if x or y are out of bounds (negative or >= to the width or height respectively).
The Color at the specified coordinate
Returns an array containing all of the Color of each pixel in the image, arranged in row-major order. All of the pixels in row 0 appear in the array first, followed by the pixels in row 1, row 2, and so on. The array is Width x Height in size.
An array representing all of the pixels in the image.
Get whether this image will be automatically scaled up or down based on the current device's pixel density when it is loaded. The default is true. This setting is only useful before the image is resolved (loaded), since scaling happens at that time.
True if this image will be scaled for the current device's pixel density when it is loaded.
Return the width of this bitmap.
Before calling this method, the bitmap must be resolved (that is, loaded from a resource).
The width of this bitmap, in pixels.
Provide an Android resource context to use for loading this image (this must be called before any class/id/file name image will be available).
Write the specified Color into the bitmap at the x,y coordinate.
Replace pixels in the bitmap with the colors in the array.
Determine whether this image will be automatically scaled up or down based on the current device's pixel density when it is loaded. The default is true. This setting is only useful before the image is resolved (loaded), since scaling happens at that time.
Determine whether this image should use the default Sofia image/icon, if no image corresponding to the search criteria (e.g., a class name, or a file name) is found. The default is true.
Says whether this object will use the default Sofia
image/icon, if no image corresponding to the search criteria
specified in its constructor call (e.g., a class name, or a
file name) is found. If it returns false, and no image file is
found, then asBitmap()
will return null. The default
is true.
True if this image should render as the Sofia default image when no corresponding resource is found.