31 lines
1020 B
Plaintext
31 lines
1020 B
Plaintext
// MiniMicro version of MiniScript has all the
|
|
// necessary methods built-in to complete this task.
|
|
width = 256
|
|
height = 256
|
|
colr = color.aqua
|
|
|
|
// Create the image with specified width/heigh. With
|
|
// no parameters, it defaults width/height to 64 and
|
|
// color to black
|
|
img = Image.create(width, height, colr)
|
|
|
|
// Create a diagonal line of multiple colors. Uses
|
|
// Cartesian coordinates so (0, 0) is lower left corner.
|
|
for i in range(0, 255)
|
|
img.setPixel i, i, color.rgb(i, i, i)
|
|
end for
|
|
|
|
// Get pixel color as RGBA hex values
|
|
print "Color at pixel (100, 100): " + img.pixel(100, 100)
|
|
print "Color at pixel (0, 0): " + img.pixel(0, 0)
|
|
print "Color at pixel (127, 127): " + img.pixel(127, 127)
|
|
print "Color at pixel (255, 255): " + img.pixel(255, 255)
|
|
|
|
// Display the image, resizing it to 127 x 127
|
|
gfx.drawImage img, 0, 0, 127, 127
|
|
|
|
// Save the file - accepted file extensions:
|
|
// tga, jpg, jpeg, and png (retains transparency)
|
|
// Optional third parameter is JPG compression quality.
|
|
file.saveImage "/usr/test.png", img
|