public class ImageSource
extends java.lang.Object
Bitmap
ImageSource.BitmapFactory
Modifier and Type | Class and Description |
---|---|
static interface |
ImageSource.BitmapFactory
Factory for delegating construction of bitmap images.
|
Modifier and Type | Method and Description |
---|---|
android.graphics.Bitmap |
asBitmap()
Returns the source bitmap.
|
ImageSource.BitmapFactory |
asBitmapFactory()
Returns the source bitmap factory.
|
java.lang.String |
asFilePath()
Returns the source file path name.
|
java.lang.Object |
asObject()
Returns the image source associated with an unrecognized type.
|
int |
asResource()
Returns the source Android resource identifier.
|
java.lang.String |
asUrl()
Returns the source URL string.
|
boolean |
equals(java.lang.Object o) |
static ImageSource |
fromBitmap(android.graphics.Bitmap bitmap)
Constructs an image source with a bitmap.
|
static ImageSource |
fromBitmapFactory(ImageSource.BitmapFactory factory)
Constructs an image source with a bitmap factory.
|
static ImageSource |
fromFilePath(java.lang.String pathName)
Constructs an image source with a file path.
|
static ImageSource |
fromLineStipple(int factor,
short pattern)
Constructs a bitmap image source with a line stipple pattern.
|
static ImageSource |
fromObject(java.lang.Object source)
Constructs an image source with a generic Object instance.
|
static ImageSource |
fromResource(int id)
Constructs an image source with an Android resource identifier.
|
static ImageSource |
fromUrl(java.lang.String urlString)
Constructs an image source with a URL string.
|
int |
hashCode() |
boolean |
isBitmap()
Indicates whether this image source is a Bitmap.
|
boolean |
isBitmapFactory()
Indicates whether this image source is a bitmap factory.
|
boolean |
isFilePath()
Indicates whether this image source is a file path.
|
boolean |
isResource()
Indicates whether this image source is an Android resource.
|
boolean |
isUrl()
Indicates whether this image source is a URL string.
|
java.lang.String |
toString() |
public static ImageSource fromBitmap(android.graphics.Bitmap bitmap)
bitmap
- the bitmap to use as an image sourcejava.lang.IllegalArgumentException
- If the bitmap is null or recycledpublic static ImageSource fromBitmapFactory(ImageSource.BitmapFactory factory)
factory
- the bitmap factory to use as an image sourcejava.lang.IllegalArgumentException
- If the factory is nullpublic static ImageSource fromResource(int id)
id
- the resource identifier, as generated by the aapt toolpublic static ImageSource fromFilePath(java.lang.String pathName)
pathName
- complete path name to the filejava.lang.IllegalArgumentException
- If the path name is nullpublic static ImageSource fromUrl(java.lang.String urlString)
urlString
- complete URL stringjava.lang.IllegalArgumentException
- If the URL string is nullpublic static ImageSource fromLineStipple(int factor, short pattern)
ShapeAttributes.setOutlineImageSource(ImageSource)
.factor
- specifies the number of times each bit in the pattern is repeated before the next bit is used. For
example, if the factor is 3, each bit is repeated three times before using the next bit. The
specified factor must be either 0 or an integer greater than 0. A factor of 0 indicates no
stippling.pattern
- specifies a number whose lower 16 bits define a pattern of which pixels in the image are white and
which are transparent. Each bit corresponds to a pixel, and the pattern repeats after every n*16
pixels, where n is the factor. For example, if the factor is 3, each bit in the pattern is
repeated three times before using the next bit.public static ImageSource fromObject(java.lang.Object source)
source
- the generic sourcejava.lang.IllegalArgumentException
- If the source is nullpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isBitmap()
public boolean isBitmapFactory()
public boolean isResource()
public boolean isFilePath()
public boolean isUrl()
public android.graphics.Bitmap asBitmap()
public ImageSource.BitmapFactory asBitmapFactory()
public int asResource()
public java.lang.String asFilePath()
public java.lang.String asUrl()
public java.lang.Object asObject()