Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to cut ellipse in to four regions.

How to cut ellipse in to four regions.

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pallaka
    wrote on last edited by
    #1

    I am drawing an ellipse in a rectangle... I have to cut into four parts I need the region of that so that i can fill the color individually in thoes region. To make it more clear If we divide the ellipse into four quarters. then i should know the region and i want to fill them with different color.

    _ D 2 Replies Last reply
    0
    • P pallaka

      I am drawing an ellipse in a rectangle... I have to cut into four parts I need the region of that so that i can fill the color individually in thoes region. To make it more clear If we divide the ellipse into four quarters. then i should know the region and i want to fill them with different color.

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      See here[^]

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • P pallaka

        I am drawing an ellipse in a rectangle... I have to cut into four parts I need the region of that so that i can fill the color individually in thoes region. To make it more clear If we divide the ellipse into four quarters. then i should know the region and i want to fill them with different color.

        D Offline
        D Offline
        Dan 0
        wrote on last edited by
        #3

        You could use GDI+ FillPie function. Just get the bounds of the ellipse, ie

        void Draw( int px, int py, int xRadius, int yRadius )
        {
        Graphics *g = ....
        Rect rcBnds( px, py, xRadius*2, yRadius*2 );
        Brush *brColor = first color;
        // Draw lower right
        g->FillPie( brColor, rcBnds, 0, 90 );
        brColor = second color;
        g->FillPie( brColor, rcBnds, 90, 180 );
        brColor = third color;
        g->FillPie( brColor, rcBnds, 180, 270 );
        brColor = last color;
        g->FillPie( brColor, rcBnds, 270, 360 );
        }

        Of course you can use regular GDI and Pie(), you just have to calc the points yourself, which is easy since you are just dividing into 4 parts.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups