Esempio n. 1
0
		/// <summary>
		/// Paints the stroke using the pen associated with this path.
		/// </summary>
		/// <param name="paintContext">The paint context to use for painting this node.</param>
		protected virtual void PaintStroke(P3PaintContext paintContext) {
			Device device = paintContext.Device;

			// Reset the path to flatten
			TEMP_PATH.Reset();
			TEMP_PATH.AddPath(path, false);

			float absLineWidth = pen.Width * paintContext.Scale;
			bool renderFlattened = (pen.Width == 0 || absLineWidth < 3);

			if (renderMode == PathRenderMode.Cached) {
				if (renderFlattened) {
					Render(device, GetValidVertexBuffer(device), flattenedStartIndex, renderListTypes.Count-1);
				} else {
					Render(device, GetValidVertexBuffer(device), penStartIndex, flattenedStartIndex-1);
				}
			} else {
				if (renderFlattened) {
					TEMP_PATH.Flatten(new System.Drawing.Drawing2D.Matrix(), flatness);	
					Render(device, pen.Color.ToArgb(), TEMP_PATH);
				} else {
					Tesselate(TEMP_PATH, pen.Color.ToArgb(), true, true);
					Render(device, renderList);
				}
			}
		}
Esempio n. 2
0
		/// <summary>
		/// Paints the fill using the brush associated with this node.
		/// </summary>
		/// <param name="paintContext">The paint context to use for painting this node.</param>
		protected virtual void PaintFill(P3PaintContext paintContext) {
			Device device = paintContext.Device;

			if (renderMode == PathRenderMode.Cached) {
				Render(device, GetValidVertexBuffer(device), 0, penStartIndex-1);
			} else {
				// Reset the path to flatten
				TEMP_PATH.Reset();
				TEMP_PATH.AddPath(path, false);
				TEMP_PATH.FillMode = FillMode;

				Tesselate(TEMP_PATH, (Brush as SolidBrush).Color.ToArgb(), false, true);
				Render(device, renderList);
			}
		}