Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Hex Image
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
octopi




PostPosted: 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.



heximage.zip
 Description:
You can change the hex.jpg image if you want.

Download
 Filename:  heximage.zip
 Filesize:  597.93 KB
 Downloaded:  889 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Thu Feb 19, 2004 8:21 pm   Post subject: (No subject)

thats cool
octopi




PostPosted: Thu Feb 19, 2004 9:33 pm   Post subject: (No 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.
jonos




PostPosted: Thu Feb 19, 2004 10:11 pm   Post subject: (No subject)

nice program!!!

are you using whatdotcolor to enlarge the selection?
octopi




PostPosted: Thu Feb 19, 2004 10:15 pm   Post subject: (No 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.
jonos




PostPosted: Thu Feb 19, 2004 10:22 pm   Post subject: (No subject)

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




PostPosted: Thu Feb 19, 2004 11:49 pm   Post subject: (No subject)

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




PostPosted: Fri Feb 20, 2004 12:32 am   Post subject: (No 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.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: