Mageia Bugzilla – Attachment 14460 Details for
Bug 30882
batik new security issues CVE-2022-38398, CVE-2022-38648, CVE-2022-40146, CVE-2022-41704, CVE-2022-42890
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
SVG generator java script
generator.java (text/plain), 1.31 KB, created by
Len Lawrence
on 2024-03-15 15:20:56 CET
(
hide
)
Description:
SVG generator java script
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2024-03-15 15:20:56 CET
Size:
1.31 KB
patch
obsolete
>import java.awt.Rectangle; >import java.awt.Graphics2D; >import java.awt.Color; >import java.io.Writer; >import java.io.OutputStreamWriter; >import java.io.IOException; > >import org.apache.batik.svggen.SVGGraphics2D; >import org.apache.batik.dom.GenericDOMImplementation; > >import org.w3c.dom.Document; >import org.w3c.dom.DOMImplementation; > >public class TestSVGGen { > > public void paint(Graphics2D g2d) { > g2d.setPaint(Color.red); > g2d.fill(new Rectangle(10, 10, 100, 100)); > } > > public static void main(String[] args) throws IOException { > > // Get a DOMImplementation. > DOMImplementation domImpl = > GenericDOMImplementation.getDOMImplementation(); > > // Create an instance of org.w3c.dom.Document. > String svgNS = "http://www.w3.org/2000/svg"; > Document document = domImpl.createDocument(svgNS, "svg", null); > > // Create an instance of the SVG Generator. > SVGGraphics2D svgGenerator = new SVGGraphics2D(document); > > // Ask the test to render into the SVG Graphics2D implementation. > TestSVGGen test = new TestSVGGen(); > test.paint(svgGenerator); > > // Finally, stream out SVG to the standard output using > // UTF-8 encoding. > boolean useCSS = true; // we want to use CSS style attributes > Writer out = new OutputStreamWriter(System.out, "UTF-8"); > svgGenerator.stream(out, useCSS); > } >}
import java.awt.Rectangle; import java.awt.Graphics2D; import java.awt.Color; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.IOException; import org.apache.batik.svggen.SVGGraphics2D; import org.apache.batik.dom.GenericDOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DOMImplementation; public class TestSVGGen { public void paint(Graphics2D g2d) { g2d.setPaint(Color.red); g2d.fill(new Rectangle(10, 10, 100, 100)); } public static void main(String[] args) throws IOException { // Get a DOMImplementation. DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document. String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, "svg", null); // Create an instance of the SVG Generator. SVGGraphics2D svgGenerator = new SVGGraphics2D(document); // Ask the test to render into the SVG Graphics2D implementation. TestSVGGen test = new TestSVGGen(); test.paint(svgGenerator); // Finally, stream out SVG to the standard output using // UTF-8 encoding. boolean useCSS = true; // we want to use CSS style attributes Writer out = new OutputStreamWriter(System.out, "UTF-8"); svgGenerator.stream(out, useCSS); } }
View Attachment As Raw
Actions:
View
Attachments on
bug 30882
: 14460