public Matrix (RectangleF rect , PointF[] plgpts) { double x1 = plgpts[1].X - plgpts[0].X; double y1 = plgpts[1].Y - plgpts[0].Y; double x2 = plgpts[2].X - plgpts[0].X; double y2 = plgpts[2].Y - plgpts[0].Y; _nativeMatrix = new geom.AffineTransform(x1/rect.Width, y1/rect.Width, x2/rect.Height, y2/rect.Height, plgpts[0].X, plgpts[0].Y); _nativeMatrix.translate(-rect.X,-rect.Y); }
internal static void Multiply(geom.AffineTransform to, geom.AffineTransform add, MatrixOrder order) { if (order == MatrixOrder.Prepend) { to.concatenate(add); } else { to.preConcatenate(add); } }
public Matrix(RectangleF rect, PointF[] plgpts) { double x1 = plgpts[1].X - plgpts[0].X; double y1 = plgpts[1].Y - plgpts[0].Y; double x2 = plgpts[2].X - plgpts[0].X; double y2 = plgpts[2].Y - plgpts[0].Y; _nativeMatrix = new geom.AffineTransform(x1 / rect.Width, y1 / rect.Width, x2 / rect.Height, y2 / rect.Height, plgpts[0].X, plgpts[0].Y); _nativeMatrix.translate(-rect.X, -rect.Y); }
public awt.Stroke Create(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform, geom.AffineTransform outputTransform, PenFit penFit) { if ((penFit == PenFit.NotThin) && (outputTransform == null || outputTransform.isIdentity()) && (penTransform == null || penTransform.isIdentity())) { return(new awt.BasicStroke(width, cap, join, miterlimit, dash, dash_phase)); } return(new System.Drawing.AdvancedStroke(width, cap, join, miterlimit, dash, dash_phase, penTransform, outputTransform, penFit)); }
internal awt.Shape GetOutline(float x, float y) { geom.AffineTransform t = (geom.AffineTransform)_lineIter.Transform.clone(); if (_lineIter.Format.IsVertical) { t.translate(y + NativeY, -(x + NativeX)); } else { t.translate(x + NativeX, y + NativeY); } return(_layout.getOutline(t)); }
internal double GetSquaredTransformedWidth(geom.AffineTransform coordsTransform) { geom.AffineTransform transform = _transform.NativeObject; double A = transform.getScaleX(); // m00 double B = transform.getShearY(); // m10 double C = transform.getShearX(); // m01 double D = transform.getScaleY(); // m11 double K = coordsTransform.getScaleX(); // m00 double L = coordsTransform.getShearY(); // m10 double M = coordsTransform.getShearX(); // m01 double N = coordsTransform.getScaleY(); // m11 double AD = A * D, BC = B * C, KN = K * N, LM = L * M; double KN_LM = KN - LM; return(Math.Abs(Width * Width * (AD * KN_LM - BC * KN_LM))); }
internal Matrix(geom.AffineTransform ptr) { _nativeMatrix = ptr; }
/// <summary> /// Sets this transform to a copy of the transform in the specified /// <code>AffineTransform</code> object. /// </summary> public void setTransform(AffineTransform @Tx) { }
public PathIterator getPathIterator(AffineTransform at, double flatness) { return new FlatteningPathIterator (getPathIterator (at), flatness); }
public void transform(AffineTransform at, int startCoord, int numCoords) { ClearCache (); at.transform (_coords, startCoord, _coords, startCoord, numCoords/2); }
internal Matrix (geom.AffineTransform ptr) { _nativeMatrix = ptr; }
public Shape createTransformedShape(AffineTransform at) { ExtendedGeneralPath gp = (ExtendedGeneralPath) Clone (); if (at != null) { gp.transform (at); } return gp; }
/// <summary> /// Renders an image, applying a transform from image space into user space /// before drawing. /// </summary> abstract public bool drawImage(Image @img, AffineTransform @xform, ImageObserver @obs);
/// <summary> /// Returns an iterator object that iterates along the boundary of this /// <code>Polygon</code> and provides access to the geometry /// of the outline of this <code>Polygon</code>. /// </summary> public PathIterator getPathIterator(AffineTransform @at) { return default(PathIterator); }
public GeneralPathIterator(ExtendedGeneralPath _path, AffineTransform at) { this._path = _path; this._affine = at; }
/// <summary> /// Composes an <code>AffineTransform</code> object with the /// <code>Transform</code> in this <code>Graphics2D</code> according /// to the rule last-specified-first-applied. /// </summary> abstract public void transform(AffineTransform @Tx);
/** * Constructs a new <code>AdvancedStroke</code> with the specified * attributes. * @param width the width of this <code>AdvancedStroke</code>. The * width must be greater than or equal to 0.0f. If width is * set to 0.0f, the stroke is rendered as the thinnest * possible line for the target device and the antialias * hint setting. * @param cap the decoration of the ends of a <code>AdvancedStroke</code> * @param join the decoration applied where path segments meet * @param miterlimit the limit to trim the miter join. The miterlimit * must be greater than or equal to 1.0f. * @param dash the array representing the dashing pattern * @param dash_phase the offset to start the dashing pattern * @throws IllegalArgumentException if <code>width</code> is negative * @throws IllegalArgumentException if <code>cap</code> is not either * CAP_BUTT, CAP_ROUND or CAP_SQUARE * @throws IllegalArgumentException if <code>miterlimit</code> is less * than 1 and <code>join</code> is JOIN_MITER * @throws IllegalArgumentException if <code>join</code> is not * either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER * @throws IllegalArgumentException if <code>dash_phase</code> * is negative and <code>dash</code> is not <code>null</code> * @throws IllegalArgumentException if the length of * <code>dash</code> is zero * @throws IllegalArgumentException if dash lengths are all zero. */ public AdvancedStroke(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, AffineTransform penTransform, AffineTransform outputTransform, PenFit penFit) { if (width < 0.0f) { throw new IllegalArgumentException("negative width"); } if (cap != CAP_BUTT && cap != CAP_ROUND && cap != CAP_SQUARE) { throw new IllegalArgumentException("illegal end cap value"); } if (join == JOIN_MITER) { if (miterlimit < 1.0f) { throw new IllegalArgumentException("miter limit < 1"); } } else if (join != JOIN_ROUND && join != JOIN_BEVEL) { throw new IllegalArgumentException("illegal line join value"); } if (dash != null) { if (dash_phase < 0.0f) { throw new IllegalArgumentException("negative dash phase"); } bool allzero = true; for (int i = 0; i < dash.Length; i++) { float d = dash[i]; if (d > 0.0) { allzero = false; } else if (d < 0.0) { throw new IllegalArgumentException("negative dash length"); } } if (allzero) { throw new IllegalArgumentException("dash lengths all zero"); } } this.width = width; this.cap = cap; this.join = join; this.miterlimit = miterlimit; if (dash != null) { this.dash = (float []) dash.Clone(); } this.dash_phase = dash_phase; this._penTransform = penTransform; this._outputTransform = outputTransform; this._penFit = penFit; }
/// <summary> /// Returns an iteration object that defines the boundary of this /// <code>Line2D</code>. /// </summary> public PathIterator getPathIterator(AffineTransform @at) { return(default(PathIterator)); }
/// <summary> /// Returns an iterator object that iterates along the boundary of /// the <code>Shape</code> and provides access to the geometry of the /// outline of the <code>Shape</code>. /// </summary> public PathIterator getPathIterator(AffineTransform @at, double @flatness) { return default(PathIterator); }
awt.PaintContext awt.Paint.createContext(image.ColorModel cm, awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform, awt.RenderingHints hints) { return(createContextInternal(cm, deviceBounds, userBounds, xform, hints)); }
/// <summary> /// Renders a <A HREF="../../java/awt/image/RenderedImage.html" title="interface in java.awt.image"><CODE>RenderedImage</CODE></A>, /// applying a transform from image /// space into user space before drawing. /// </summary> abstract public void drawRenderedImage(RenderedImage @img, AffineTransform @xform);
/// <summary> /// Sets the transform of the specified glyph within this /// <code>GlyphVector</code>. /// </summary> abstract public void setGlyphTransform(int @glyphIndex, AffineTransform @newTX);
/// <summary> /// Sets the current user-to-device AffineTransform contained /// in the RenderContext to a given transform. /// </summary> public void setTransform(AffineTransform @newTransform) { }
geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0, double arg_1) { return(Shape.getPathIterator(arg_0, arg_1)); }
/// <summary> /// Constructs a RenderContext with a given transform. /// </summary> public RenderContext(AffineTransform @usr2dev) { }
/// <summary> /// Concatenates an <code>AffineTransform</code> <code>Tx</code> to /// this <code>AffineTransform</code> Cx in the most commonly useful /// way to provide a new user space /// that is mapped to the former user space by <code>Tx</code>. /// </summary> public void concatenate(AffineTransform @Tx) { }
/// <summary> /// Constructs a RenderContext with a given transform and area of interest. /// </summary> public RenderContext(AffineTransform @usr2dev, Shape @aoi) { }
public PathIterator getPathIterator(AffineTransform at) { return new GeneralPathIterator (this, at); }
/// <summary> /// Constructs a RenderContext with a given transform. /// </summary> public RenderContext(AffineTransform @usr2dev, Shape @aoi, RenderingHints @hints) { }
public void transform(AffineTransform at) { transform(at, 0, CoordsCount); }
/// <summary> /// <B>Deprecated.</B> <I>replaced by /// <code>concatenateTransform(AffineTransform)</code>.</I> /// </summary> public void concetenateTransform(AffineTransform @modTransform) { }
/// <summary> /// Constructs a <code>FontRenderContext</code> object from an /// optional <A HREF="../../../java/awt/geom/AffineTransform.html" title="class in java.awt.geom"><CODE>AffineTransform</CODE></A> and two <code>boolean</code> /// values that determine if the newly constructed object has /// anti-aliasing or fractional metrics. /// </summary> public FontRenderContext(AffineTransform @tx, bool @isAntiAliased, bool @usesFractionalMetrics) { }
internal awt.Stroke GetNativeObject(geom.AffineTransform outputTransform, PenFit penFit) { return(GetNativeObject(null, outputTransform, penFit)); }
void Multiply(geom.AffineTransform at, MatrixOrder order) { Multiply(NativeObject, at, order); }
// protected void doDrawOnTo(BufferedImageRaster canvas) // { // Sector sector = this.getSector(); // if (null == sector) // { // String message = Logging.getMessage("nullValue.SectorIsNull"); // Logging.logger().severe(message); // throw new ArgumentException(message); // } // // if (!sector.intersects(canvas.getSector())) // { // return; // } // // BufferedImage transformedImage = null; // java.awt.Graphics2D g2d = null; // java.awt.Shape prevClip = null; // java.awt.Composite prevComposite = null; // // try // { // int canvasWidth = canvas.getWidth(); // int canvasHeight = canvas.getHeight(); // // // Apply the transform that correctly maps the image onto the canvas. // java.awt.geom.AffineTransform transform = this.computeSourceToDestTransform( // this.getWidth(), this.getHeight(), this.getSector(), canvasWidth, canvasHeight, canvas.getSector()); // // AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); // Rectangle2D rect = op.getBounds2D(this.getBufferedImage()); // // int clipWidth = (int) Math.Ceiling((rect.getMaxX() >= canvasWidth) ? canvasWidth : rect.getMaxX()); // int clipHeight = (int) Math.Ceiling((rect.getMaxY() >= canvasHeight) ? canvasHeight : rect.getMaxY()); // // if (clipWidth <= 0 || clipHeight <= 0) // { // return; // } // // int transformedImageType = (BufferedImage.TYPE_CUSTOM != this.getBufferedImage().getType()) // ? this.getBufferedImage().getType() : BufferedImage.TYPE_INT_ARGB; // // transformedImage = new BufferedImage(clipWidth, clipHeight, transformedImageType); // op.filter(this.getBufferedImage(), transformedImage); // // g2d = canvas.getGraphics(); // // prevClip = g2d.getClip(); // prevComposite = g2d.getComposite(); // // // Set the alpha composite for appropriate alpha blending. // g2d.setComposite(java.awt.AlphaComposite.SrcOver); // g2d.drawImage(transformedImage, 0, 0, null); // } // catch (java.awt.image.ImagingOpException ioe) // { // // If we catch a ImagingOpException, then the transformed image has a width or height of 0. // // This indicates that there is no intersection between the source image and the canvas, // // or the intersection is smaller than one pixel. // } // catch (java.awt.image.RasterFormatException rfe) // { // // If we catch a RasterFormatException, then the transformed image has a width or height of 0. // // This indicates that there is no intersection between the source image and the canvas, // // or the intersection is smaller than one pixel. // } // finally // { // // Restore the previous clip, composite, and transform. // try // { // if (null != transformedImage) // { // transformedImage.flush(); // } // // if (null != g2d) // { // if (null != prevClip) // { // g2d.setClip(prevClip); // } // // if (null != prevComposite) // { // g2d.setComposite(prevComposite); // } // } // } // catch (Throwable t) // { // Logging.logger().log(java.util.logging.Level.FINEST, WWUtil.extractExceptionReason(t), t); // } // } // } protected void doDrawOnTo(BufferedImageRaster canvas) { Sector sector = this.getSector(); if (null == sector) { String message = Logging.getMessage("nullValue.SectorIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (!sector.intersects(canvas.getSector())) { return; } java.awt.Graphics2D g2d = null; java.awt.Shape prevClip = null; java.awt.Composite prevComposite = null; java.lang.Object prevInterpolation = null, prevAntialiasing = null; try { int canvasWidth = canvas.getWidth(); int canvasHeight = canvas.getHeight(); // Apply the transform that correctly maps the image onto the canvas. java.awt.geom.AffineTransform transform = this.computeSourceToDestTransform( this.getWidth(), this.getHeight(), this.getSector(), canvasWidth, canvasHeight, canvas.getSector()); AffineTransformOp op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); Rectangle2D rect = op.getBounds2D(this.getBufferedImage()); int clipWidth = (int)Math.Ceiling((rect.getMaxX() >= canvasWidth) ? canvasWidth : rect.getMaxX()); int clipHeight = (int)Math.Ceiling((rect.getMaxY() >= canvasHeight) ? canvasHeight : rect.getMaxY()); if (clipWidth <= 0 || clipHeight <= 0) { return; } g2d = canvas.getGraphics(); prevClip = g2d.getClip(); prevComposite = g2d.getComposite(); prevInterpolation = g2d.getRenderingHint(RenderingHints.KEY_INTERPOLATION); prevAntialiasing = g2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING); // Set the alpha composite for appropriate alpha blending. g2d.setComposite(java.awt.AlphaComposite.SrcOver); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawImage(this.getBufferedImage(), transform, null); } // catch (java.awt.image.ImagingOpException ioe) // { // // If we catch a ImagingOpException, then the transformed image has a width or height of 0. // // This indicates that there is no intersection between the source image and the canvas, // // or the intersection is smaller than one pixel. // } // catch (java.awt.image.RasterFormatException rfe) // { // // If we catch a RasterFormatException, then the transformed image has a width or height of 0. // // This indicates that there is no intersection between the source image and the canvas, // // or the intersection is smaller than one pixel. // } catch (Throwable t) { String reason = WWUtil.extractExceptionReason(t); Logging.logger().log(java.util.logging.Level.SEVERE, reason, t); } finally { // Restore the previous clip, composite, and transform. try { if (null != g2d) { if (null != prevClip) { g2d.setClip(prevClip); } if (null != prevComposite) { g2d.setComposite(prevComposite); } if (null != prevInterpolation) { g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, prevInterpolation); } if (null != prevAntialiasing) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, prevAntialiasing); } } } catch (Throwable t) { Logging.logger().log(java.util.logging.Level.FINEST, WWUtil.extractExceptionReason(t), t); } } }
/// <summary> /// Constructs a new <code>AffineTransform</code> that is a copy of /// the specified <code>AffineTransform</code> object. /// </summary> public AffineTransform(AffineTransform @Tx) { }
static public awt.Stroke CreateStroke(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase, geom.AffineTransform penTransform, geom.AffineTransform outputTransform, PenFit penFit) { return(Creator.Create(width, cap, join, miterlimit, dash, dash_phase, penTransform, outputTransform, penFit)); }
protected virtual awt.PaintContext createContextInternal(image.ColorModel cm, awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform, awt.RenderingHints hints) { Matrix.Multiply(xform, _brushTransform.NativeObject, MatrixOrder.Append); return(NativeObject.createContext(cm, deviceBounds, userBounds, xform, hints)); }
geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0) { return(Shape.getPathIterator(arg_0)); }
/// <summary> /// Modifies the current user-to-device transform by prepending another /// transform. /// </summary> public void preConcatenateTransform(AffineTransform @modTransform) { }
/// <summary> /// Returns an iteration object that defines the boundary of this /// flattened <code>Line2D</code>. /// </summary> public PathIterator getPathIterator(AffineTransform @at, double @flatness) { return(default(PathIterator)); }
/// <summary> /// /// </summary> /// <param name="outputTransform">transform which will be applied on the final shape</param> /// <param name="fitPen">ensure the shape will wide enough to be visible</param> /// <returns></returns> internal awt.Stroke GetNativeObject(geom.AffineTransform penTransform, geom.AffineTransform outputTransform, PenFit penFit) { float[] dashPattern = null; switch (DashStyle) { case DashStyle.Custom: if (_dashPattern != null) { dashPattern = new float[_dashPattern.Length]; for (int i = 0; i < _dashPattern.Length; i++) { if (EndCap == LineCap.Flat) { dashPattern[i] = _dashPattern[i] * Width; } else { if ((i & 1) == 0) { // remove the size of caps from the opaque parts dashPattern[i] = (_dashPattern[i] * Width) - Width; if (_dashPattern[i] < 0) { dashPattern[i] = 0; } } else { // add the size of caps to the transparent parts dashPattern[i] = (_dashPattern[i] * Width) + Width; } } } } break; case DashStyle.Dash: dashPattern = DASH_ARRAY; break; case DashStyle.DashDot: dashPattern = DASHDOT_ARRAY; break; case DashStyle.DashDotDot: dashPattern = DASHDOTDOT_ARRAY; break; // default: // case DashStyle.Solid: // break; } int join; switch (LineJoin) { case LineJoin.Bevel: join = java.awt.BasicStroke.JOIN_BEVEL; break; default: case LineJoin.Miter: case LineJoin.MiterClipped: join = java.awt.BasicStroke.JOIN_MITER; break; case LineJoin.Round: join = java.awt.BasicStroke.JOIN_ROUND; break; } // We go by End cap for now. int cap; switch (EndCap) { default: case LineCap.Square: case LineCap.SquareAnchor: cap = awt.BasicStroke.CAP_SQUARE; break; case LineCap.Round: case LineCap.RoundAnchor: cap = awt.BasicStroke.CAP_ROUND; break; case LineCap.Flat: cap = awt.BasicStroke.CAP_BUTT; break; } geom.AffineTransform penT = _transform.NativeObject; if (penTransform != null && !penTransform.isIdentity()) { penT = (geom.AffineTransform)penT.clone(); penT.concatenate(penTransform); } return(StrokeFactory.CreateStroke(Width, cap, join, MiterLimit, dashPattern, DashOffset, penT, outputTransform, penFit)); }
/// <summary> /// Returns an iteration object that defines the boundary of this /// <code>RoundRectangle2D</code>. /// The iterator for this class is multi-threaded safe, which means /// that this <code>RoundRectangle2D</code> class guarantees that /// modifications to the geometry of this <code>RoundRectangle2D</code> /// object do not affect any iterations of that geometry that /// are already in process. </summary> /// <param name="at"> an optional <code>AffineTransform</code> to be applied to /// the coordinates as they are returned in the iteration, or /// <code>null</code> if untransformed coordinates are desired </param> /// <returns> the <code>PathIterator</code> object that returns the /// geometry of the outline of this /// <code>RoundRectangle2D</code>, one segment at a time. /// @since 1.2 </returns> public override PathIterator GetPathIterator(AffineTransform at) { return(new RoundRectIterator(this, at)); }