#[derive(Clone, Copy, Hash, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[repr(u8)]
pub enum CompositeOperation {
SourceOver = 0,
SourceIn,
SourceOut,
SourceAtop,
DestinationOver,
DestinationIn,
DestinationOut,
DestinationAtop,
Lighter,
Copy,
Xor,
Multiply,
Screen,
Overlay,
Darken,
Lighten,
ColorDodge,
ColorBurn,
HardLight,
SoftLight,
Difference,
Exclusion,
Hue,
Saturation,
Color,
Luminosity,
}
pub type TextureCallback = extern "C" fn(texture: i32, user_data: *mut ());
#[link(wasm_import_module = "qwac_graphics")]
extern "C" {
pub fn canvas_create() -> i32;
pub fn canvas_resize(canvas: i32, width_px: i32, height_px: i32);
pub fn canvas_clear(canvas: i32);
pub fn canvas_save(canvas: i32);
pub fn canvas_restore(canvas: i32);
pub fn canvas_set_global_alpha(canvas: i32, alpha: f32);
pub fn canvas_set_global_composite_operation(canvas: i32, operation: CompositeOperation);
pub fn canvas_set_fill_style(canvas: i32, style: *const u8, length: i32);
pub fn canvas_set_stroke_style(canvas: i32, style: *const u8, length: i32);
pub fn canvas_set_font(canvas: i32, font: *const u8, length: i32);
pub fn canvas_set_line_width(canvas: i32, width: f32);
pub fn canvas_path_begin(canvas: i32);
pub fn canvas_path_close(canvas: i32);
pub fn canvas_path_stroke(canvas: i32);
pub fn canvas_path_fill(canvas: i32);
pub fn canvas_path_move_to(canvas: i32, x: f32, y: f32);
pub fn canvas_path_line_to(canvas: i32, x: f32, y: f32);
pub fn canvas_path_rectangle(canvas: i32, x: f32, y: f32, width: f32, height: f32);
pub fn canvas_path_ellipse(
canvas: i32,
x: f32,
y: f32,
radius_x: f32,
radius_y: f32,
rotation: f32,
start_angle: f32,
end_angle: f32,
counter_clockwise: i32,
);
pub fn canvas_path_arc(
canvas: i32,
x: f32,
y: f32,
radius: f32,
start_angle: f32,
end_angle: f32,
counter_clockwise: i32,
);
pub fn canvas_path_arc_to(canvas: i32, x1: f32, y1: f32, x2: f32, y2: f32, radius: f32);
pub fn canvas_fill_text(
canvas: i32,
text: *const u8,
length: i32,
x: f32,
y: f32,
max_width: f32,
);
pub fn canvas_stroke_text(
canvas: i32,
text: *const u8,
length: i32,
x: f32,
y: f32,
max_width: f32,
);
pub fn canvas_fill_rectangle(canvas: i32, x: f32, y: f32, width: f32, height: f32);
pub fn canvas_stroke_rectangle(canvas: i32, x: f32, y: f32, width: f32, height: f32);
pub fn canvas_clear_rectangle(canvas: i32, x: f32, y: f32, width: f32, height: f32);
pub fn canvas_draw_texture(
canvas: i32,
texture: i32,
source_x: f32,
source_y: f32,
source_width: f32,
source_height: f32,
dest_x: f32,
dest_y: f32,
dest_width: f32,
dest_height: f32,
);
pub fn canvas_draw_canvas(
canvas: i32,
source_canvas: i32,
source_x: f32,
source_y: f32,
source_width: f32,
source_height: f32,
dest_x: f32,
dest_y: f32,
dest_width: f32,
dest_height: f32,
);
pub fn canvas_width(canvas: i32) -> i32;
pub fn canvas_height(canvas: i32) -> i32;
pub fn canvas_drop(canvas: i32);
pub fn texture_from_canvas(canvas: i32, callback: TextureCallback, user_data: *mut ());
pub fn texture_from_texture(texture: i32, callback: TextureCallback, user_data: *mut ());
pub fn texture_from_rgba(
data: *const u8,
width: i32,
height: i32,
callback: TextureCallback,
user_data: *mut (),
);
pub fn texture_from_file(
data: *const u8,
size: i32,
mime_type: *const u8,
mime_type_size: i32,
callback: TextureCallback,
user_data: *mut (),
);
pub fn texture_width(texture: i32) -> i32;
pub fn texture_height(texture: i32) -> i32;
pub fn texture_drop(texture: i32);
}