コード例 #1
0
		//---------------------------------------------------------------------
		public OutlineRenderer(IImageByte destImage, LineProfileAnitAlias profile)
		{
			destImageSurface = destImage;
			lineProfile = profile;
			clippingRectangle = new RectangleInt(0, 0, 0, 0);
			doClipping = false;
		}
コード例 #2
0
		//---------------------------------------------------------------------
		public void profile(LineProfileAnitAlias prof)
		{
			lineProfile = prof;
		}
コード例 #3
0
ファイル: lion_outline.cs プロジェクト: glocklueng/agg-sharp
		public override void OnDraw(Graphics2D graphics2D)
		{
			ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());

			int width = (int)widgetsSubImage.Width;
			int height = (int)widgetsSubImage.Height;

			ImageBuffer clippedSubImage = new ImageBuffer();
			clippedSubImage.Attach(widgetsSubImage, new BlenderBGRA());
			ImageClippingProxy imageClippingProxy = new ImageClippingProxy(clippedSubImage);
			imageClippingProxy.clear(new RGBA_Floats(1, 1, 1));

			Affine transform = Affine.NewIdentity();
			transform *= Affine.NewTranslation(-lionShape.Center.x, -lionShape.Center.y);
			transform *= Affine.NewScaling(lionScale, lionScale);
			transform *= Affine.NewRotation(angle + Math.PI);
			transform *= Affine.NewSkewing(skewX / 1000.0, skewY / 1000.0);
			transform *= Affine.NewTranslation(width / 2, height / 2);

			if (renderAsScanlineCheckBox.Checked)
			{
				rasterizer.SetVectorClipBox(0, 0, width, height);

				Stroke stroke = new Stroke(lionShape.Path);
				stroke.width(widthSlider.Value);
				stroke.line_join(LineJoin.Round);
				VertexSourceApplyTransform trans = new VertexSourceApplyTransform(stroke, transform);
				ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
				scanlineRenderer.RenderSolidAllPaths(imageClippingProxy, rasterizer, scanlineCache, trans, lionShape.Colors, lionShape.PathIndex, lionShape.NumPaths);
			}
			else
			{
				double w = widthSlider.Value * transform.GetScale();

				LineProfileAnitAlias lineProfile = new LineProfileAnitAlias(w, new gamma_none());
				OutlineRenderer outlineRenderer = new OutlineRenderer(imageClippingProxy, lineProfile);
				rasterizer_outline_aa rasterizer = new rasterizer_outline_aa(outlineRenderer);

				rasterizer.line_join(renderAccurateJoinsCheckBox.Checked ?
					rasterizer_outline_aa.outline_aa_join_e.outline_miter_accurate_join
					: rasterizer_outline_aa.outline_aa_join_e.outline_round_join);
				rasterizer.round_cap(true);

				VertexSourceApplyTransform trans = new VertexSourceApplyTransform(lionShape.Path, transform);

				rasterizer.RenderAllPaths(trans, lionShape.Colors, lionShape.PathIndex, lionShape.NumPaths);
			}

			base.OnDraw(graphics2D);
		}