Difference between revisions of "Image"

From MiniScript Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
In [[Mini Micro]], the <c>Image</c> class represents a picture, i.e. a rectangular array of pixel colors.
+
In [[Mini Micro]] and [[Soda]], the <c>Image</c> class represents a picture, i.e. a rectangular array of pixel colors.<br>
 +
<c>[[file]].loadImage</c> can be used to load an image from a file.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 11: Line 12:
 
| [[Image.pixel]](''x'',''y'') || get color of image pixel at ''x'',''y''
 
| [[Image.pixel]](''x'',''y'') || get color of image pixel at ''x'',''y''
 
|-
 
|-
| [[Image.setPixel]](''x'',''y'', ''c'') || set color of image pixel at ''x'',''y'' to ''c''
+
| [[Image.setPixel]] ''x'',''y'', ''c'' || set color of image pixel at ''x'',''y'' to ''c''
 
|-
 
|-
 
| [[Image.getImage]](''left'',''bottom'', ''width'', ''height'') || get a rectangular subregion of the image as a new Image
 
| [[Image.getImage]](''left'',''bottom'', ''width'', ''height'') || get a rectangular subregion of the image as a new Image
 +
|-
 +
| [[Image.create]](''width'', ''height'', ''c'') || create and return a new Image initialized to color ''c''
 +
|-
 +
| [[Image.fromScreen]](''width''=960, ''height''=640) || create an image from the current state of the screen, including all visible layers (a "screen shot"), scaled to the given width and height
 +
|-
 +
| [[Image.flip]](''vertical''=false) || flip the image vertically or horizontally, in place
 +
|-
 +
| [[Image.rotate]](''degrees''=90) || rotate the image in place, by ''degrees'' counter-clockwise (90° increments only)
 
|}
 
|}
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
 +
[[Category:Soda]]

Latest revision as of 17:55, 28 July 2024

In Mini Micro and Soda, the Image class represents a picture, i.e. a rectangular array of pixel colors.
file.loadImage can be used to load an image from a file.

Method or Property Purpose
Image.width image width, in pixels
Image.height image height, in pixels
Image.pixel(x,y) get color of image pixel at x,y
Image.setPixel x,y, c set color of image pixel at x,y to c
Image.getImage(left,bottom, width, height) get a rectangular subregion of the image as a new Image
Image.create(width, height, c) create and return a new Image initialized to color c
Image.fromScreen(width=960, height=640) create an image from the current state of the screen, including all visible layers (a "screen shot"), scaled to the given width and height
Image.flip(vertical=false) flip the image vertically or horizontally, in place
Image.rotate(degrees=90) rotate the image in place, by degrees counter-clockwise (90° increments only)