mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/utils/image.rs')
-rw-r--r--src/utils/image.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/image.rs b/src/utils/image.rs
index 50a4cf7..867d1fc 100644
--- a/src/utils/image.rs
+++ b/src/utils/image.rs
@@ -12,3 +12,16 @@ pub fn tint(image: &mut RgbaImage, color: Rgb<u8>) {
*b = (*b as f32 * tb) as u8;
}
}
+
+pub fn repeat(to: &mut RgbaImage, from: &RgbaImage) {
+ for x in 0..(to.width() / from.width()) {
+ for y in 0..(to.height() / from.height()) {
+ image::imageops::overlay(
+ to,
+ from,
+ (x * from.width()).into(),
+ (y * from.height()).into(),
+ );
+ }
+ }
+}