Is it a known issue that cutouts of polygons will not be written to a pdf? I know the following is not enough code to reproduce the problem, but I just want to give a general idea of what I am doing and ask whether or not it should work or if this is a known issue. All of this is legacy code, I am not sure why it was done this way, or if it is the best way to do it. It does work correctly on the screen though.
Basically, it creates a polygon, and subtracts some cutouts. Then, (and this is the part that seems a little iffy), it create a rectangle that is the extent of the polygon. It sets the clipping region to the original polygon, and draws the rectangle. Wx automatically clips the rectangle and the correct result including cutouts is drawn to the screen. However in the pdf, I am just getting the rectangle with no clipping.
Here are snippets of code. (Again, I know it is not enough to reproduce the problem, I'm just asking if it is expected to be able to work this way for the pdf.)
Code: Select all
// Create the polygon.
(*addr_graphics_region).mWX_region = new wxRegion(number_of_positions,(wxPoint *) position_array,wxWINDING_RULE);
// Create a cutout. May be several of these.
(*addr_graphics_region).mWX_region->Subtract(*((*addr_subtract_graphics_region).mWX_region));
// Create the rectangle.
wxCoord x;
wxCoord y;
wxCoord w;
wxCoord h;
(*addr_graphics_region).mWX_region->GetBox(x,y,w,h);
rect_position_array[0].x_coord = x;
rect_position_array[0].y_coord = y;
rect_position_array[1].x_coord = x+w;
rect_position_array[1].y_coord = y;
rect_position_array[2].x_coord = x+w;
rect_position_array[2].y_coord = y+h;
rect_position_array[3].x_coord = x;
rect_position_array[3].y_coord = y+h;
rect_position_array[4].x_coord = x;
rect_position_array[4].y_coord = y;
// Set the clipping region.
dc->SetDeviceClippingRegion(*((*addr_graphics_region).mWX_region));
// Draw the rectangle.
dc->DrawPolygon(5,(wxPoint *) rect_position_array,0,0,wxODDEVEN_RULE);
Thanks for your help and for all of your work on wx.
Ed