Bitmap: Difference between revisions

1,184 bytes added ,  6 months ago
m
→‎{{header|Wren}}: Changed to Wren S/H
(→‎REXX version 1: Refurbished)
m (→‎{{header|Wren}}: Changed to Wren S/H)
(One intermediate revision by one other user not shown)
Line 3,634:
Use getPixels to retrieve the colour of a pixel. As with setPixels, this function is optimised to retrieve one row at a time as an array of colour values.
<syntaxhighlight lang="maxscript">local myPixel = getPixels myBitmap [256, 256] 1</syntaxhighlight>
 
=={{header|MiniScript}}==
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro].
<syntaxhighlight lang="miniscript">
// 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
</syntaxhighlight>
 
=={{header|Modula-3}}==
Since this code is for use with other tasks, it uses an interface as well as the implementation module.
Line 5,340 ⟶ 5,376:
{{libheader|DOME}}
The above library's ImageData class fits the bill here (version 1.3.0 or later).
<syntaxhighlight lang="ecmascriptwren">import "graphics" for Canvas, ImageData, Color
import "dome" for Window
 
Line 5,379 ⟶ 5,415:
Color (#29ADFFFF)
</pre>
 
=={{header|Xojo}}==
 
9,479

edits