Skip to content

Commit 1b860a0

Browse files
committed
Add scaling to DrawContext
Depends on killercup/libui@261a36d
1 parent a1d8972 commit 1b860a0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

ui-sys/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,4 +776,8 @@ extern {
776776
x: c_double,
777777
y: c_double,
778778
img: *const uiPixmapImage);
779+
780+
pub fn uiScalePixmapImage(c: *mut uiDrawContext,
781+
xScale: c_double,
782+
yScale: c_double);
779783
}

ui/src/draw.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ impl Context {
9393
ui_sys::uiDrawPixmapImage(self.ui_draw_context, x, y, img.as_ui_draw_image())
9494
}
9595
}
96+
97+
pub fn scale_image(&self, x_scale: f64, y_scale: f64) {
98+
unsafe {
99+
ui_sys::uiScalePixmapImage(self.ui_draw_context, x_scale, y_scale)
100+
}
101+
}
96102
}
97103

98104
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)