MCPcopy Index your code
hub / github.com/benfry/processing4 / svgToImage

Method svgToImage

app/src/processing/app/ui/Toolkit.java:820–839  ·  view source on GitHub ↗

Render an SVG, passed in as a String, into an AWT Image at the specified width and height. Used for interface buttons.

(String xmlStr, int wide, int high)

Source from the content-addressed store, hash-verified

818 * the specified width and height. Used for interface buttons.
819 */
820 static private Image svgToImage(String xmlStr, int wide, int high) {
821 PGraphicsJava2D pg = new PGraphicsJava2D();
822 pg.setPrimary(false);
823 pg.setSize(wide, high);
824 pg.smooth();
825
826 pg.beginDraw();
827
828 try {
829 XML xml = XML.parse(xmlStr);
830 PShape shape = new PShapeJava2D(xml);
831 pg.shape(shape, 0, 0, wide, high);
832
833 } catch (Exception e) {
834 e.printStackTrace();
835 }
836
837 pg.endDraw();
838 return pg.image;
839 }
840
841
842 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Callers 1

svgToImageMultMethod · 0.95

Calls 8

setSizeMethod · 0.95
beginDrawMethod · 0.95
parseMethod · 0.95
endDrawMethod · 0.95
setPrimaryMethod · 0.45
smoothMethod · 0.45
shapeMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected