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); }
public PlainImage(awt.Image image, awt.Image [] thumbnails, ImageFormat format, float xRes, float yRes, FrameDimension dimension) { _nativeObject = image; _thumbnails = thumbnails; _imageFormat = format; _xResolution = xRes; _yResolution = yRes; _dimension = dimension; }
static private Color FromNativeColor ( awt.Color awtColor, string name, KnownColor knownColor) { return Color.FromArgbSystem (awtColor.getAlpha(), awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue(), name, knownColor); }
protected abstract awt.Image [] CloneNativeObjects(awt.Image [] src);
internal static Image ImageFromNativeImage(awt.Image nativeImage, ImageFormat format) { if (nativeImage is BufferedImage) return new Bitmap(nativeImage, format); throw new ArgumentException("Invalid image type"); }
protected BasicShape(awt.Shape shape) { _shape = shape; }
void FillScaledShape(Brush paint, awt.Shape shape) { Matrix m = null; if (!(paint is SolidBrush || paint is HatchBrush) && !_transform.IsIdentity) { m = paint.BrushTransform; paint.BrushMultiplyTransform( _transform ); } try { NativeObject.setPaint(paint); NativeObject.fill(shape); } finally { if (m != null) paint.BrushTransform = m; } }
static awt.Shape GetNormalizedShape(awt.Shape shape, geom.AffineTransform t) { geom.PathIterator iter = new NormalizingPathIterator(shape.getPathIterator(t)); geom.GeneralPath path = new geom.GeneralPath(iter.getWindingRule()); path.append(iter, false); return path; }
void FillShape(Brush paint, awt.Shape shape) { if (paint == null) throw new ArgumentNullException("brush"); geom.AffineTransform oldT = null; if (NeedsNormalization) { oldT = NativeObject.getTransform(); geom.AffineTransform t = GetFinalTransform(); if (!oldT.isIdentity()) { t = (geom.AffineTransform) t.clone (); t.preConcatenate(oldT); } shape = GetNormalizedShape(shape, t); } else { geom.AffineTransform t = GetFinalTransform(); if (!t.isIdentity()) shape = t.createTransformedShape(shape); } if (oldT != null) NativeObject.setTransform(Matrix.IdentityTransform.NativeObject); try { FillScaledShape(paint, shape); } finally { if (oldT != null) NativeObject.setTransform(oldT); } }
void DrawShape(Pen pen, awt.Shape shape) { if (pen == null) throw new ArgumentNullException("pen"); if (StrokeFactory.CanCreateAdvancedStroke && (!pen.CanCreateBasicStroke || !NeedsNormalization)) { geom.AffineTransform oldT = NativeObject.getTransform(); NativeObject.setTransform(Matrix.IdentityTransform.NativeObject); try { geom.AffineTransform t = GetFinalTransform(); if (!oldT.isIdentity()) { t = (geom.AffineTransform)t.clone(); t.preConcatenate(oldT); } double widthsquared = pen.GetSquaredTransformedWidth(t); bool antiAlias = (SmoothingMode == SmoothingMode.AntiAlias); bool thin = (widthsquared <= (antiAlias ? AdvancedStroke.MinPenSizeAASquared : AdvancedStroke.MinPenSizeSquared)); PenFit penFit = thin ? (antiAlias ? PenFit.ThinAntiAlias : PenFit.Thin) : PenFit.NotThin; if (NeedsNormalization) { bool normThin = widthsquared <= AdvancedStroke.MinPenSizeSquaredNorm; if (normThin) { shape = GetNormalizedShape(shape, t); shape = pen.GetNativeObject( t, null, penFit).createStrokedShape(shape); } else { shape = pen.GetNativeObject(t, penFit).createStrokedShape(shape); shape = GetNormalizedShape(shape, null); } } else { shape = pen.GetNativeObject(t, penFit).createStrokedShape(shape); } FillScaledShape(pen.Brush, shape); } finally { NativeObject.setTransform(oldT); } } else { awt.Stroke oldStroke = NativeObject.getStroke(); NativeObject.setStroke(pen.GetNativeObject(null, PenFit.NotThin)); try { NativeObject.setPaint(pen.Brush); geom.AffineTransform oldT = NativeObject.getTransform(); NativeObject.transform(GetFinalTransform()); try { NativeObject.draw(shape); } finally { NativeObject.setTransform(oldT); } } finally { NativeObject.setStroke(oldStroke); } } }
internal void IntersectScaledClipWithBase(awt.Shape clip) { NativeObject.clip(clip); }
awt.Shape awt.Stroke.createStrokedShape(awt.Shape arg_0) { throw new NotImplementedException("DummyStroke"); }
awt.Shape awt.Stroke.createStrokedShape(awt.Shape arg_0) { return GetNativeObject(null, PenFit.NotThin).createStrokedShape(arg_0); }
protected void AddFont(awt.Font font) { _fonts.Add(font.getFamily(), font); }
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); }
internal void Draw(awt.Graphics2D g2d, float x, float y) { if (_lineIter.Format.IsVertical) _layout.draw (g2d, y + NativeY, -(x + NativeX)); else _layout.draw(g2d, x + NativeX, y + NativeY ); }