| } | ||
| -processResources { | ||
| - expand project.properties | ||
| -} | ||
| - | ||
| final resourceDir = sourceSets.main.resources.srcDirs[0] | ||
| final Properties config = new Properties() |
| } | ||
| - public static String toString( final String equation ) { | ||
| + private static String toString( final String equation ) { | ||
| return sTypesetter.toSvg( "$" + equation + "$" ); | ||
| } |
| /** | ||
| + * Rasterizes the given SVG input stream into an image. | ||
| + * | ||
| + * @param svg The SVG data to rasterize, must be closed by caller. | ||
| + * @return The given input stream converted to a rasterized image. | ||
| + */ | ||
| + public static BufferedImage rasterize( final String svg ) | ||
| + throws TranscoderException, ParseException { | ||
| + return rasterize( toDocument( svg ) ); | ||
| + } | ||
| + | ||
| + /** | ||
| * Rasterizes the given SVG input stream into an image at 96 DPI. | ||
| * | ||
| * a graphics context. The dimensions are determined from the document. | ||
| * | ||
| - * @param svg The SVG xml document. | ||
| + * @param svg The SVG xml document. | ||
| + * @param scale The scaling factor to apply when transcoding. | ||
| * @return The vector graphic transcoded into a raster image format. | ||
| */ | ||
| case HTML_TEX -> | ||
| // Convert the TeX element to a raster graphic. | ||
| - raster = rasterizeImage( MathRenderer.toString( e.getTextContent() ), 2.5 ); | ||
| + raster = rasterize( MathRenderer.toString( e.getTextContent() ) ); | ||
| } | ||
| Author | DaveJarvis <email> |
|---|---|
| Date | 2023-01-22 21:16:46 GMT-0800 |
| Commit | 1226250cf2a126b4f43fc4bfb7b9f551cb19ee30 |
| Parent | f1c8425 |
| Delta | 15 lines added, 7 lines removed, 8-line increase |