This shows you the differences between two versions of the page.
blocks:pixels [2017/09/30 09:03] |
blocks:pixels [2017/09/30 09:03] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Pixels ====== | ||
+ | |||
+ | |||
+ | A pixel is an object that contains a reference to the position and color of a single point in the instance's costume (a bitmap). The pixel's color can be reported or set using blocks from this category. The key to working with pixels is the **pixels** block, which returns a list of pixel objects, one for each pixel in the instance's costume. | ||
+ | |||
+ | It's possible to use the last two blocks in this category to directly get or set the color at a given x-y point in the costume, but for many image manipulation applications it is more convenient to work with a list of pixel objects. | ||
+ | |||
+ | ^ Blocks ^ Description ^ | ||
+ | | {{blocks:setwidth.png|}} | Set width and height of the instance's costume | | ||
+ | | {{blocks:copycostume.png|}} | Set instances costume to a copy of another image (Note: If you use the **set costume** block instead of this block you will change that costume everywhere in the project, including in the Images tab.) | | ||
+ | | {{blocks:pixels.png|}} | Reports a list of all pixels in the instance's costume | | ||
+ | | {{blocks:pixelat.png|}} | Reports a single pixel at a given point in the costume | | ||
+ | | {{blocks:redofpixel.png|}} | Report the red component of a pixel (0-255) | | ||
+ | | {{blocks:greenofpixel.png|}} | Report the green component of a pixel (0-255) | | ||
+ | | {{blocks:blueofpixel.png|}} | Report the blue component of a pixel (0-255) | | ||
+ | | {{blocks:setredofpixel.png|}} | Set the red component of color of a pixel | | ||
+ | | {{blocks:setgreenofpixel.png|}} | Set the green component of color of a pixel | | ||
+ | | {{blocks:setblueofpixel.png|}} | Set the blue component of color of a pixel | | ||
+ | | {{blocks:setgrayofpixel.png|}} | Set the red, green, and blue components of a pixel to the given value | | ||
+ | | {{blocks:xpospixel.png|}} | Report the x position of a pixel | | ||
+ | | {{blocks:ypospixel.png|}} | Report the y position of a pixel | | ||
+ | | {{blocks:colorofpixel.png|}} | Report the color of a pixel | | ||
+ | | {{blocks:setcolorpixel.png|}} | Set the color of a pixel | | ||
+ | | {{blocks:randomcolor.png|}} | Report a random color | | ||
+ | | {{blocks:transparent.png|}} | Report the transparent color | | ||
+ | | {{blocks:width.png|}} | Report the width of image | | ||
+ | | {{blocks:height.png|}} | Report the height of image | | ||
+ | | {{blocks:pixelcoloratxy.png|}} | Report the color of a pixel at the given position | | ||
+ | | {{blocks:setpixelcoloratxy.png|}} | Set the color of a pixel at the given position | | ||
+ | |||
+ | |||