Skip to content

Commit

Permalink
bitmap: Add new RGBA_1010102 constant since NDK r25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Jul 26, 2022
1 parent 80fa818 commit b7b6ac1
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions ndk/src/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,19 @@ fn construct<T>(with_ptr: impl FnOnce(*mut T) -> i32) -> BitmapResult<T> {
BitmapError::from_status(status).map(|()| unsafe { result.assume_init() })
}

// IntoPrimitive, TryFromPrimitive use the deprecated `RGBA_4444` member below,
// resulting in deprecation warnings in generated code beyond the `enum`. These
// can only be disabled at the module level, and such warnings seem to be gone on
// at least the Rust 1.56 nightlies.
#[allow(deprecated)]
mod temp_allow_deprecated {
use super::*;
#[repr(u32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, IntoPrimitive, TryFromPrimitive)]
#[allow(non_camel_case_types)]
pub enum BitmapFormat {
NONE = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_NONE.0,
RGBA_8888 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_8888.0,
RGB_565 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGB_565.0,
#[deprecated = "Deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead."]
RGBA_4444 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_4444.0,
A_8 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_A_8.0,
RGBA_F16 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_F16.0,
}
#[repr(u32)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, IntoPrimitive, TryFromPrimitive)]
#[allow(non_camel_case_types)]
pub enum BitmapFormat {
NONE = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_NONE.0,
RGBA_8888 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_8888.0,
RGB_565 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGB_565.0,
#[deprecated = "Deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead."]
RGBA_4444 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_4444.0,
A_8 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_A_8.0,
RGBA_F16 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_F16.0,
RGBA_1010102 = ffi::AndroidBitmapFormat::ANDROID_BITMAP_FORMAT_RGBA_1010102.0,
}
pub use temp_allow_deprecated::*;

/// An immediate wrapper over [`android.graphics.Bitmap`]
///
Expand Down

0 comments on commit b7b6ac1

Please sign in to comment.