Computer Science Canada

Drawing modes

Author:  BenLi [ Sat Jul 08, 2006 11:42 am ]
Post subject:  Drawing modes

When using Pic.Draw or Pic.ScreenLoad, you will need to select modes

picCopy copies the picture directly onto the screen
this code draws a circle and Pic.New it. it then copies the picture onto a black background

code:

drawfilloval (50,50,50,50, brightblue)
var pic:= Pic.New (0,0,100,100)
cls

drawfillbox (0,0,maxx,maxy, 7)
Pic.Draw (pic, 100,100, picCopy)


picMerge draws the picture but not the background color
it essentially makes the backgound transparent
NOTE: picMerge can slow down your program

code:

drawfilloval (50,50,50,50, brightblue)
var pic:= Pic.New (0,0,100,100)
cls

drawfillbox (0,0,maxx,maxy, 7)
Pic.Draw (pic, 100,100, picMerge)


picUnderMerge draws the picture only where the destination is the background color.
It creates an effect of the picture being under the destination

code:


drawfillbox (0,0,100,50, brightblue)
var pic:= Pic.New (0,0,100,50)
cls

drawfillbox (25, 0, 75, 100, green)
Pic.Draw (pic, 0,0, picUnderMerge)



picXor basically uses an exclusive OR to distort colors
in this example picXOR turns white into black
...not going to fully explain XOR
code:

var font := Font.New ("STENCIL:65:bold")
  var line : int
    drawline (0, 0, 0, maxy, 7)
    line := Pic.New (0, 0, 0, maxy)
    Draw.Text ("COMPSCI.CA", 50, 275, font, black)
    for i : 1 .. 800
        Pic.Draw (line, i, 0, picXor)
        View.Update
    end for

Author:  Delos [ Sat Jul 08, 2006 12:11 pm ]
Post subject: 

Thanks for the attempt. There is a *lot* that needs fixing in this though. For a start, indent your code. It looks a little shoddy there. Second, if you're going to make a tut on Drawing Modes, why are you not going to fully explain XOR?
The basics have been covered in brief in Dan's Pic.() tut, but there was a request for an expansion on these topics - so in that respect this is a good idea. However, you will have to expand greatly on this for it to become useful to anyone. Among other things, the following need to be added:
- more discussion. Throwing out some code an vanilla explanations neither demonstrates your capability with the topic nor guides others into it.
- more application. There are many instances when one has to choose which of these modes to use. Details a few, go through the process of deciding which to use and why.
- more examples. You need a little more code there - perhaps using external pics as well as interally created. Not much difference in terms of application, but useful to at least see it there.
- formatting. Tutorials are required to meet certain standards. Not only content-wise, but visually too. Right now, this hasn't much of an effect on things, but in V3 tut's will be screened. If you want to have your considered for final inclusion, you'll need to add the standardized BB formatting you see in the other tuts. PM either myself or Cervantes for the code.

Pending changes, you have some bits awaiting you.


: