Package com.storedobject.vaadin
Class PaintedImageResource
java.lang.Object
com.vaadin.flow.server.AbstractStreamResource
com.vaadin.flow.server.StreamResource
com.storedobject.vaadin.PaintedImageResource
- All Implemented Interfaces:
Serializable
public class PaintedImageResource
extends com.vaadin.flow.server.StreamResource
Create an image resource from an AWT image painted on a
Graphics2D.- Author:
- Syam
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a 100x100 pixels SVG image resource.PaintedImageResource(int widthInPixels, int heightInPixels) Create an image resource.Create a 100x100 pixels image resource.PaintedImageResource(PaintedImage.Type imageType, int widthInPixels, int heightInPixels) Create an image resource.PaintedImageResource(PaintedImage.Type type, Consumer<Graphics2D> painter) Create a 100x100 pixels image resource.PaintedImageResource(PaintedImage.Type imageType, Consumer<Graphics2D> painter, int widthInPixels, int heightInPixels) Create an image resource.PaintedImageResource(Consumer<Graphics2D> painter) Create a 100x100 pixels SVG image resource.PaintedImageResource(Consumer<Graphics2D> painter, int widthInPixels, int heightInPixels) Create an image resource. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCreate a base file name for the image.voidpaint(Graphics2D graphics) Paint the image to theGraphics2D. if there is a painter already set, that will be invoked to do the painting.Methods inherited from class com.vaadin.flow.server.StreamResource
getContentTypeResolver, getHeader, getHeaders, getName, getWriter, setContentType, setContentTypeResolver, setHeaderMethods inherited from class com.vaadin.flow.server.AbstractStreamResource
getCacheTime, getId, setCacheTime
-
Constructor Details
-
PaintedImageResource
public PaintedImageResource()Create a 100x100 pixels SVG image resource. -
PaintedImageResource
Create a 100x100 pixels image resource.- Parameters:
type- Type of image to create.
-
PaintedImageResource
public PaintedImageResource(int widthInPixels, int heightInPixels) Create an image resource.- Parameters:
widthInPixels- Image width in pixelsheightInPixels- Image height in pixels
-
PaintedImageResource
Create an image resource.- Parameters:
imageType- Type of the image to createwidthInPixels- Image width in pixelsheightInPixels- Image height in pixels
-
PaintedImageResource
Create a 100x100 pixels SVG image resource.- Parameters:
painter- Image painter
-
PaintedImageResource
Create a 100x100 pixels image resource.- Parameters:
type- Type of image to create.painter- Image painter
-
PaintedImageResource
Create an image resource.- Parameters:
painter- Image painterwidthInPixels- Image width in pixelsheightInPixels- Image height in pixels
-
PaintedImageResource
public PaintedImageResource(PaintedImage.Type imageType, Consumer<Graphics2D> painter, int widthInPixels, int heightInPixels) Create an image resource.- Parameters:
imageType- Type of the image to createpainter- Image painterwidthInPixels- Image width in pixelsheightInPixels- Image height in pixels
-
-
Method Details
-
paint
Paint the image to theGraphics2D. if there is a painter already set, that will be invoked to do the painting.- Parameters:
graphics-Graphics2Don which image needs to be drawn
-
createBaseFileName
Create a base file name for the image.- Returns:
- Base file name (without extension).
-