Packagecom.yworks.canvas.drawing
Interfacepublic interface IAdvancedStroke extends mx.graphics.IStroke
Implementors AdvancedStroke

A advanced IStroke that allows for custom stroke rendering.

If applyStroke is called on a YGraphics instance and an IAdvancedStroke is passed, the corresponding draw methods of the stroke will be called by YGraphics when the YGraphics drawing methods are called. In addition to the YGraphics instance, a Graphics instance is passed that should be used by the stroke implementations to perform the actual drawing.



Public Methods
 MethodDefined By
  
drawCurve(currentX:Number, currentY:Number, toX:Number, toY:Number, cx:Number, cy:Number, graphics:YGraphics, targetGraphics:Graphics):void
Draw a quadratic bezier curve from (x0,y0) to (x1,y1) using the control point at (cx,cy).
IAdvancedStroke
  
drawLine(x0:Number, y0:Number, x1:Number, y1:Number, graphics:YGraphics, targetGraphics:Graphics):void
Draw a straight line from the current graphics location to (toX,toY)
IAdvancedStroke
  
drawPath(path:GeneralPath, graphics:YGraphics, targetGraphics:Graphics):void
Draw a path.
IAdvancedStroke
  
reset(graphics:YGraphics, targetGraphics:Graphics):void
Reset the stroke state.
IAdvancedStroke
Method Detail
drawCurve()method
public function drawCurve(currentX:Number, currentY:Number, toX:Number, toY:Number, cx:Number, cy:Number, graphics:YGraphics, targetGraphics:Graphics):void

Draw a quadratic bezier curve from (x0,y0) to (x1,y1) using the control point at (cx,cy).

Note that no moveTo operation should be called on the targetGraphics that moves to (currentX,currentY). The targetGraphics current location will already be set to (x0,y0).

Parameters

currentX:Number — The x-coordinate of the current graphics location (the first anchor point of the curve)
 
currentY:Number — The y-coordinate of the current graphics location (the first anchor point of the curve)
 
toX:Number — The x-coordinate of the curve's second anchor point
 
toY:Number — The y-coordinate of the curve's second anchor point
 
cx:Number — The x-coordinate of the curve's the control point
 
cy:Number — The y-coordinate of the curve's control point
 
graphics:YGraphics — The YGraphics instance that wants to draw the curve
 
targetGraphics:Graphics — The graphics instance that should be used for actual drawing. The current location of the graphics instance is already set to currentX,currentY

drawLine()method 
public function drawLine(x0:Number, y0:Number, x1:Number, y1:Number, graphics:YGraphics, targetGraphics:Graphics):void

Draw a straight line from the current graphics location to (toX,toY)

Parameters

x0:Number — The x-coordinate of the current graphics location
 
y0:Number — The y-coordinate of the current graphics location
 
x1:Number — The x-coordinate of the line's end point
 
y1:Number — The y-coordinate of the line's end point
 
graphics:YGraphics — The YGraphics instance that wants to draw the line
 
targetGraphics:Graphics — The graphics instance that should be used for actual drawing. The current location of the graphics instance is already set to currentX,currentY

drawPath()method 
public function drawPath(path:GeneralPath, graphics:YGraphics, targetGraphics:Graphics):void

Draw a path.

Parameters

path:GeneralPath — The path to be drawn
 
graphics:YGraphics — The YGraphics instance that wants to draw the path
 
targetGraphics:Graphics — The graphics instance that should be used for actual drawing

reset()method 
public function reset(graphics:YGraphics, targetGraphics:Graphics):void

Reset the stroke state.

This is called by YGraphics when a moveTo or endFill is requested.

Parameters

graphics:YGraphics — The YGraphics instance that wants to reset the stroke state.
 
targetGraphics:Graphics — The graphics instance that should be used for actual drawing