Simple scale concept

This commit is contained in:
2025-02-17 17:46:59 +01:00
parent ebf640520e
commit a797bff7a1
2 changed files with 85 additions and 67 deletions

View File

@@ -3,14 +3,17 @@ component VRAMSegment inherits Rectangle {
in property <image> img;
in property <int> clip_x;
in property <int> clip_y;
in property <int> scale: 1;
width: 64px;
height: 256px;
width: 64px*scale;
height: 256px*scale;
clip: true;
Image {
source: img;
x: -root.clip_x*1px;
y: -root.clip_y*1px;
x: -root.clip_x*1px*scale;
y: -root.clip_y*1px*scale;
width: img.width*1px*scale;
height: img.height*1px*scale;
}
}
@@ -18,17 +21,19 @@ export component VRAMArea inherits Rectangle {
in property <image> img;
in property <int> img_x;
in property <int> img_y;
in property <int> scale: 1;
width: (64*16+15)*1px;
height: (256*2+1)*1px;
width: ((64*16+15)*1px)*scale;
height: ((256*2+1)*1px)*scale;
for idx in 32 : VRAMSegment {
x: root.get_x(idx)*(64px + 1px);
y: root.get_y(idx)*(256px + 1px);
x: (root.get_x(idx)*(64px + 1px))*scale;
y: (root.get_y(idx)*(256px + 1px))*scale;
img: img;
clip_x: (root.get_x(idx)*64) - root.img_x;
clip_y: (root.get_y(idx)*256) - root.img_y;
scale: root.scale;
}
function get_x(idx: int) -> int {