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
use crate::macros::wrap;
use servicepoint::{Bitmap, BitmapCommand, CompressionCode, Origin};
use std::ptr::NonNull;
wrap! {
BitmapCommand {
derives: crate::commands::derive_command[Bitmap], crate::commands::derive_origin_accessors;
properties:
prop bitmap: Bitmap { get mut; set move; };
prop compression: CompressionCode { get; set; };
functions:
/// Sets a window of pixels to the specified values.
///
/// The passed [Bitmap] gets consumed.
///
/// Returns: a new [BitmapCommand] instance.
fn new(
bitmap: move NonNull<Bitmap>,
origin_x: val usize,
origin_y: val usize,
compression: val CompressionCode,
) -> move NonNull<BitmapCommand> {
BitmapCommand {
bitmap,
origin: Origin::new(origin_x, origin_y),
compression,
}
};
/// Move the provided [Bitmap] into a new [BitmapCommand],
/// leaving other fields as their default values.
///
/// Rust equivalent: `BitmapCommand::from(bitmap)`
fn from_bitmap(bitmap: move NonNull<Bitmap>) -> move NonNull<BitmapCommand> {
bitmap.into()
};
}
}