Package org.apache.poi.sl.draw
Class DrawFactory
- java.lang.Object
-
- org.apache.poi.sl.draw.DrawFactory
-
public class DrawFactory extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DrawFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawShape(java.awt.Graphics2D graphics, Shape<?,?> shape, java.awt.geom.Rectangle2D bounds)Convenience method for drawing single shapes.voidfixFonts(java.awt.Graphics2D graphics)Replace font families for Windows JVM 6, which contains a font rendering error.DrawBackgroundgetDrawable(Background<?,?> shape)DrawConnectorShapegetDrawable(ConnectorShape<?,?> shape)DrawFreeformShapegetDrawable(FreeformShape<?,?> shape)DrawGraphicalFramegetDrawable(GraphicalFrame<?,?> shape)DrawGroupShapegetDrawable(GroupShape<?,?> shape)DrawMasterSheetgetDrawable(MasterSheet<?,?> sheet)DrawPictureShapegetDrawable(PictureShape<?,?> shape)DrawablegetDrawable(Shape<?,?> shape)DrawSheetgetDrawable(Sheet<?,?> sheet)DrawSlidegetDrawable(Slide<?,?> sheet)DrawTableShapegetDrawable(TableShape<?,?> shape)DrawTextBoxgetDrawable(TextBox<?,?> shape)DrawTextParagraphgetDrawable(TextParagraph<?,?,?> paragraph)DrawTextShapegetDrawable(TextShape<?,?> shape)DrawFontManagergetFontManager(java.awt.Graphics2D graphics)Return a FontManager, either registered beforehand or a default implementationstatic DrawFactorygetInstance(java.awt.Graphics2D graphics)Returns the DrawFactory, preferably via a graphics instance.DrawPaintgetPaint(PlaceableShape<?,?> shape)DrawTextFragmentgetTextFragment(java.awt.font.TextLayout layout, java.text.AttributedString str)static voidsetDefaultFactory(DrawFactory factory)Set a custom draw factory for the current thread.
-
-
-
Method Detail
-
setDefaultFactory
public static void setDefaultFactory(DrawFactory factory)
Set a custom draw factory for the current thread. This is a fallback, for operations where usercode can't set a graphics context. Preferably use the rendering hintDrawable.DRAW_FACTORYto set the factory.- Parameters:
factory-
-
getInstance
public static DrawFactory getInstance(java.awt.Graphics2D graphics)
Returns the DrawFactory, preferably via a graphics instance. If graphics is null, the current thread local is checked or if it is not set, a new factory is created.- Parameters:
graphics- the current graphics context or null- Returns:
- the draw factory
-
getDrawable
public DrawMasterSheet getDrawable(MasterSheet<?,?> sheet)
-
getDrawable
public DrawTextBox getDrawable(TextBox<?,?> shape)
-
getDrawable
public DrawFreeformShape getDrawable(FreeformShape<?,?> shape)
-
getDrawable
public DrawConnectorShape getDrawable(ConnectorShape<?,?> shape)
-
getDrawable
public DrawTableShape getDrawable(TableShape<?,?> shape)
-
getDrawable
public DrawTextShape getDrawable(TextShape<?,?> shape)
-
getDrawable
public DrawGroupShape getDrawable(GroupShape<?,?> shape)
-
getDrawable
public DrawPictureShape getDrawable(PictureShape<?,?> shape)
-
getDrawable
public DrawGraphicalFrame getDrawable(GraphicalFrame<?,?> shape)
-
getDrawable
public DrawTextParagraph getDrawable(TextParagraph<?,?,?> paragraph)
-
getDrawable
public DrawBackground getDrawable(Background<?,?> shape)
-
getTextFragment
public DrawTextFragment getTextFragment(java.awt.font.TextLayout layout, java.text.AttributedString str)
-
getPaint
public DrawPaint getPaint(PlaceableShape<?,?> shape)
-
drawShape
public void drawShape(java.awt.Graphics2D graphics, Shape<?,?> shape, java.awt.geom.Rectangle2D bounds)Convenience method for drawing single shapes. For drawing whole slides, useSheet.draw(Graphics2D)- Parameters:
graphics- the graphics context to draw toshape- the shapebounds- the bounds within the graphics context to draw to
-
fixFonts
public void fixFonts(java.awt.Graphics2D graphics)
Replace font families for Windows JVM 6, which contains a font rendering error. This is likely to be removed, when POI upgrades to JDK 7- Parameters:
graphics- the graphics context which will contain the font mapping
-
getFontManager
public DrawFontManager getFontManager(java.awt.Graphics2D graphics)
Return a FontManager, either registered beforehand or a default implementation- Parameters:
graphics- the graphics context holding potentially a font manager- Returns:
- the font manager
-
-