+ Reply to Thread
Results 1 to 2 of 2

Thread: Draw Rectangle

  1. #1
    Krazy Guest

    Draw Rectangle

    Write a function void DrawRectangle(char *Screen, int x1, int y1, int x2, int y2). Height and width of the monitor is known. To set a pixel, you need to set that particular bit of the screen.

    Monitor is char array. Suppose you want to set a pixel at (10,0), Screen[0]=00000000 Screen[1]=01000000(10th bit from left is set)

  2. #2
    puspendra Guest
    #Define hight 100
    #Define width 200

    void (char *screen, int x, int y)
    {
    if( y >=hight || x>=width)
    return;
    screen[y*width]+x = 1;
    }

    void DrawRectangle(char *Screen, int x1, int y1, int x2, int y2)
    {
    for( int i=x=y1; i<=y2; ++i)
    {
    for(int j=x1;j<=x2; ++J)
    {
    setPixel(Screen,i,j);
    }
    }
    }

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 22nd September 2009, 11:59
  2. Draw DFA for ab*
    By TopGun in forum Adobe
    Replies: 1
    Last Post: 19th July 2008, 12:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts