Bitmap: Difference between revisions

1,094 bytes added ,  3 years ago
no edit summary
(Changed Image from object to ref object to allocate it on the heap.)
No edit summary
Line 2,061:
-- Changes the color of the pixel at point (320, 240) to black
img.setPixel(320, 240, rgb(0,0,0))</lang>
 
=={{header|LiveCode}}==
<lang LiveCode>
-- create an image container box at the center of the current stack window with default properties
create image "test"
-- programtically choose the paint bucket tool
choose bucket tool
-- LiveCode engine has built-in color keywords:
set the brushColor to "dark green"
-- programtically mouse click at the center of image container box to fill
click at the loc of image "test"
-- get the RGBA values of the first pixel in the image box
put byteToNum(byte 1 of the imageData of image "test") into tRed
put byteToNum(byte 2 of the imageData of image "test") into tGreen
put byteToNum(byte 3 of the imageData of image "test") into tBlue
put byteToNum(byte 4 of the imageData of image "test") into tAlpha
-- log message the info in the message box
put "First Pixel Color is Red:"& tRed &" Green:"& tGreen &" Blue:"& tBlue &" Transparency:"& tAlpha
-- just for fun replace the contents with RosettaCode logo
wait 2 seconds
set the filename of image "test" to "http://rosettacode.org/mw/title.png"
</lang>
 
=={{header|Lua}}==