1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
#![allow(
clippy::too_many_arguments,
clippy::let_and_return,
clippy::from_over_into
)]
use super::{Bitmap, Context, PixelFormat, Texture, TextureLoader};
use std::{fmt, ptr};
// @extends Object, @implements Texture;
pub struct Texture2DSliced {
// Texture _parent;
// GArray *slice_x_spans;
// GArray *slice_y_spans;
// GArray *slice_textures;
// int max_waste;
// PixelFormat internal_format;
}
impl Texture2DSliced {
pub fn from_bitmap(bmp: &Bitmap, max_waste: i32) -> Texture2DSliced {
// return _texture_2d_sliced_new_from_bitmap (bmp,
// max_waste,
// false);
unimplemented!()
}
pub fn from_data(
ctx: &Context,
width: u32,
height: u32,
max_waste: u32,
format: PixelFormat,
rowstride: u32,
data: &[u8],
) -> Texture2DSliced {
// Bitmap *bmp;
// Texture2DSliced *tex_2ds;
// _RETURN_VAL_IF_FAIL (format != PIXEL_FORMAT_ANY, NULL);
// _RETURN_VAL_IF_FAIL (data != NULL, NULL);
// Rowstride from width if not given
let rowstride = match rowstride {
0 => width * format.bytes_per_pixel(),
_ => rowstride,
};
// Wrap the data into a bitmap */
// bmp = bitmap_new_for_data (ctx,
// width, height,
// format,
// rowstride,
// (uint8_t *) data);
// tex_2ds = texture_2d_sliced_new_from_bitmap (bmp, max_waste);
// object_unref (bmp);
// if (tex_2ds &&
// !texture_allocate (TEXTURE (tex_2ds), error))
// {
// object_unref (tex_2ds);
// return NULL;
// }
// return tex_2ds;
unimplemented!()
}
pub fn from_file(ctx: &Context, filename: &str, max_waste: i32) -> Texture2DSliced {
// Bitmap *bmp;
// Texture2DSliced *tex_2ds = NULL;
// _RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL);
// bmp = _bitmap_from_file (ctx, filename, error);
// if (bmp == NULL)
// return NULL;
// tex_2ds = _texture_2d_sliced_new_from_bitmap (bmp,
// max_waste,
// true); /* can convert in-place */
// object_unref (bmp);
// return tex_2ds;
unimplemented!()
}
pub fn with_size(
context: &Context,
width: u32,
height: u32,
max_waste: u32,
) -> Texture2DSliced {
let loader = TextureLoader::Sized {
depth: 0,
width,
height,
};
Self::create_base(
context,
width,
height,
max_waste,
PixelFormat::Rgba8888Pre,
&loader,
)
}
fn create_base(
context: &Context,
width: u32,
height: u32,
max_waste: u32,
internal_format: PixelFormat,
loader: &TextureLoader,
) -> Self {
unimplemented!()
}
}
impl fmt::Display for Texture2DSliced {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Texture2DSliced")
}
}