Home | History | Annotate | Download | only in graphics

Lines Matching defs:Bitmap

34  * Creates Bitmap objects from various sources, including files, streams,
52 * reuse this bitmap when loading content. If the decode operation
53 * cannot use this bitmap, the decode method will throw an
55 * current implementation necessitates that the reused bitmap be
56 * mutable, and the resulting reused bitmap will continue to remain
58 * an immutable bitmap.</p>
60 * <p>You should still always use the returned Bitmap of the decode
61 * method and not assume that reusing the bitmap worked, due to the
64 * set in the Options structure will indicate if the bitmap was reused,
65 * but in all cases you should use the Bitmap returned by the decoding
66 * function to ensure that you are using the bitmap that was used as the
72 * mutable bitmap can be reused by {@link BitmapFactory} to decode any
73 * other bitmaps as long as the resulting {@link Bitmap#getByteCount()
74 * byte count} of the decoded bitmap is less than or equal to the {@link
75 * Bitmap#getAllocationByteCount() allocated byte count} of the reused
76 * bitmap. This can be because the intrinsic size is smaller, or its
83 * Additionally, the {@link android.graphics.Bitmap.Config
84 * configuration} of the reused bitmap will override the setting of
89 * <p>BitmapRegionDecoder will draw its requested content into the Bitmap
91 * than the provided Bitmap. The provided Bitmap's width, height, and
92 * {@link Bitmap.Config} will not be changed.
96 * formats supported by BitmapRegionDecoder support Bitmap reuse via
99 * @see Bitmap#reconfigure(int,int, android.graphics.Bitmap.Config)
101 public Bitmap inBitmap;
104 * If set, decode methods will always return a mutable Bitmap instead of
106 * effects to a Bitmap loaded through BitmapFactory.
108 * {@link android.graphics.Bitmap.Config#HARDWARE},
115 * If set to true, the decoder will return null (no bitmap), but
117 * query the bitmap without having to allocate the memory for its pixels.
125 * pixel in the decoded bitmap. For example, inSampleSize == 4 returns
140 * Image are loaded with the {@link Bitmap.Config#ARGB_8888} config by
143 public Bitmap.Config inPreferredConfig = Bitmap.Config.ARGB_8888;
151 * the {@link Bitmap.Config#ARGB_8888} configuration).</p>
153 * <p>{@link Bitmap.Config#RGBA_F16} always uses the
169 * <p>After decode, the bitmap's color space is stored in
175 * If true (which is the default), the resulting bitmap will have its
192 * @see Bitmap#hasAlpha()
193 * @see Bitmap#isPremultiplied()
208 * The pixel density to use for the bitmap. This will always result
209 * in the returned bitmap having a density set for it (see
210 * {@link Bitmap#setDensity(int) Bitmap.setDensity(int)}). In addition,
212 * density does not match {@link #inTargetDensity}, then the bitmap
225 * @see Bitmap#setDensity(int)
231 * The pixel density of the destination this bitmap will be drawn to.
233 * {@link #inScaled} to determine if and how to scale the bitmap before
259 * allow the loading code to avoid scaling a bitmap that is currently
262 * bitmap will be left as-is. Anything using the resulting bitmap
263 * must also used {@link Bitmap#getScaledWidth(int)
264 * Bitmap.getScaledWidth} and {@link Bitmap#getScaledHeight
265 * Bitmap.getScaledHeight} to account for any different between the
266 * bitmap's density and the target's density.
270 * caller must deal with the resulting bitmap in a density-aware way.
282 * bitmap will be scaled to match {@link #inTargetDensity} when loaded,
290 * a non-scaled version of the bitmap. Nine-patch bitmaps ignore this
303 * is set to true, then the resulting bitmap will allocate its
306 * (e.g. the bitmap is drawn, getPixels() is called), they will be
309 * <p>For the re-decode to happen, the bitmap must have access to the
312 * inInputShareable. If this is true, then the bitmap may keep a shallow
313 * reference to the input. If this is false, then the bitmap will
340 * determines whether the bitmap can share a reference to the input
360 * The resulting width of the bitmap. If {@link #inJustDecodeBounds} is
361 * set to false, this will be width of the output bitmap after any
370 * The resulting height of the bitmap. If {@link #inJustDecodeBounds} is
371 * set to false, this will be height of the output bitmap after any
386 * If known, the config the decoded bitmap will have.
389 public Bitmap.Config outConfig;
392 * If known, the color space the decoded bitmap will have. Note that the
393 * output color space is not guaranteed to be the color space the bitmap
395 * {@link Bitmap.Config#ALPHA_8} for instance), or there is an error,
436 if (opts.inMutable && opts.inPreferredConfig == Bitmap.Config.HARDWARE) {
454 * Decode a file path into a bitmap. If the specified file name is null,
455 * or cannot be decoded into a bitmap, the function returns null.
460 * @return The decoded bitmap, or null if the image data could not be
464 * is {@link android.graphics.Bitmap.Config#HARDWARE}
469 public static Bitmap decodeFile(String pathName, Options opts) {
471 Bitmap bm = null;
494 * Decode a file path into a bitmap. If the specified file name is null,
495 * or cannot be decoded into a bitmap, the function returns null.
498 * @return the resulting decoded bitmap, or null if it could not be decoded.
500 public static Bitmap decodeFile(String pathName) {
505 * Decode a new Bitmap from an InputStream. This InputStream was obtained from
506 * resources, which we pass to be able to scale the bitmap accordingly.
508 * is {@link android.graphics.Bitmap.Config#HARDWARE}
513 public static Bitmap decodeResourceStream(Resources res, TypedValue value,
544 * @return The decoded bitmap, or null if the image data could not be
548 * is {@link android.graphics.Bitmap.Config#HARDWARE}
553 public static Bitmap decodeResource(Resources res, int id, Options opts) {
555 Bitmap bm = null;
577 throw new IllegalArgumentException("Problem decoding into existing bitmap");
589 * @return The decoded bitmap, or null if the image could not be decoded.
591 public static Bitmap decodeResource(Resources res, int id) {
596 * Decode an immutable bitmap from the specified byte array.
604 * @return The decoded bitmap, or null if the image data could not be
608 * is {@link android.graphics.Bitmap.Config#HARDWARE}
613 public static Bitmap decodeByteArray(byte[] data, int offset, int length, Options opts) {
619 Bitmap bm;
626 throw new IllegalArgumentException("Problem decoding into existing bitmap");
637 * Decode an immutable bitmap from the specified byte array.
643 * @return The decoded bitmap, or null if the image could not be decoded.
645 public static Bitmap decodeByteArray(byte[] data, int offset, int length) {
650 * Set the newly decoded bitmap's density based on the Options.
652 private static void setDensityFromOptions(Bitmap outputBitmap, Options opts) {
669 // bitmap was reused, ensure density is reset
670 outputBitmap.setDensity(Bitmap.getDefaultDensity());
675 * Decode an input stream into a bitmap. If the input stream is null, or
676 * cannot be used to decode a bitmap, the function returns null.
681 * bitmap.
682 * @param outPadding If not null, return the padding rect for the bitmap if
684 * no bitmap is returned (null) then padding is
688 * @return The decoded bitmap, or null if the image data could not be
692 * is {@link android.graphics.Bitmap.Config#HARDWARE}
702 public static Bitmap decodeStream(InputStream is, Rect outPadding, Options opts) {
710 Bitmap bm = null;
722 throw new IllegalArgumentException("Problem decoding into existing bitmap");
737 private static Bitmap decodeStreamInternal(InputStream is, Rect outPadding, Options opts) {
746 * Decode an input stream into a bitmap. If the input stream is null, or
747 * cannot be used to decode a bitmap, the function returns null.
752 * bitmap.
753 * @return The decoded bitmap, or null if the image data could not be decoded.
755 public static Bitmap decodeStream(InputStream is) {
760 * Decode a bitmap from the file descriptor. If the bitmap cannot be decoded
764 * @param fd The file descriptor containing the bitmap data to decode
765 * @param outPadding If not null, return the padding rect for the bitmap if
767 * no bitmap is returned (null) then padding is
771 * @return the decoded bitmap, or null
773 * is {@link android.graphics.Bitmap.Config#HARDWARE}
778 public static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, Options opts) {
780 Bitmap bm;
798 throw new IllegalArgumentException("Problem decoding into existing bitmap");
809 * Decode a bitmap from the file descriptor. If the bitmap cannot be decoded
813 * @param fd The file descriptor containing the bitmap data to decode
814 * @return the decoded bitmap, or null
816 public static Bitmap decodeFileDescriptor(FileDescriptor fd) {
820 private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
822 private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
824 private static native Bitmap nativeDecodeAsset(long nativeAsset, Rect padding, Options opts);
825 private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,