Fill polygon????

This is a discussion on Fill polygon???? within the C++ Programming forums, part of the General Programming Boards category; Hi, I'm Phoenix a beginnen with C++ I controle Java and I'm working on a tic-tac-toe game but I have ...

  1. #1
    Java > C++ PhoenixC++'s Avatar
    Join Date
    Apr 2004
    Posts
    8

    Question Fill polygon????

    Hi,

    I'm Phoenix a beginnen with C++ I controle Java and I'm working on a tic-tac-toe game but I have a problem.

    I'm trying to fill a polygon shape. I already tryed FillRect and FloodFill And I hope that some one can help me here.
    The polygon shape is:

    POINT line[6] = {100,13, 107,268, 104,253, 106,285, 100,265, 96,286};
    Polygon(hDC, line, 6);

    Can anyone help me with this??

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Java > C++ PhoenixC++'s Avatar
    Join Date
    Apr 2004
    Posts
    8
    I also tryed that but it didn't work I will try again but can you an example?? Thank anyway!
    Greets Phoenix

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    FLOODFILLBORDER:
    Code:
    case WM_PAINT:
      {
      /*draw triangle with green border and fill it with red stripes*/
      int nDC;
      PAINTSTRUCT ps;
      POINT pts[]={{100,10},{200,110},{10,110},{100,10}};
      COLORREF clr=RGB(0,128,0);
      HBRUSH hbr=CreateHatchBrush(HS_BDIAGONAL,RGB(128,0,0));
      HPEN hPen=CreatePen(PS_SOLID,1,clr);
    
      BeginPaint(hwnd,&ps);
        nDC=SaveDC(ps.hdc);
        SelectObject(ps.hdc,hPen);
        Polyline(ps.hdc,pts,4);
        SelectObject(ps.hdc,hbr);
        ExtFloodFill(ps.hdc,100,70,clr,FLOODFILLBORDER);
        RestoreDC(ps.hdc,nDC);
        EndPaint(hwnd,&ps);
      DeleteObject(hPen);
      return 0;
      }
    FLOODFILLSURFACE:
    Code:
    case WM_PAINT:
      {
      /*draw triangle and fill it with red stripes*/
      int nDC;
      PAINTSTRUCT ps;
      POINT pts[]={{100,10},{200,110},{10,110},{100,10}};
      COLORREF clr;
      HBRUSH hbr=CreateHatchBrush(HS_BDIAGONAL,RGB(128,0,0));
    
      BeginPaint(hwnd,&ps);
        nDC=SaveDC(ps.hdc);
        Polyline(ps.hdc,pts,4);
        clr=GetPixel(ps.hdc,100,70);
        SelectObject(ps.hdc,hbr);
        ExtFloodFill(ps.hdc,100,70,clr,FLOODFILLSURFACE);
        RestoreDC(ps.hdc,nDC);
      EndPaint(hwnd,&ps);
      return 0;
      }
    Please post future windows questions on the windows board.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Java > C++ PhoenixC++'s Avatar
    Join Date
    Apr 2004
    Posts
    8
    Dude Thank you very must and sorry for posting on the wrong board!1
    Greets Phoenix!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Point in polygon test - spherical coords
    By bhdz in forum C Programming
    Replies: 1
    Last Post: 11-07-2007, 01:25 PM
  2. help how to make polygon
    By gamett711221 in forum C++ Programming
    Replies: 3
    Last Post: 02-20-2005, 08:33 PM
  3. Replies: 3
    Last Post: 12-22-2004, 07:29 PM
  4. my polygon class
    By ichijoji in forum Game Programming
    Replies: 5
    Last Post: 08-02-2004, 09:42 AM
  5. IDEA: Polygon unions and intersections
    By Magos in forum Contests Board
    Replies: 3
    Last Post: 05-21-2003, 08:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21