Пример #1
0
void wxSVGFileDCImpl::DoSetClippingRegion( int x,  int y, int width, int height )
{
    wxString svg;

    // End current graphics group to ensure proper xml nesting (e.g. so that
    // graphics can be subsequently changed inside the clipping region)
    svg << "</g>\n"
        "<defs>\n"
        "<clipPath id=\"clip" << m_clipNestingLevel << "\">\n"
        "<rect id=\"cliprect" << m_clipNestingLevel << "\" "
        "x=\"" << x << "\" "
        "y=\"" << y << "\" "
        "width=\"" << width << "\" "
        "height=\"" << height << "\" "
        "style=\"stroke: gray; fill: none;\"/>\n"
        "</clipPath>\n"
        "</defs>\n"
        "<g style=\"clip-path: url(#clip" << m_clipNestingLevel << ");\">\n";

    write(svg);

    // Re-apply current graphics to ensure proper xml nesting
    DoStartNewGraphics();

    m_clipUniqueId++;
    m_clipNestingLevel++;
}
Пример #2
0
void wxSVGFileDCImpl::NewGraphicsIfNeeded()
{
    if ( !m_graphics_changed )
        return;

    m_graphics_changed = false;

    write(wxS("</g>\n"));

    DoStartNewGraphics();
}
Пример #3
0
void wxSVGFileDCImpl::DestroyClippingRegion()
{
    wxString svg;

    // End current graphics element to ensure proper xml nesting (e.g. graphics
    // might have been changed inside the clipping region)
    svg << "</g>\n";

    // Close clipping group elements
    for (size_t i = 0; i < m_clipUniqueId; i++)
    {
        svg << "</g>\n";
    }

    write(svg);

    // Re-apply current graphics (e.g. brush may have been changed inside one
    // of the clipped regions - that change will have been lost after xml
    // elements for the clipped region have been closed).
    DoStartNewGraphics();

    m_clipUniqueId = 0;
}