Package org.xwiki.platform.svg
Interface SVGRasterizer
-
@Role public interface SVGRasterizer
Utilities for working with SVG images.- Since:
- 8.0M1
- Version:
- $Id: 09d61ebcaa15cc3370c85fa4cfe2e4fd9110fbf4 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
rasterizeToResponse(String content, int width, int height)
Rasterize an image as PNG into the current response.File
rasterizeToTemporaryFile(String content, int width, int height)
Rasterize an image as PNG into a temporary file.TemporaryResourceReference
rasterizeToTemporaryResource(String content, int width, int height)
Rasterize an image as PNG into a temporary resource belonging to the current document, accessible through the "tmp" resource URL handler.TemporaryResourceReference
rasterizeToTemporaryResource(String content, int width, int height, DocumentReference targetContext)
Rasterize an image as PNG into a temporary resource belonging to the specified document, accessible through the "tmp" resource URL handler.
-
-
-
Method Detail
-
rasterizeToTemporaryFile
File rasterizeToTemporaryFile(String content, int width, int height) throws IOException
Rasterize an image as PNG into a temporary file.- Parameters:
content
- the SVG imagewidth
- the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is usedheight
- the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used- Returns:
- the file where the PNG is stored
- Throws:
IOException
- if temporary files can't be accessed
-
rasterizeToTemporaryResource
TemporaryResourceReference rasterizeToTemporaryResource(String content, int width, int height) throws IOException
Rasterize an image as PNG into a temporary resource belonging to the current document, accessible through the "tmp" resource URL handler.- Parameters:
content
- the SVG imagewidth
- the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is usedheight
- the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used- Returns:
- the temporary resource where the PNG is stored
- Throws:
IOException
- if temporary files can't be accessed
-
rasterizeToTemporaryResource
TemporaryResourceReference rasterizeToTemporaryResource(String content, int width, int height, DocumentReference targetContext) throws IOException
Rasterize an image as PNG into a temporary resource belonging to the specified document, accessible through the "tmp" resource URL handler.- Parameters:
content
- the SVG imagewidth
- the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is usedheight
- the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is usedtargetContext
- the document which will "own" the new temporary resource- Returns:
- the temporary resource where the PNG is stored
- Throws:
IOException
- if temporary files can't be accessed
-
rasterizeToResponse
void rasterizeToResponse(String content, int width, int height) throws IOException
Rasterize an image as PNG into the current response.- Parameters:
content
- the SVG imagewidth
- the desired width of the raster image, in pixels; if 0 or a negative number, the image's native size is usedheight
- the desired height of the raster image, in pixels; if 0 or a negative number, the image's native size is used- Throws:
IOException
- if writing the response fails
-
-