Exemplo n.º 1
0
    public bool Draw(SVGPackedBin bin, SVGColor clearColor, SVGRenderingQuality renderingQuality)
    {
        int err;

        // set clear color
        if (!this.SetClearColor(clearColor))
            return false;

        if (bin != null && bin.Rectangles.Length > 0)
        {
            if ((err = AmanithSVG.svgtPackingDraw(bin.Index, 0, (uint)bin.Rectangles.Length, this.Handle, (uint)renderingQuality)) != AmanithSVG.SVGT_NO_ERROR)
            {
                AmanithSVG.svgtErrorLog("Surface draw error (drawing packed bin): ", err);
                return false;
            }
        }
        return true;
    }
Exemplo n.º 2
0
    /*
        Draw an SVG document, on this drawing surface.

        First the drawing surface is cleared if a valid (i.e. not null) clear color is provided.
        Then the specified document, if valid, is drawn.

        It returns true if the operation was completed successfully, else false.
    */
    public bool Draw(SVGDocument document, SVGColor clearColor, SVGRenderingQuality renderingQuality)
    {
        int err;

        // set clear color
        if (!this.SetClearColor(clearColor))
            return false;

        if (document != null)
        {
            // update document viewport (AmanithSVG backend)
            if (!document.UpdateViewport())
                return false;
            // update surface viewport (AmanithSVG backend)
            if (!this.UpdateViewport())
                return false;

            // draw the document
            if ((err = AmanithSVG.svgtDocDraw(document.Handle, this.Handle, (uint)renderingQuality)) != AmanithSVG.SVGT_NO_ERROR)
            {
                AmanithSVG.svgtErrorLog("Surface draw error (drawing document): ", err);
                return false;
            }
        }
        return true;
    }