ImageDecoder.CreateSource Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| CreateSource(Byte[], Int32, Int32) |
Create a new |
| CreateSource(Resources, Int32) |
Create a new |
| CreateSource(AssetManager, String) |
Create a new |
| CreateSource(ContentResolver, Uri) |
Create a new |
| CreateSource(ICallable) |
Create a new |
| CreateSource(ByteBuffer) |
Create a new |
| CreateSource(File) |
Create a new |
| CreateSource(Byte[]) |
Create a new |
CreateSource(Byte[], Int32, Int32)
Create a new Source from a byte array region.
[Android.Runtime.Register("createSource", "([BII)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=31)]
public static Android.Graphics.ImageDecoder.Source CreateSource(byte[] data, int offset, int length);
[<Android.Runtime.Register("createSource", "([BII)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=31)>]
static member CreateSource : byte[] * int * int -> Android.Graphics.ImageDecoder.Source
Parameters
- data
- Byte[]
byte array of compressed image data. This value cannot be null.
- offset
- Int32
offset into data for where the decoder should begin parsing.
- length
- Int32
number of bytes, beginning at offset, to parse.
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a byte array.
Note: If this Source is passed to decodeDrawable, and the encoded image is animated, the returned AnimatedImageDrawable will continue reading from data, so its contents must not be modified, even after the AnimatedImageDrawable is returned. data's contents should never be modified during decode.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(Resources, Int32)
Create a new Source from a resource.
[Android.Runtime.Register("createSource", "(Landroid/content/res/Resources;I)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Android.Content.Res.Resources res, int resId);
[<Android.Runtime.Register("createSource", "(Landroid/content/res/Resources;I)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)>]
static member CreateSource : Android.Content.Res.Resources * int -> Android.Graphics.ImageDecoder.Source
Parameters
- res
- Resources
the Resources object containing the image data. This value cannot be null.
- resId
- Int32
resource ID of the image data.
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a resource. This method is safe to call from any thread.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(AssetManager, String)
Create a new Source from a file in the assets directory.
[Android.Runtime.Register("createSource", "(Landroid/content/res/AssetManager;Ljava/lang/String;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Android.Content.Res.AssetManager assets, string fileName);
[<Android.Runtime.Register("createSource", "(Landroid/content/res/AssetManager;Ljava/lang/String;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)>]
static member CreateSource : Android.Content.Res.AssetManager * string -> Android.Graphics.ImageDecoder.Source
Parameters
- assets
- AssetManager
- fileName
- String
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a file in the "assets" directory. This method is safe to call from any thread.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(ContentResolver, Uri)
Create a new Source from a android.net.Uri.
[Android.Runtime.Register("createSource", "(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Android.Content.ContentResolver cr, Android.Net.Uri uri);
[<Android.Runtime.Register("createSource", "(Landroid/content/ContentResolver;Landroid/net/Uri;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)>]
static member CreateSource : Android.Content.ContentResolver * Android.Net.Uri -> Android.Graphics.ImageDecoder.Source
Parameters
to retrieve from.
- uri
- Uri
of the image file.
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a Uri. Accepts the following URI schemes: content (ContentResolver.SCHEME_CONTENT); android.resource (ContentResolver.SCHEME_ANDROID_RESOURCE); file (ContentResolver.SCHEME_FILE). This method is safe to call from any thread.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(ICallable)
Create a new Source from a callable that returns an AssetFileDescriptor.
[Android.Runtime.Register("createSource", "(Ljava/util/concurrent/Callable;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=29)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Java.Util.Concurrent.ICallable callable);
[<Android.Runtime.Register("createSource", "(Ljava/util/concurrent/Callable;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=29)>]
static member CreateSource : Java.Util.Concurrent.ICallable -> Android.Graphics.ImageDecoder.Source
Parameters
- callable
- ICallable
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a Callable that returns a new AssetFileDescriptor for each request. This provides control over how the AssetFileDescriptor is created, such as passing options into ContentResolver.openTypedAssetFileDescriptor, or enabling use of a CancellationSignal.
It's important for the given Callable to return a new, unique AssetFileDescriptor for each invocation, to support reuse of the returned Source. This method is safe to call from any thread.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(ByteBuffer)
Create a new Source from a ByteBuffer.
[Android.Runtime.Register("createSource", "(Ljava/nio/ByteBuffer;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Java.Nio.ByteBuffer buffer);
[<Android.Runtime.Register("createSource", "(Ljava/nio/ByteBuffer;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)>]
static member CreateSource : Java.Nio.ByteBuffer -> Android.Graphics.ImageDecoder.Source
Parameters
- buffer
- ByteBuffer
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a ByteBuffer.
Decoding will start from buffer.position(). The position of buffer will not be affected.
Note: If this Source is passed to decodeDrawable, and the encoded image is animated, the returned AnimatedImageDrawable will continue reading from the buffer, so its contents must not be modified, even after the AnimatedImageDrawable is returned. buffer's contents should never be modified during decode.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(File)
Create a new Source from a file.
[Android.Runtime.Register("createSource", "(Ljava/io/File;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)]
public static Android.Graphics.ImageDecoder.Source CreateSource(Java.IO.File file);
[<Android.Runtime.Register("createSource", "(Ljava/io/File;)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=28)>]
static member CreateSource : Java.IO.File -> Android.Graphics.ImageDecoder.Source
Parameters
- file
- File
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a File.
This method should only be used for files that you have direct access to; if you'd like to work with files hosted outside your app, use an API like createSource(Callable) or createSource(ContentResolver,Uri). This method is safe to call from any thread.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateSource(Byte[])
Create a new Source from a byte array.
[Android.Runtime.Register("createSource", "([B)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=31)]
public static Android.Graphics.ImageDecoder.Source CreateSource(byte[] data);
[<Android.Runtime.Register("createSource", "([B)Landroid/graphics/ImageDecoder$Source;", "", ApiSince=31)>]
static member CreateSource : byte[] -> Android.Graphics.ImageDecoder.Source
Parameters
- data
- Byte[]
byte array of compressed image data. This value cannot be null.
Returns
a new Source object, which can be passed to
#decodeDrawable or #decodeBitmap.
- Attributes
Remarks
Create a new Source from a byte array.
Note: If this Source is passed to decodeDrawable, and the encoded image is animated, the returned AnimatedImageDrawable will continue reading from data, so its contents must not be modified, even after the AnimatedImageDrawable is returned. data's contents should never be modified during decode.
Android reference for android.graphics.ImageDecoder.createSource.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.