Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
34
Task/Grayscale-image/MiniScript/grayscale-image.mini
Normal file
34
Task/Grayscale-image/MiniScript/grayscale-image.mini
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
greyedColor = function(colr)
|
||||
clist = color.toList(colr)
|
||||
lum = [0.2126, 0.7152, 0.0722]
|
||||
|
||||
red = clist[0] * lum[0]
|
||||
green = clist[1] * lum[1]
|
||||
blue = clist[2] * lum[2]
|
||||
grey = red + green + blue
|
||||
return color.fromList([grey, grey, grey, clist[3]])
|
||||
end function
|
||||
|
||||
toGreyScale = function(img)
|
||||
greyImg = Image.create(img.width, img.height)
|
||||
for x in range(0, img.width - 1)
|
||||
for y in range(0, img.height - 1)
|
||||
greyed = greyedColor(img.pixel(x, y))
|
||||
greyImg.setPixel x, y, greyed
|
||||
end for
|
||||
end for
|
||||
return greyImg
|
||||
end function
|
||||
|
||||
clear
|
||||
|
||||
// The turtle and color wheel images are included with MiniMicro
|
||||
turtle = file.loadImage("/sys/pics/animals/turtle.png")
|
||||
greyTurtle = toGreyScale(turtle)
|
||||
gfx.drawImage turtle, 0, 0
|
||||
gfx.drawImage greyTurtle, turtle.width, 0
|
||||
|
||||
colorWheel = file.loadImage("/sys/pics/ColorWheel.png")
|
||||
greyWheel = toGreyScale(colorWheel)
|
||||
gfx.drawImage colorWheel, 0, 320
|
||||
gfx.drawImage greyWheel, greyWheel.width, 320
|
||||
Loading…
Add table
Add a link
Reference in a new issue