Computer Science Canada

Hex Image

Author:  octopi [ Thu Feb 19, 2004 8:10 pm ]
Post subject:  Hex Image

Makes a mozaic/pixelation type effect.

If I can find my hex functions I wrote last year I can make the size of the hex's variable, I just wrote a quicky drawhex function with fixed values.

Author:  Catalyst [ Thu Feb 19, 2004 8:21 pm ]
Post subject: 

thats cool

Author:  octopi [ Thu Feb 19, 2004 9:33 pm ]
Post subject: 

code:
procedure drawdashedbox (x1,y1,x2,y2,len, clr1, clr2 :int)
  var clr:int:=clr1
  var assx, assy:int
  for x: x1 .. x2 by len
     assx:=x
     if((assx div len) mod 2 = 1) then
       clr:=clr1
     end if
     if((x div len) mod 2 = 0) then
       clr:=clr2
     end if
     if((assx+len) > x2) then
       assx:=assx-len
     end if
     drawline (x,y1,assx+len,y1,clr)
     drawline (x,y2,assx+len,y2,clr)
  end for
  for y: y1 .. y2 by len
     assy:=y
     if((assy div len) mod 2 = 1) then
       clr:=clr1
     end if
     if((assy div len) mod 2 = 0) then
       clr:=clr2
     end if
     if((assy+len) > y2) then
       assy:=assy-len
     end if
     drawline (x1,y,x1,assy+len,clr)
     drawline (x2,y,x2,assy+len,clr)
  end for
end drawdashedbox


Uploaded new version, btw: you move the box around, and click the mouse when you have selected a part of the image.

Author:  jonos [ Thu Feb 19, 2004 10:11 pm ]
Post subject: 

nice program!!!

are you using whatdotcolor to enlarge the selection?

Author:  octopi [ Thu Feb 19, 2004 10:15 pm ]
Post subject: 

Yah, I just take the mouse co-ordinates and then use whatdotcolor to fill an array with about 30x30 pixels, and then I just loop threw the array, and pass the color to my drawhexagon function.

For my box(that you use to select the image area) I just used a loop, that shows the image, and I used my drawdashedbox procedure as shown above in this post.

Author:  jonos [ Thu Feb 19, 2004 10:22 pm ]
Post subject: 

cool, im going to try to make that sometime!!!

Author:  octopi [ Thu Feb 19, 2004 11:49 pm ]
Post subject: 

I uploaded another version, this one uses my triangle function.

Author:  octopi [ Fri Feb 20, 2004 12:32 am ]
Post subject: 

Uploaded another version, This one has the parellelogram.
I know that the window utilization is messed (magnification doesn't fill screen.)

If you notice any other problems let me know.


: