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);
		}
Exemple #2
0
			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);
			}
			public NormalizingPathIterator(geom.PathIterator iter) {
				_iter = iter;
			}
		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 ConcatenateTransform(geom.AffineTransform transform, MatrixOrder order) {
			geom.AffineTransform at = _transform.NativeObject;
			Matrix.Multiply(at, transform, order);
		}
		internal void PrependBaseTransform(geom.AffineTransform t) {
			NativeObject.transform(t);
		}
		bool awt.Shape.intersects(geom.Rectangle2D arg_0) {
			return Shape.intersects(arg_0);
		}
		geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0) {
			return Shape.getPathIterator(arg_0);
		}
Exemple #9
0
		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);
		}
Exemple #10
0
			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) {
				return new awt.BasicStroke(width, cap, join, miterlimit, dash, dash_phase);
			}
		/// <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);
		}
		internal awt.Stroke GetNativeObject(geom.AffineTransform outputTransform, PenFit penFit) {
			return GetNativeObject(null, outputTransform, penFit);
		}
		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));
		}
		bool awt.Shape.contains(geom.Point2D arg_0) {
			return Shape.contains(arg_0);
		}
		void IntersectClip (geom.Area area) {
			
			geom.AffineTransform t = GetFinalTransform();
			if (!t.isIdentity()) {
				area = (geom.Area) area.clone ();
				area.transform(t);
			}

			_clip.NativeObject.intersect(area);
			RestoreBaseClip();
			NativeObject.clip(_clip);
		}
		bool awt.Shape.contains(geom.Rectangle2D arg_0) {
			return Shape.contains(arg_0);
		}
		void CombineClipArea(geom.Area area, CombineMode combineMode) {
			geom.AffineTransform t = GetFinalTransform();
			if (!t.isIdentity())
				area.transform(t);
			if (combineMode == CombineMode.Replace) {
				_clip.NativeObject.reset();
				_clip.NativeObject.add(area);
			}
			else {
				geom.Area curClip = _clip.NativeObject;
				switch(combineMode) {
					case CombineMode.Complement:
						curClip.add(area);
						break;
					case CombineMode.Exclude:
						curClip.subtract(area);
						break;
					case CombineMode.Intersect:
						curClip.intersect(area);
						break;
					case CombineMode.Union:
						curClip.add(area);
						break;
					case CombineMode.Xor:
						curClip.exclusiveOr(area);
						break;
					default:
						throw new ArgumentOutOfRangeException();					
				}
			}

			RestoreBaseClip();
			NativeObject.clip(_clip);
		}
		geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0, double arg_1) {
			return Shape.getPathIterator(arg_0, arg_1);
		}
		static internal geom.AffineTransform GetFinalTransform(
			geom.AffineTransform transform, GraphicsUnit pageUnit, float pageScale) {
			geom.AffineTransform t = null;
			if (pageUnit != GraphicsUnit.Display) {
				float scale = pageScale * _unitConversion[ (int)pageUnit ];
				if (Math.Abs(scale-1f) > float.Epsilon)
					t = geom.AffineTransform.getScaleInstance(scale, scale);
			}

			if (t != null)
				t.concatenate(transform);
			else
				t = transform;
			
			return t;
		}
        internal Region(geom.Area native) : base(native)
		{
        }
		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);
		}