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. Problem with regions

Problem with regions

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorial
3 Posts 2 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.
  • E Offline
    E Offline
    emadns
    wrote on last edited by
    #1

    Hi, I have a problem when creating win32 regions and drawing into them. The edges of the shapes drawing inside the region are distored or cut-off. For example: CDC* pdc = GetDC(); CRgn rgn; rgn.CreateEllipticRgn(10,10,50,50); pdc->SelectClipRgn(&rgn, RGN_COPY); pdc->Ellipse(10, 10, 50, 50); pdc->SelectClipRgn(NULL, RGN_COPY); ReleaseDC(pdc); Although the coordinates of the region are the same of the ellipse coordinates, it still does not draw the ellipse perfectly. The edges are distorted. Is there a way I can calculate the perfect region. I also do not want to use paths as they don't work properly in win98. What could be the solution. Thanks

    B 1 Reply Last reply
    0
    • E emadns

      Hi, I have a problem when creating win32 regions and drawing into them. The edges of the shapes drawing inside the region are distored or cut-off. For example: CDC* pdc = GetDC(); CRgn rgn; rgn.CreateEllipticRgn(10,10,50,50); pdc->SelectClipRgn(&rgn, RGN_COPY); pdc->Ellipse(10, 10, 50, 50); pdc->SelectClipRgn(NULL, RGN_COPY); ReleaseDC(pdc); Although the coordinates of the region are the same of the ellipse coordinates, it still does not draw the ellipse perfectly. The edges are distorted. Is there a way I can calculate the perfect region. I also do not want to use paths as they don't work properly in win98. What could be the solution. Thanks

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Are you acconting for the pen width of the border of the object? In that case, your region needs to be slightly larger than the actual object boundaries, since most programs leave the pen drawing code to drawn ON the object's edge rather than within it. Since I don't see any code explicitly setting your pen, it could be any guess what it is at the time this code executes. Are you seeing distortion when the pen width is more than 1? I would not expect it too much with this code when the pen width is 1, except maybe at the outer edge of the ellipse. No shirt, no shoes, no brains, no service.

      E 1 Reply Last reply
      0
      • B Blake Miller

        Are you acconting for the pen width of the border of the object? In that case, your region needs to be slightly larger than the actual object boundaries, since most programs leave the pen drawing code to drawn ON the object's edge rather than within it. Since I don't see any code explicitly setting your pen, it could be any guess what it is at the time this code executes. Are you seeing distortion when the pen width is more than 1? I would not expect it too much with this code when the pen width is 1, except maybe at the outer edge of the ellipse. No shirt, no shoes, no brains, no service.

        E Offline
        E Offline
        emadns
        wrote on last edited by
        #3

        Thanks for your reply. I am not selecting any pen into the device, so I assume that the default is a 1 pixel black pen. I tried making the region larger by one pixel, but the result shows the ellipse. However, there are extra little blank spaces around the ellipse. I also tried to make the pen PS_INSIDEFRAME but with the same result.

        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