Thread: vector graphic drawing package in c

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    18

    vector graphic drawing package in c

    Hi all,

    I am required to submit "vector graphic drawing package in c" and i am not sure exactly what i will be doing because all drawing packages uses mouse to draw stuff but we are not taught/allowed to do that. I was wondering how on earth i am goping to do that.

    I was thinking on the line that first to create a structure and then somehow employing linked lists to store the info of line coordiantes into structure. But what i am not sure of is what would be the final stage and how i will ask the user to put coordinates of line, circle, rectangle etc.

    Important think to note is that this programme is aimed at 8-9 years old. So apparently should be very straight forward.

    Any ideas as to what/how i can present the info nicely on screen will be very appreciated.

    I am not looking for c syntaxes but as to what overall i should be doing. I would call myself an intermediate programmer in c with knowledge of pointers, functions, arrays, linked lists etc. but nothing whatsoever in c++.

    Thanks for reading the thread.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You might need Bresenham's line algorithm and the circle algorithm: http://www.brackeen.com/home/vga/shapes.html
    Maybe that's too advanced, though.

    But what i am not sure of is what would be the final stage and how i will ask the user to put coordinates of line, circle, rectangle etc.
    Why not just use scanf()?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > and i am not sure exactly what i will be doing because all drawing packages uses mouse to draw stuff
    So it's a command line driven program then, where you type in things like

    circle 100,100,10
    rectangle 100,100,10,10
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Dec 2005
    Posts
    18
    Thanx salem

    But problem is that this programme that i am working on is ideal for children aged 8-11 to draw new images from simple shapes like circle, square , rectangle etc. I cant expect them to write coordinates etc

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well then you'd better figure out how you plan on getting input first.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    >programme that i am working on is ideal for children aged 8-11 to draw new images
    But you also said "no mouse"

    So like Quzah said, you'd better figure out what you really want before doing anything else.

    Seems to me like you're trying to implement this
    http://el.media.mit.edu/logo-foundat...go/turtle.html
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    You can try implement some faux menu system in DOS, using arrow keys, I don't know.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing HBITMAP into CWnd, Acquired from "screenshot"
    By DeusAduro in forum Windows Programming
    Replies: 6
    Last Post: 07-02-2009, 03:41 PM
  2. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  3. Slow drawing code
    By tjpanda in forum Windows Programming
    Replies: 5
    Last Post: 05-09-2008, 05:09 PM
  4. Cannot install lrzsz package, please help
    By ssharish2005 in forum Tech Board
    Replies: 2
    Last Post: 06-20-2007, 05:36 AM
  5. Possible Loss of data
    By silicon in forum C Programming
    Replies: 3
    Last Post: 03-24-2004, 12:25 PM