com.stimulsoft.base.drawing
Class StiGraphics

java.lang.Object
  extended by com.stimulsoft.base.drawing.StiGraphics

public class StiGraphics
extends java.lang.Object

Graphics adapter class that translate sti commands to graphics representation. Copyright Stimulsoft


Nested Class Summary
 class StiGraphics.Cubic
          This class represents a cubic polynomial
 
Field Summary
static java.lang.Float HTML_SCALE
          HTML JTextPane scale
 
Constructor Summary
StiGraphics(java.awt.Graphics g)
          Constructor
 
Method Summary
 java.awt.Stroke beginFill(StiBrush brush, StiPen pen, StiRectangle rect, java.lang.Double zoom)
          Set fill format
 void clearOffset()
          Clear coordinates offset
 void clearRotate()
          Pop rotation from stack
 StiRectangle drawAttributedString(java.lang.String allText, java.awt.Font awtFont, StiRectangle rect, java.lang.Boolean underline, java.lang.Boolean wordWrap, StiTextHorAlignment horAlignment, java.lang.Boolean draw, java.util.List<StiLineInfo> lines, java.lang.Boolean useRightToLeft)
          Draw attribute string
 void drawCurve(StiPoint[] points, StiPen pen, java.lang.Double zoom, java.lang.Boolean transformRect)
          Draw curve
 void drawEllise(StiRectangle rect, StiPen pen, StiBrush brush, java.lang.Double zoom, java.lang.Double pageZoom)
          Draw ellipse
 void drawElliseBegin(StiRectangle rect, StiPen pen, StiBrush brush, java.lang.Double zoom)
          Begin draw ellipse
 void drawElliseEnd(StiRectangle rect)
          End draw ellipse
 void drawHTMLText(java.lang.String text, StiRectangle rect, StiFont font, StiColor color, StiTextHorAlignment horAlignment, StiVertAlignment vertAlignment, java.lang.Boolean wordWrap, StiPenStyle linesOfUnderline, StiBorder border, StiTextOptions textOptions, double lineSpacing, java.lang.Double zoom)
          Draw HTML text
 void drawImage(java.awt.image.BufferedImage image, StiRectangle rect, java.lang.Boolean stretch, java.lang.Boolean smooth, java.lang.Boolean scaleBitmap, java.lang.Double zoom)
          Draw BufferedImage with alpha value 1
 void drawImage(java.awt.image.BufferedImage image, StiRectangle rect, java.lang.Boolean stretch, java.lang.Boolean smooth, java.lang.Boolean scaleBitmap, float alpha, java.lang.Double zoom)
          Draw BufferedImage
 void drawImage(java.awt.image.BufferedImage image, StiRectangle rect, java.lang.Boolean stretch, java.lang.Boolean smooth, double zoom)
          Draw BufferedImage with scaling alpha value 1
 void drawLine(StiPoint start, StiPoint end, StiPen pen, java.lang.Double zoom)
          Draw line by start & end StiPoint with transofmation coordinates with stored offsets
 void drawLine(StiPoint start, StiPoint end, StiPen pen, java.lang.Double zoom, java.lang.Boolean transformRect)
          Draw line by start & end StiPoint
 void drawLineXY(java.lang.Double x1, java.lang.Double y1, java.lang.Double x2, java.lang.Double y2, StiPen pen, java.lang.Double zoom)
          Draw line by coordinates
 void drawLineXY(java.lang.Double x1, java.lang.Double y1, java.lang.Double x2, java.lang.Double y2, StiPen pen, java.lang.Double zoom, java.lang.Boolean transformRect)
          Draw line by coordinates
 StiRectangle drawPath(java.util.List<StiPathCommand> path, StiPen pen, StiBrush brush, java.lang.Boolean transformCoord, double zoom, double pageZoom)
          Draw path sotred in List StiPathCommand
 StiRectangle drawPath(java.util.List<StiPathCommand> path, StiPen pen, StiBrush brush, java.lang.Boolean transformCoord, double zoom, double pageZoom, boolean draw)
          Draw path sotred in List StiPathCommand
 void drawPath(java.util.List<StiPathCommand> path, StiPen pen, StiBrush brush, double zoom, double pageZoom)
          Draw path sotred in List StiPathCommand
 void drawRectangle(StiRectangle rect, StiPen pen, StiBrush brush, java.lang.Double zoom, java.lang.Double pageZoom)
          Draw rectangle
 void drawRectangle(StiRectangle rect, StiPen pen, StiBrush brush, java.lang.Double cornerRadius, java.lang.Double zoom, java.lang.Double pageZoom)
          Draw rounded rectangle
 void drawRTFText(java.lang.String text, StiRectangle rect, java.lang.Double zoom)
          Draw RFT text
 void drawText(java.lang.String text, StiRectangle rect, StiFont font, StiBrush brush, StiTextHorAlignment horAlignment, StiVertAlignment vertAlignment, java.lang.Boolean wordWrap, java.lang.Double zoom, StiPenStyle linesOfUnderline, StiBorder border, StiTextOptions textOptions)
          Draw text
static StiGraphics fromImage(java.awt.image.BufferedImage image)
           
 java.awt.Graphics2D getG()
           
 java.lang.Boolean getIntegerCoords()
          Round coorditates before painting
 java.lang.Double getOffsetX()
          Return X offset
 java.lang.Double getOffsetY()
          Return Y offset
 java.awt.Rectangle restoreClip()
          Restore clip from clip stack
 void setClip(StiRectangle rect)
          Set clip & fit it in old(stored in stack) clip
 void setFixedClip(StiRectangle rect)
          Set clip without fiting to old(stored in stack) clip
 void setG(java.awt.Graphics2D g)
           
 void setIntegerCoords(java.lang.Boolean value)
          Round coordinates
 java.awt.Stroke setLineStyle(StiPen pen, StiRectangle rect, double zoom)
          Set line style
 void setOffset(double x, double y)
          Set coordinates offset
 void setRotate(double angle, double centerX, double centerY)
          Set rotation params & store it in stack
 void setTransformedClip(StiRectangle rect)
          Set clip (push it to stack) with trasnform it with offsets & fit clip in older(stored) clip
 StiPoint transformCoords(java.lang.Double x, java.lang.Double y, java.lang.Double ox, java.lang.Double oy)
          Tramsform coordinates
 StiPoint transformPoint(StiPoint point, java.lang.Double ox, java.lang.Double oy)
          Transform StiPoint with offsets
 StiPoint transformPointRound(StiPoint point, java.lang.Double ox, java.lang.Double oy)
          Transform StiPoint with offsets & round coordinates with stored digits after point
 StiRectangle transformRect(StiRectangle rect)
          Transform StiRectangle
 StiRectangle transformRect(StiRectangle rect, java.lang.Double ox, java.lang.Double oy)
          Transform StiRectangle with offsets
 StiRectangle transformRectRound(StiRectangle rect)
          Transform StiRectangle with stored offsets & round with stored digits after point
 StiRectangle transformRectRound(StiRectangle rect, java.lang.Double ox, java.lang.Double oy, java.lang.Integer digits)
          Transform StiRectangle & round it with digits after point
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_SCALE

public static final java.lang.Float HTML_SCALE
HTML JTextPane scale

Constructor Detail

StiGraphics

public StiGraphics(java.awt.Graphics g)
Constructor

Parameters:
g -
Method Detail

fromImage

public static StiGraphics fromImage(java.awt.image.BufferedImage image)

getIntegerCoords

public java.lang.Boolean getIntegerCoords()
Round coorditates before painting

Returns:

setIntegerCoords

public void setIntegerCoords(java.lang.Boolean value)
Round coordinates

Parameters:
value -

setOffset

public void setOffset(double x,
                      double y)
Set coordinates offset

Parameters:
x -
y -

clearOffset

public void clearOffset()
Clear coordinates offset


setTransformedClip

public void setTransformedClip(StiRectangle rect)
Set clip (push it to stack) with trasnform it with offsets & fit clip in older(stored) clip

Parameters:
rect -

restoreClip

public java.awt.Rectangle restoreClip()
Restore clip from clip stack

Returns:
rstored clip

setFixedClip

public void setFixedClip(StiRectangle rect)
Set clip without fiting to old(stored in stack) clip

Parameters:
rect -

setClip

public void setClip(StiRectangle rect)
Set clip & fit it in old(stored in stack) clip

Parameters:
rect -

setRotate

public void setRotate(double angle,
                      double centerX,
                      double centerY)
Set rotation params & store it in stack

Parameters:
angle -
centerX - x coordinate to rotate
centerY - y coordinate to rotate

clearRotate

public void clearRotate()
Pop rotation from stack


transformCoords

public StiPoint transformCoords(java.lang.Double x,
                                java.lang.Double y,
                                java.lang.Double ox,
                                java.lang.Double oy)
Tramsform coordinates

Parameters:
x -
y -
ox -
oy -
Returns:

transformPointRound

public StiPoint transformPointRound(StiPoint point,
                                    java.lang.Double ox,
                                    java.lang.Double oy)
Transform StiPoint with offsets & round coordinates with stored digits after point

Parameters:
point - StiPoint
ox - X offset
oy - Y offset
Returns:

transformPoint

public StiPoint transformPoint(StiPoint point,
                               java.lang.Double ox,
                               java.lang.Double oy)
Transform StiPoint with offsets

Parameters:
point - StiPoint
ox -
oy -
Returns:

transformRectRound

public StiRectangle transformRectRound(StiRectangle rect,
                                       java.lang.Double ox,
                                       java.lang.Double oy,
                                       java.lang.Integer digits)
Transform StiRectangle & round it with digits after point

Parameters:
rect - StiRectangle
ox - X offset
oy - Y offset
digits - Round to digits after point
Returns:

transformRectRound

public StiRectangle transformRectRound(StiRectangle rect)
Transform StiRectangle with stored offsets & round with stored digits after point

Parameters:
rect - StiRectangle
Returns:

transformRect

public StiRectangle transformRect(StiRectangle rect)
Transform StiRectangle

Parameters:
rect - StiRectangle
Returns:

transformRect

public StiRectangle transformRect(StiRectangle rect,
                                  java.lang.Double ox,
                                  java.lang.Double oy)
Transform StiRectangle with offsets

Parameters:
rect - StiRectangle
ox - X offset
oy - Y offset
Returns:

setLineStyle

public java.awt.Stroke setLineStyle(StiPen pen,
                                    StiRectangle rect,
                                    double zoom)
Set line style

Parameters:
pen - StiPoint
rect - StiRectangle
zoom -
Returns:

beginFill

public java.awt.Stroke beginFill(StiBrush brush,
                                 StiPen pen,
                                 StiRectangle rect,
                                 java.lang.Double zoom)
Set fill format

Parameters:
brush - StiBrush
pen - StiPen
rect - StiRectangle to paint in
zoom -
Returns:

drawPath

public void drawPath(java.util.List<StiPathCommand> path,
                     StiPen pen,
                     StiBrush brush,
                     double zoom,
                     double pageZoom)
Draw path sotred in List StiPathCommand

Parameters:
path - List StiPathCommand
pen - StiPen
brush - StiBrush
zoom -
pageZoom -

drawPath

public StiRectangle drawPath(java.util.List<StiPathCommand> path,
                             StiPen pen,
                             StiBrush brush,
                             java.lang.Boolean transformCoord,
                             double zoom,
                             double pageZoom)
Draw path sotred in List StiPathCommand

Parameters:
path - List StiPathCommand
pen - StiPen
brush - StiBrush
transformCoord - is need to transform coordinates with stored offsets
zoom -
pageZoom -
draw -
Returns:
Bounds rect

drawPath

public StiRectangle drawPath(java.util.List<StiPathCommand> path,
                             StiPen pen,
                             StiBrush brush,
                             java.lang.Boolean transformCoord,
                             double zoom,
                             double pageZoom,
                             boolean draw)
Draw path sotred in List StiPathCommand

Parameters:
path - List StiPathCommand
pen - StiPen
brush - StiBrush
transformCoord - is need to transform coordinates with stored offsets
zoom -
pageZoom -
draw -
Returns:
Bounds rect

drawRectangle

public void drawRectangle(StiRectangle rect,
                          StiPen pen,
                          StiBrush brush,
                          java.lang.Double zoom,
                          java.lang.Double pageZoom)
Draw rectangle

Parameters:
rect - StiRectangle
pen - StiPen
brush - StiBrush
zoom -
pageZoom -

drawRectangle

public void drawRectangle(StiRectangle rect,
                          StiPen pen,
                          StiBrush brush,
                          java.lang.Double cornerRadius,
                          java.lang.Double zoom,
                          java.lang.Double pageZoom)
Draw rounded rectangle

Parameters:
rect - StiRectangle
pen - StiPen
brush - StiBrush
cornerRadius -
zoom -
pageZoom -

drawEllise

public void drawEllise(StiRectangle rect,
                       StiPen pen,
                       StiBrush brush,
                       java.lang.Double zoom,
                       java.lang.Double pageZoom)
Draw ellipse

Parameters:
rect - StiRectangle
pen - StiPen
brush - StiBrush
zoom -
pageZoom -

drawElliseBegin

public void drawElliseBegin(StiRectangle rect,
                            StiPen pen,
                            StiBrush brush,
                            java.lang.Double zoom)
Begin draw ellipse

Parameters:
rect - StiRectangle
pen - StiPen
brush - StiBrush
zoom -

drawElliseEnd

public void drawElliseEnd(StiRectangle rect)
End draw ellipse

Parameters:
rect - StiRectangle

drawLineXY

public void drawLineXY(java.lang.Double x1,
                       java.lang.Double y1,
                       java.lang.Double x2,
                       java.lang.Double y2,
                       StiPen pen,
                       java.lang.Double zoom,
                       java.lang.Boolean transformRect)
Draw line by coordinates

Parameters:
x1 -
y1 -
x2 -
y2 -
pen - StiPen
zoom -
transformRect - is need to transform coordinates with stored offsets

drawLineXY

public void drawLineXY(java.lang.Double x1,
                       java.lang.Double y1,
                       java.lang.Double x2,
                       java.lang.Double y2,
                       StiPen pen,
                       java.lang.Double zoom)
Draw line by coordinates

Parameters:
x1 -
y1 -
x2 -
y2 -
pen - StiPen
zoom -

drawLine

public void drawLine(StiPoint start,
                     StiPoint end,
                     StiPen pen,
                     java.lang.Double zoom)
Draw line by start & end StiPoint with transofmation coordinates with stored offsets

Parameters:
start - StiPoint
end - StiPoint
pen - StiPen
zoom -

drawLine

public void drawLine(StiPoint start,
                     StiPoint end,
                     StiPen pen,
                     java.lang.Double zoom,
                     java.lang.Boolean transformRect)
Draw line by start & end StiPoint

Parameters:
start - StiPoint
end - StiPoint
pen - StiPen
zoom -
transformRect - is need to transform coordinates with sored offsets

drawCurve

public void drawCurve(StiPoint[] points,
                      StiPen pen,
                      java.lang.Double zoom,
                      java.lang.Boolean transformRect)
Draw curve

Parameters:
polygon -
pen -
zoom -
transformRect -

drawImage

public void drawImage(java.awt.image.BufferedImage image,
                      StiRectangle rect,
                      java.lang.Boolean stretch,
                      java.lang.Boolean smooth,
                      double zoom)
Draw BufferedImage with scaling alpha value 1

Parameters:
image - BufferedImage
rect - StiRectangle
stretch - is need to stretch image
smooth - is need to smooth image
zoom -

drawImage

public void drawImage(java.awt.image.BufferedImage image,
                      StiRectangle rect,
                      java.lang.Boolean stretch,
                      java.lang.Boolean smooth,
                      java.lang.Boolean scaleBitmap,
                      java.lang.Double zoom)
Draw BufferedImage with alpha value 1

Parameters:
image - BufferedImage
rect - StiRectangle
stretch - is need to stretch image
smooth - is need to smooth image
scaleBitmap - is need to scale image
zoom -

drawImage

public void drawImage(java.awt.image.BufferedImage image,
                      StiRectangle rect,
                      java.lang.Boolean stretch,
                      java.lang.Boolean smooth,
                      java.lang.Boolean scaleBitmap,
                      float alpha,
                      java.lang.Double zoom)
Draw BufferedImage

Parameters:
image - BufferedImage
rect - StiRectangle
stretch - is need to stretch image
smooth - is need to smooth image
scaleBitmap - is need to scale image
alpha - alphe value
zoom -

drawRTFText

public void drawRTFText(java.lang.String text,
                        StiRectangle rect,
                        java.lang.Double zoom)
Draw RFT text

Parameters:
text -
rect - StiRectangle with RTF text
zoom -

drawHTMLText

public void drawHTMLText(java.lang.String text,
                         StiRectangle rect,
                         StiFont font,
                         StiColor color,
                         StiTextHorAlignment horAlignment,
                         StiVertAlignment vertAlignment,
                         java.lang.Boolean wordWrap,
                         StiPenStyle linesOfUnderline,
                         StiBorder border,
                         StiTextOptions textOptions,
                         double lineSpacing,
                         java.lang.Double zoom)
Draw HTML text

Parameters:
text -
rect - StiRectangle
font - StiFont
color - StiColor
horAlignment - StiTextHorAlignment
vertAlignment - StiVertAlignment
wordWrap - is need wo wrap words
linesOfUnderline - is need do draw lines of underline
border - StiBorder
textOptions - StiTextOptions
zoom -

drawText

public void drawText(java.lang.String text,
                     StiRectangle rect,
                     StiFont font,
                     StiBrush brush,
                     StiTextHorAlignment horAlignment,
                     StiVertAlignment vertAlignment,
                     java.lang.Boolean wordWrap,
                     java.lang.Double zoom,
                     StiPenStyle linesOfUnderline,
                     StiBorder border,
                     StiTextOptions textOptions)
Draw text

Parameters:
text -
rect - StiRectangle text rectangle
font - StiFont
brush - StiBrush
horAlignment - StiTextHorAlignment
vertAlignment - StiVertAlignment
wordWrap - is need to wrap words
zoom -
linesOfUnderline - is need to draw liens of underline
border - StiBorder
textOptions - StiTextOptions

drawAttributedString

public StiRectangle drawAttributedString(java.lang.String allText,
                                         java.awt.Font awtFont,
                                         StiRectangle rect,
                                         java.lang.Boolean underline,
                                         java.lang.Boolean wordWrap,
                                         StiTextHorAlignment horAlignment,
                                         java.lang.Boolean draw,
                                         java.util.List<StiLineInfo> lines,
                                         java.lang.Boolean useRightToLeft)
Draw attribute string

Parameters:
allText -
awtFont - Font
rect - StiRectangle
underline - in underline forn
wordWrap - is need to wrap words
horAlignment - StiTextHorAlignment
draw - is need to draw or only calculate text rect
lines - - returns string fit lines
useRightToLeft - - Right to left text
Returns:
rect that fill text

getG

public java.awt.Graphics2D getG()
Returns:
Graphics2D

getOffsetX

public java.lang.Double getOffsetX()
Return X offset

Returns:

getOffsetY

public java.lang.Double getOffsetY()
Return Y offset

Returns:

setG

public void setG(java.awt.Graphics2D g)
Parameters:
g - the g to set