IT. Expert System.

Android Reference

BitmapFactory.Options


android.graphics

Class BitmapFactory.Options

    • Field Summary

      Fields
      Modifier and Type Field and Description
      Bitmap inBitmap
      If set, decode methods that take the Options object will attempt to reuse this bitmap when loading content.
      int inDensity
      The pixel density to use for the bitmap.
      boolean inDither
      If dither is true, the decoder will attempt to dither the decoded image.
      boolean inInputShareable
      This field works in conjuction with inPurgeable.
      boolean inJustDecodeBounds
      If set to true, the decoder will return null (no bitmap), but the out...
      boolean inMutable
      If set, decode methods will always return a mutable Bitmap instead of an immutable one.
      boolean inPreferQualityOverSpeed
      If inPreferQualityOverSpeed is set to true, the decoder will try to decode the reconstructed image to a higher quality even at the expense of the decoding speed.
      Bitmap.Config inPreferredConfig
      If this is non-null, the decoder will try to decode into this internal configuration.
      boolean inPurgeable
      If this is set to true, then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory.
      int inSampleSize
      If set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory.
      boolean inScaled
      When this flag is set, if inDensity and inTargetDensity are not 0, the bitmap will be scaled to match inTargetDensity when loaded, rather than relying on the graphics system scaling it each time it is drawn to a Canvas.
      int inScreenDensity
      The pixel density of the actual screen that is being used.
      int inTargetDensity
      The pixel density of the destination this bitmap will be drawn to.
      byte[] inTempStorage
      Temp storage to use for decoding.
      boolean mCancel
      Flag to indicate that cancel has been called on this object.
      int outHeight
      The resulting height of the bitmap, set independent of the state of inJustDecodeBounds.
      String outMimeType
      If known, this string is set to the mimetype of the decoded image.
      int outWidth
      The resulting width of the bitmap, set independent of the state of inJustDecodeBounds.
    • Constructor Summary

      Constructors
      Constructor and Description
      BitmapFactory.Options()
      Create a default Options object, which if left unchanged will give the same result from the decoder as if null were passed.
    • Field Detail

      • inBitmap

        public Bitmap inBitmap
        If set, decode methods that take the Options object will attempt to reuse this bitmap when loading content. If the decode operation cannot use this bitmap, the decode method will return null and will throw an IllegalArgumentException. The current implementation necessitates that the reused bitmap be of the same size as the source content and in jpeg or png format (whether as a resource or as a stream). The configuration of the reused bitmap will override the setting of inPreferredConfig, if set.

        You should still always use the returned Bitmap of the decode method and not assume that reusing the bitmap worked, due to the constraints outlined above and failure situations that can occur. Checking whether the return value matches the value of the inBitmap set in the Options structure is a way to see if the bitmap was reused, but in all cases you should use the returned Bitmap to make sure that you are using the bitmap that was used as the decode destination.

      • inMutable

        public boolean inMutable
        If set, decode methods will always return a mutable Bitmap instead of an immutable one. This can be used for instance to programmatically apply effects to a Bitmap loaded through BitmapFactory.
      • inJustDecodeBounds

        public boolean inJustDecodeBounds
        If set to true, the decoder will return null (no bitmap), but the out... fields will still be set, allowing the caller to query the bitmap without having to allocate the memory for its pixels.
      • inSampleSize

        public int inSampleSize
        If set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory. The sample size is the number of pixels in either dimension that correspond to a single pixel in the decoded bitmap. For example, inSampleSize == 4 returns an image that is 1/4 the width/height of the original, and 1/16 the number of pixels. Any value <= 1 is treated the same as 1. note: the decoder will try to fulfill this request, but the resulting bitmap may have different dimensions that precisely what has been requested. also, powers of 2 are often faster/easier for the decoder to honor.
      • inPreferredConfig

        public Bitmap.Config inPreferredConfig
        If this is non-null, the decoder will try to decode into this internal configuration. If it is null, or the request cannot be met, the decoder will try to pick the best matching config based on the system's screen depth, and characteristics of the original image such as if it has per-pixel alpha (requiring a config that also does). Image are loaded with the Bitmap.Config.ARGB_8888 config by default.
      • inDither

        public boolean inDither
        If dither is true, the decoder will attempt to dither the decoded image.
      • inScreenDensity

        public int inScreenDensity
        The pixel density of the actual screen that is being used. This is purely for applications running in density compatibility code, where inTargetDensity is actually the density the application sees rather than the real screen density.

        By setting this, you allow the loading code to avoid scaling a bitmap that is currently in the screen density up/down to the compatibility density. Instead, if inDensity is the same as inScreenDensity, the bitmap will be left as-is. Anything using the resulting bitmap must also used Bitmap.getScaledWidth and Bitmap.getScaledHeight to account for any different between the bitmap's density and the target's density.

        This is never set automatically for the caller by BitmapFactory itself. It must be explicitly set, since the caller must deal with the resulting bitmap in a density-aware way.

        See Also:
        inDensity, inTargetDensity, inScaled, DisplayMetrics.densityDpi
      • inScaled

        public boolean inScaled
        When this flag is set, if inDensity and inTargetDensity are not 0, the bitmap will be scaled to match inTargetDensity when loaded, rather than relying on the graphics system scaling it each time it is drawn to a Canvas.

        This flag is turned on by default and should be turned off if you need a non-scaled version of the bitmap. Nine-patch bitmaps ignore this flag and are always scaled.

      • inPurgeable

        public boolean inPurgeable
        If this is set to true, then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory. In that instance, when the pixels need to be accessed again (e.g. the bitmap is drawn, getPixels() is called), they will be automatically re-decoded. For the re-decode to happen, the bitmap must have access to the encoded data, either by sharing a reference to the input or by making a copy of it. This distinction is controlled by inInputShareable. If this is true, then the bitmap may keep a shallow reference to the input. If this is false, then the bitmap will explicitly make a copy of the input data, and keep that. Even if sharing is allowed, the implementation may still decide to make a deep copy of the input data.
      • inInputShareable

        public boolean inInputShareable
        This field works in conjuction with inPurgeable. If inPurgeable is false, then this field is ignored. If inPurgeable is true, then this field determines whether the bitmap can share a reference to the input data (inputstream, array, etc.) or if it must make a deep copy.
      • inPreferQualityOverSpeed

        public boolean inPreferQualityOverSpeed
        If inPreferQualityOverSpeed is set to true, the decoder will try to decode the reconstructed image to a higher quality even at the expense of the decoding speed. Currently the field only affects JPEG decode, in the case of which a more accurate, but slightly slower, IDCT method will be used instead.
      • outWidth

        public int outWidth
        The resulting width of the bitmap, set independent of the state of inJustDecodeBounds. However, if there is an error trying to decode, outWidth will be set to -1.
      • outHeight

        public int outHeight
        The resulting height of the bitmap, set independent of the state of inJustDecodeBounds. However, if there is an error trying to decode, outHeight will be set to -1.
      • outMimeType

        public String outMimeType
        If known, this string is set to the mimetype of the decoded image. If not know, or there is an error, it is set to null.
      • inTempStorage

        public byte[] inTempStorage
        Temp storage to use for decoding. Suggest 16K or so.
      • mCancel

        public boolean mCancel
        Flag to indicate that cancel has been called on this object. This is useful if there's an intermediary that wants to first decode the bounds and then decode the image. In that case the intermediary can check, inbetween the bounds decode and the image decode, to see if the operation is canceled.
    • Constructor Detail

      • BitmapFactory.Options

        public BitmapFactory.Options()
        Create a default Options object, which if left unchanged will give the same result from the decoder as if null were passed.
    • Method Detail

      • requestCancelDecode

        public void requestCancelDecode()
        This can be called from another thread while this options object is inside a decode... call. Calling this will notify the decoder that it should cancel its operation. This is not guaranteed to cancel the decode, but if it does, the decoder... operation will return null, or if inJustDecodeBounds is true, will set outWidth/outHeight to -1


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 692 / 158692131. Delta: 0.05371 с