Computer Science Canada

some colorful procedure

Author:  Homer_simpson [ Mon May 12, 2003 2:15 am ]
Post subject:  some colorful procedure

code:

procedure changepicture (x1, y1, x2, y2, c, p : int)
    var ii := 0
    randint (ii, 1, 255)
    for xx : x1 .. x2
        for yy : y1 .. y2
            if whatdotcolor (xx, yy) not= c then
                case p of
                    label 1 :
                        drawdot (xx, yy, ii)
                    label 2 :
                        if whatdotcolor (xx, yy) > 26 then
                            drawdot (xx, yy, (whatdotcolor (xx, yy) mod 16) + 16)
                            locate (1, 1)
                            put "jazz"
                        elsif whatdotcolor (xx, yy) < 16 then
                            drawdot (xx, yy, (whatdotcolor (xx, yy) mod 16) + 16)
                            locate (2, 1)
                            put "jazz"
                        end if

                    label 3 :
                        var i := 0
                        randint (i, 1, 255)
                        drawdot (xx, yy, i)
                    label 4 :
                        var i := 0
                        randint (i, 16, 28)
                        drawdot (xx, yy, i)
                    label :
                end case
            end if
        end for
    end for
end changepicture


var i := 0
View.Set ("offscreenonly")
loop
    i += 10
    drawfillarc (320, 200, 50, 50, i, i + 90, 9)
    changepicture (270, 150, 320, 200, white, 1)
    changepicture (270, 200, 320, 250, white, 3)
    changepicture (320, 200, 370, 250, white, 4)
    drawbox (270, 150, 370, 250, black)
    View.Update
    cls
end loop

Author:  Homer_simpson [ Mon May 12, 2003 2:34 am ]
Post subject: 

k here's how it workes x1,y1,x2,y2 obviously set the area to be edited by procedure. parameter c is the background color. parameter p is the action to be performed the actions are

the value of p=1 change the color randomly
the value of p=2 turn the image black and white
the value of p=3 turn the image to black and white statics
the value of p=4 turn image to full color statics

(try turning a bmp black and white...)

Author:  Homer_simpson [ Mon May 12, 2003 2:41 am ]
Post subject: 

download


: