44! The returned tensor layout is [column][row][channel] (width, height, channel)
55! in user code. Channels are ordered r, g, b, a and values are 0..255.
66
7+ EXTEND(EXTENSION: win32)
8+
79EXTEND(EXTENSION: image)
810
911IMPORT(path)
1012
1113FUNC TNS: LOAD(STR: img_path){
1214 STR: ext = path.EXTNAME(img_path)
1315 IF(EQ(ext, "png")){
14- RETURN(image. LOAD_PNG(img_path))
16+ RETURN(LOAD_PNG(img_path))
1517 } ELSEIF (OR(EQ(ext, "jpg"),EQ(ext, "jpeg"))){
16- RETURN(image. LOAD_JPEG(img_path))
18+ RETURN(LOAD_JPEG(img_path))
1719 } ELSEIF (EQ(ext, "bmp")){
18- RETURN(image. LOAD_BMP(img_path))
20+ RETURN(LOAD_BMP(img_path))
1921 } ELSE {
2022 THROW("Unsupported image format: ",ext)
2123 }
@@ -89,7 +91,7 @@ FUNC TNS: RECT(TNS: img, INT: x, INT: y, INT: width, INT: height, TNS: color, IN
8991 [x, ADD(y, SUB(height, 0d1))], ^
9092 [x, y] ^
9193 ]
92- RETURN(image. POLYGON(img, pts, color, fill, thickness))
94+ RETURN(POLYGON(img, pts, color, fill, thickness))
9395}
9496
9597FUNC TNS: RECTANGLE(TNS: img, INT: x, INT: y, INT: width, INT: height, TNS: color, INT: fill, INT: thickness){
@@ -101,15 +103,15 @@ FUNC TNS: FILL_RECT(TNS: img, INT: x, INT: y, INT: width, INT: height, TNS: colo
101103}
102104
103105FUNC TNS: FILL_ELLIPSE(TNS: img, TNS: center, INT: rx, INT: ry, TNS: color){
104- RETURN(image. ELLIPSE(img, center, rx, ry, color, 0d1, 0d1))
106+ RETURN(ELLIPSE(img, center, rx, ry, color, 0d1, 0d1))
105107}
106108
107109FUNC TNS: SQUARE(TNS: img, INT: x, INT: y, INT: size, TNS: color, INT: fill, INT: thickness){
108110 RETURN(RECT(img, x, y, size, size, color, fill, thickness))
109111}
110112
111113FUNC TNS: CIRCLE(TNS: img, TNS: center, INT: radius, TNS: color, INT: fill, INT: thickness){
112- RETURN(image. ELLIPSE(img, center, radius, radius, color, fill, thickness))
114+ RETURN(ELLIPSE(img, center, radius, radius, color, fill, thickness))
113115}
114116
115117FUNC TNS: CROP(TNS: img, TNS: corners){
@@ -123,7 +125,7 @@ FUNC BOOL: SHOW(TNS: img){
123125 ! Save the image to the provided path and open it with the system default
124126 ! viewer on Windows. `img_path` is treated as the target file path.
125127 STR: img_path = "C:/Windows/Temp/tmp_img.png"
126- image. SAVE_PNG(img, img_path, 0d0)
128+ SAVE_PNG(img, img_path, 0d0)
127129 ! ShellExecuteW(hwnd, operation, file, params, dir, showcmd)
128130 ! Use NULL hwnd (0), operation "open", empty params and dir, showcmd=1
129131 win32.WIN_CALL("shell32", "ShellExecuteW", "PSSSSI", "P", 0d0, "open", img_path, "", "", 0d1)
0 commit comments