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. GraphicsPath::Outline problem (GDI+)

GraphicsPath::Outline problem (GDI+)

Scheduled Pinned Locked Moved C / C++ / MFC
c++winformsgraphicshelpannouncement
1 Posts 1 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.
  • G Offline
    G Offline
    grotesque
    wrote on last edited by
    #1

    I'm having a problem with the Outline method not working after I've applied a certain transformation to the GraphicsPath object (see code below). The problem occurs after the GraphicsPath object is scaled with either the X factor or/and the Y factor set to a negative value (causing flip/mirror). Code:

    GraphicsPath path1;
    GraphicsPath path2;
    
    path1.AddString(L"GDI+", -1, &family, FontStyleRegular, 144, rect, &format);
    path2.AddString(L"GDI+", -1, &family, FontStyleRegular, 144, rect, &format);
    
    REAL offsetX = rect.GetLeft() + rect.Width / 2.0f;
    REAL offsetY = rect.GetTop() + rect.Height / 2.0f;
    
    Matrix matrix;
    matrix.Translate(-offsetX, -offsetY, MatrixOrderAppend);
    matrix.Scale(1.0f, -1.0f, MatrixOrderAppend);  // negative Y factor causing
                                                        // the path to "flip"
    matrix.Translate(offsetX, offsetY + 110.0f, MatrixOrderAppend);
    
    path2.Transform(&matrix);
    
    Pen pen(Color(255, 255, 0, 0));
    
    path1.AddPath(&path2,TRUE);
    path1.Outline();   // fails due to the scaling transformation above
                            // the shapes overlap instead om "melting together"
    
    pGraphics->DrawPath(&pen, &path1);
    

    Any light on this problem would be much appreciated.:) (Using VC 6.0 and the C++ version of GDI+)

    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