Exemplo n.º 1
0
        /// <summary>
        /// This method is called just after the Piccolo scene graph is painted.
        /// </summary>
        /// <param name="paintContext">The paint context used to paint the scene graph.</param>
        public static void EndProcessingOutput(PPaintContext paintContext)
        {
            processOutputTime += (PUtil.CurrentTimeMillis - startProcessingOutputTime);
            framesProcessed++;

            if (PDebug.debugPrintFrameRate)
            {
                if (framesProcessed % printResultsFrameRate == 0)
                {
                    System.Console.WriteLine("Process output frame rate: " + OutputFPS + " fps");
                    System.Console.WriteLine("Process input frame rate: " + InputFPS + " fps");
                    System.Console.WriteLine("Total frame rate: " + TotalFPS + " fps");
                    System.Console.WriteLine();
                    ResetFPSTiming();
                }
            }

            if (PDebug.debugPrintUsedMemory)
            {
                if (framesProcessed % printResultsFrameRate == 0)
                {
                    System.Console.WriteLine("Approximate used memory: " + ApproximateUsedMemory / 1024 + " k");
                }
            }

            if (PDebug.debugRegionManagement)
            {
                paintContext.PaintClipRegion(new SolidBrush(DebugPaintColor));
            }

            processingOutput = false;
        }
Exemplo n.º 2
0
        //****************************************************************
        // Painting - Methods for painting a PText.
        //****************************************************************

        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext)
        {
            base.Paint(paintContext);

            if (text != null && textBrush != null && font != null)
            {
                Graphics g = paintContext.Graphics;

                float renderedFontSize = font.SizeInPoints * paintContext.Scale;
                if (renderedFontSize < PUtil.GreekThreshold)
                {
                    // .NET bug: DrawString throws a generic gdi+ exception when
                    // the scaled font size is very small.  So, we will render
                    // the text as a simple rectangle for small fonts
                    g.FillRectangle(textBrush, Bounds);
                }
                else if (renderedFontSize < PUtil.MaxFontSize)
                {
                    Font renderFont = font;

                    // The font needs to be adjusted for printing.

                    //TODO: Remove HighDPI scaling for this as we have zoom controller
                    if (g.DpiY != GRAPHICS.DpiY)
                    {
                        float fPrintedFontRatio = GRAPHICS.DpiY / 100;
                        renderFont = new Font(font.Name, font.Size * fPrintedFontRatio,
                                              font.Style, font.Unit);
                    }

                    g.DrawString(text, renderFont, textBrush, Bounds, stringFormat);
                }
            }
        }
Exemplo n.º 3
0
		/// <summary>
		/// Constructs a new PPaintContext.
		/// </summary>
		/// <param name="graphics">
		/// The graphics context to associate with this paint context.
		/// </param>
		/// <param name="canvas">The canvas that the paint context will render on.</param>
		public PPaintContext(Graphics graphics, PCanvas canvas) {
			this.graphics = graphics;
			this.canvas = canvas;
			clipStack = new Stack();
			localClipStack = new Stack();
			cameraStack = new Stack();
			transformStack = new Stack();
			RenderQuality = RenderQuality.HighQuality;
			CURRENT_PAINT_CONTEXT = this;

			InitializeStacks();
		}
Exemplo n.º 4
0
        //****************************************************************
        // Painting - Methods for painting a PText.
        //****************************************************************

        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext)
        {
            base.Paint(paintContext);
            Device device = (paintContext as P3PaintContext).Device;

            PMatrix currMatrix = (paintContext as P3PaintContext).Transform;

            // Scale the matrix down to display font units
            float scale = displayFontSize / font.Size;

            currMatrix.ScaleBy(scale, X, Y);

            float[] piccoloMatrixElements = currMatrix.Elements;
            if (!currMatrix.IsIdentity)
            {
                Matrix m = new Matrix();
                m.M11 = piccoloMatrixElements[0];
                m.M12 = piccoloMatrixElements[1];
                m.M21 = piccoloMatrixElements[2];
                m.M22 = piccoloMatrixElements[3];
                m.M41 = piccoloMatrixElements[4];
                m.M42 = piccoloMatrixElements[5];
                m.M33 = 1;
                m.M44 = 1;
                textSprite.Transform = m;
            }

            textSprite.Begin(SpriteFlags.None);
            DrawTextFormat D3DAlignment = P3Util.GetD3DAlignment(stringFormat.Alignment);

            // Calculate the rectangle with no padding, in actual font units
            scale = 1 / scale;
            int totHzPadding = currLeftPadding + currRightPadding;
            int totVtPadding = currTopPadding + currBottomPadding;

            Rectangle dstRect = new Rectangle((int)(Bounds.X + currLeftPadding * scale), (int)(Bounds.Y + currTopPadding * scale),
                                              (int)((Bounds.Width - totHzPadding) * scale), (int)((Bounds.Height - totVtPadding) * scale));

            // Wrap the string ourselves, instead of letting the draw method do it, since we want to make
            // sure it's consistent with our own MeasureString method.
            String str = P3Util.WrapString(textSprite, D3Dfont, Text, dstRect.Width, (TextBrush as SolidBrush).Color);

            D3Dfont.DrawText(textSprite, str, dstRect, D3DAlignment, (TextBrush as SolidBrush).Color);
            textSprite.End();
        }
Exemplo n.º 5
0
        protected override void Paint(UMD.HCIL.Piccolo.Util.PPaintContext paintContext)
        {
            Graphics graphics = paintContext.Graphics;
            Brush    brush    = Brush;

            if (brush == null)
            {
                if (ChildrenCount == 0)
                {
                    brush = new SolidBrush(Color.FromArgb(170, Color.White));
                }
                else
                {
                    brush = new SolidBrush(Color.FromArgb(0, Color.White));
                }
            }
            brush = new SolidBrush(Color.FromArgb(0, Color.White));
            float x      = Model.X;
            float y      = Model.Y;
            float width  = Model.Width;
            float height = Model.Height;

            graphics.FillRectangle(brush, x, y, width, height);

            Pen pen = new Pen(Brushes.Gray, 1);

            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            if (Frame.ShowAxis)
            {
                pen.Brush      = Brushes.SkyBlue;
                pen.Width      = 1;
                pen.DashOffset = 30;
                graphics.DrawLine(pen, x, y, x + width, y + height);
                graphics.DrawLine(pen, x, y + height, x + width, y);
            }
        }
Exemplo n.º 6
0
		/// <summary>
		/// Overridden.  See <see cref="PCamera.PaintDebugBounds">PCamera.PaintDebugBounds</see>.
		/// </summary>
		protected override void PaintDebugBounds(PPaintContext paintContext, Pen boundsPen, RectangleF nodeBounds) {
			Device device = (paintContext as P3PaintContext).Device;
			CustomVertex.PositionColored[] colVerts = new CustomVertex.PositionColored[VERTEX_COUNT];
			P3Util.CreateColoredRectangleOutline(colVerts, 0, nodeBounds, boundsPen.Color.ToArgb());
			device.VertexFormat = CustomVertex.PositionColored.Format;
			device.DrawUserPrimitives(PrimitiveType.LineStrip, 4, colVerts);
		}
Exemplo n.º 7
0
			protected override void Paint(PPaintContext paintContext) {
				Graphics g = paintContext.Graphics;
				g.DrawRectangle(Pens.Black, Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height);

				float y = (float) Y + CalendarNode.TEXT_Y_OFFSET;
				g.DrawString(dayOfMonthString, CalendarNode.DEFAULT_FONT, Brush, (float) X + CalendarNode.TEXT_X_OFFSET, y);

				if (hasWidthFocus && hasHeightFocus) {
					paintContext.PushClip(new Region(Bounds));
					for (int i = 0; i < lines.Count; i++) {
						y += 10;
						g.DrawString((String)lines[i], CalendarNode.DEFAULT_FONT, Brush, X + CalendarNode.TEXT_X_OFFSET, y);
					}
					paintContext.PopClip();
				}
			}
Exemplo n.º 8
0
		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			base.Paint (paintContext);

			Graphics g = paintContext.Graphics;
			PMatrix matrix = new PMatrix(g.Transform);
			RectangleF transRectF = matrix.Transform(bounds);
			Rectangle transRect = new Rectangle((int)transRectF.X, (int)transRectF.Y, (int)transRectF.Width, (int)transRectF.Height);

			// Draw the image if the control node is not in editing mode or
			// if the control is being rendered in a view other than the one
			// that owns the control.
			if (!Editing || control.Bounds != transRect || paintContext.Canvas != currentCanvas) {
				if (Image != null) g.DrawImage(Image, bounds);
			}
		}
Exemplo n.º 9
0
		/// <summary>
		/// Scale the Graphics so that this node's full bounds fit in displayRect and then
		/// render into the given Graphics context.
		/// </summary>
		/// <param name="g">The Graphics context to use when rendering the node.</param>
		/// <param name="displayRect">The imageable area.</param>
		protected virtual void ScaleAndDraw(Graphics g, RectangleF displayRect) {
			RectangleF bounds = FullBounds;
			g.TranslateTransform(displayRect.X, displayRect.Y);

			// scale the graphics so node's full bounds fit in the imageable bounds.
			float scale = displayRect.Width / bounds.Width;
			if (displayRect.Height / bounds.Height < scale) {
				scale = displayRect.Height / bounds.Height;
			}
		
			g.ScaleTransform(scale, scale);
			g.TranslateTransform(-bounds.X, -bounds.Y);
		
			PPaintContext pc = new PPaintContext(g, null);
			pc.RenderQuality = RenderQuality.HighQuality;
			FullPaint(pc);
		}
Exemplo n.º 10
0
		/// <summary>
		/// Paint this node and all of its descendents.
		/// </summary>
		/// <param name="paintContext">The paint context to use for painting this node.</param>
		/// <remarks>
		/// <b>Notes to Inheritors:</b>  Most subclasses do not need to override this method,
		/// they should override <c>paint</c> or <c>paintAfterChildren</c> instead.
		/// </remarks>
		public virtual void FullPaint(PPaintContext paintContext) {
			if (Visible && FullIntersects(paintContext.LocalClip)) { 
				paintContext.PushMatrix(matrix);
				//paintContext.PushTransparency(transparency);

				if (!Occluded) {
					Paint(paintContext);
				}

				int count = ChildrenCount;
				for (int i = 0; i < count; i++) {
					children[i].FullPaint(paintContext);
				}
						
				PaintAfterChildren(paintContext);

				//paintContext.popTransparency(transparency);
				paintContext.PopMatrix();
			}
		}
Exemplo n.º 11
0
		/// <summary>
		/// Overridden. Begins the Direct3D scene, paints Piccolo and ends the Direct3D scene.
		/// </summary>
		/// <param name="paintContext">The paint context to use for painting piccolo.</param>
		protected override void PaintPiccolo(PPaintContext paintContext) {
			if (device != null) {
				device.Clear(ClearFlags.Target, BackColor, 1.0f, 0);
				device.BeginScene();   // Begin the scene.

				base.PaintPiccolo (paintContext);

				device.EndScene();  // End the scene.
				device.Present();
			}
		}
Exemplo n.º 12
0
        //****************************************************************
        // Painting - Methods for painting a PPathwayObject.
        //****************************************************************
        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            Brush b = this.Brush;
            System.Drawing.Graphics g = paintContext.Graphics;

            if (b != null)
            {
                g.FillPath(b, m_path);
            }

            if (m_pen != null)
            {
                g.DrawPath(m_pen, m_path);
            }
        }
Exemplo n.º 13
0
			protected override void Paint(PPaintContext paintContext) {
				// make sure grid gets drawn on snap to grid boundaries. And 
				// expand a little to make sure that entire view is filled.
				float bx = (X - (X % gridSpacing)) - gridSpacing;
				float by = (Y - (Y % gridSpacing)) - gridSpacing;
				float rightBorder = X + Width + gridSpacing;
				float bottomBorder = Y + Height + gridSpacing;

				Graphics g = paintContext.Graphics;
				RectangleF clip = paintContext.LocalClip;

				for (float x = bx; x < rightBorder; x += gridSpacing) {
					gridLine.Reset();
					gridLine.AddLine(x, by, x, bottomBorder);
					if (PUtil.RectIntersectsPerpLine(clip, x, by, x, bottomBorder)) {
						g.DrawPath(gridPen, gridLine);
					}
				}

				for (float y = by; y < bottomBorder; y += gridSpacing) {
					gridLine.Reset();
					gridLine.AddLine(bx, y, rightBorder, y);
					if (PUtil.RectIntersectsPerpLine(clip, bx, y, rightBorder, y)) {
						g.DrawPath(gridPen, gridLine);
					}
				}
			}
Exemplo n.º 14
0
		//****************************************************************
		// Painting - Methods for painting a PImage.
		//****************************************************************

		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			if (Image != null) {
				RectangleF b = Bounds;
				Graphics g = paintContext.Graphics;

				g.DrawImage(image, b);
			}
		}
Exemplo n.º 15
0
		/// <summary>
		/// Overridden.  Pops the clip from the paint context and then renders the outline
		/// of this node.
		/// </summary>
		/// <param name="paintContext">
		/// The paint context to use for painting this node.
		/// </param>
		protected override void PaintAfterChildren(PPaintContext paintContext) {
			paintContext.PopClip();
			if (Pen != null) {
				Graphics g = paintContext.Graphics;
				g.DrawPath(Pen, PathReference);
			}
		}
Exemplo n.º 16
0
		/// <summary>
		/// Overridden.  Renders the fill for this node and then pushes the clip onto the
		/// paint context, so that when this node's children are rendered they will be
		/// clipped accordingly.
		/// </summary>
		/// <param name="paintContext">
		/// The paint context to use for painting this node.
		/// </param>
		protected override void Paint(PPaintContext paintContext) {
			Brush b = Brush;
			if (b != null) {
				Graphics g = paintContext.Graphics;
				g.FillPath(b, this.PathReference);
			}
			TEMP_REGION.MakeInfinite();
			TEMP_REGION.Intersect(PathReference);
			paintContext.PushClip(TEMP_REGION);
		}
Exemplo n.º 17
0
			protected override void Paint(PPaintContext paintContext) {
				base.Paint (paintContext);

				Graphics g = paintContext.Graphics;
				if (hilite) {
					g.DrawRectangle(Pens.Red, X, Y, Width, Height);
					if (Tag != null) {
						g.DrawString(((int)Tag).ToString(), font, Brushes.Black, Bounds.Right-60, Bounds.Bottom-55);
					}
				}
			}
Exemplo n.º 18
0
		/// <summary>
		/// This method is called just after the Piccolo scene graph is painted.
		/// </summary>
		/// <param name="paintContext">The paint context used to paint the scene graph.</param>
		public static void EndProcessingOutput(PPaintContext paintContext) {
			processOutputTime += (PUtil.CurrentTimeMillis - startProcessingOutputTime);
			framesProcessed++;
			
			if (PDebug.debugPrintFrameRate) {
				if (framesProcessed % printResultsFrameRate == 0) {
					System.Console.WriteLine("Process output frame rate: " + OutputFPS + " fps");
					System.Console.WriteLine("Process input frame rate: " + InputFPS + " fps");
					System.Console.WriteLine("Total frame rate: " + TotalFPS + " fps");
					System.Console.WriteLine();
					ResetFPSTiming();				
				}
			}
		
			if (PDebug.debugPrintUsedMemory) {
				if (framesProcessed % printResultsFrameRate == 0) { 		
					System.Console.WriteLine("Approximate used memory: " + ApproximateUsedMemory / 1024 + " k");
				}
			}
		
			if (PDebug.debugRegionManagement) {
				paintContext.PaintClipRegion(new SolidBrush(DebugPaintColor));
			}

			processingOutput = false;
		}
Exemplo n.º 19
0
		/// <summary>
		/// Overridden.  Does fast rendering when possible.
		/// </summary>
		public override void FullPaint(PPaintContext paintContext) {
			if (imageAnimate) {
				RectangleF fRef = FullBounds;
				RectangleF viewBounds = ViewBounds;
				float scale = FullBounds.Width/imageAnimateBounds.Width;
				float xOffset = (viewBounds.X-imageAnimateBounds.X)*scale;
				float yOffset = (viewBounds.Y-imageAnimateBounds.Y)*scale;
				float scaleW = viewBounds.Width*scale;
				float scaleH = viewBounds.Height*scale;

				RectangleF destRect = new RectangleF(0,0,(int)Math.Ceiling(fRef.Width),(int)Math.Ceiling(fRef.Height));
				RectangleF srcRect = new RectangleF((int)Math.Floor(xOffset),(int)Math.Floor(yOffset),(int)Math.Ceiling(xOffset+scaleW),(int)Math.Ceiling(yOffset+scaleH));
				paintContext.Graphics.DrawImage(paintBuffer, destRect, srcRect, GraphicsUnit.Pixel);
			}
			else {
				base.FullPaint(paintContext);
			}			
		}
Exemplo n.º 20
0
 protected override void Paint(PPaintContext paintContext)
 {
     paintContext.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
     if (shadowRendering && base.Text != null && base.TextBrush != null && base.Font != null)
     {
         Graphics g = paintContext.Graphics;
         float renderedFontSize = base.Font.SizeInPoints * paintContext.Scale;
         if(paintContext.Scale >= 1)
             if (renderedFontSize >= PUtil.GreekThreshold && renderedFontSize < PUtil.MaxFontSize)
             {
                 RectangleF shadowbounds = new RectangleF();
                 shadowbounds = Bounds;
                 shadowbounds.Offset(1, 1);
                 StringFormat stringformat = new StringFormat();
                 stringformat.Alignment = base.TextAlignment;
                 g.DrawString(base.Text, base.Font, black, shadowbounds, stringformat);
             }
     }
     base.Paint(paintContext);
 }
Exemplo n.º 21
0
		/// <summary>
		/// Paints the piccolo hierarchy.
		/// </summary>
		/// <remarks>
		/// Subclasses that add painting code should override this method rather than
		/// <see cref="PCanvas.OnPaint">PCanvas.OnPaint</see> to ensure that any extra processing
		/// will be included in the output frame rate calculation.
		/// </remarks>
		/// <param name="paintContext">The paint context to use for painting piccolo.</param>
		protected virtual void PaintPiccolo(PPaintContext paintContext) {
			// create new paint context and set render quality to lowest common 
			// denominator render quality.
			if (Interacting || Animating) {
				if (interactingRenderQuality < animatingRenderQuality) {
					paintContext.RenderQuality = interactingRenderQuality;
				} else {
					paintContext.RenderQuality = animatingRenderQuality;
				}
			} else {
				paintContext.RenderQuality = defaultRenderQuality;
			}

			// paint 
			camera.FullPaint(paintContext);

			// if switched state from animating to not animating invalidate the entire
			// screen so that it will be drawn with the default instead of animating 
			// render quality.
			if (!Animating && animatingOnLastPaint) {
				Invalidate();
			}
			animatingOnLastPaint = Animating;
		}
Exemplo n.º 22
0
		/// <summary>
		/// Constructs a new PPaintContext.
		/// </summary>
		/// <param name="graphics">
		/// The graphics context to associate with this paint context.
		/// </param>
		/// <param name="canvas">The canvas that the paint context will render on.</param>
		public PPaintContext(Graphics graphics, PCanvas canvas) {
			this.graphics = graphics;
			this.canvas = canvas;
			clipStack = new Stack();
			localClipStack = new Stack();
			cameraStack = new Stack();
			transformStack = new Stack();
			RenderQuality = RenderQuality.HighQuality;
			CURRENT_PAINT_CONTEXT = this;

			InitializeStacks();
		}
Exemplo n.º 23
0
		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			// Only paint the node if the brush is not null.
			if (Brush != null) {
				Device device = (paintContext as P3PaintContext).Device;
				if (device != null) {
					device.SetStreamSource(0, GetValidVertexBuffer(device), 0);
					device.VertexFormat = CustomVertex.PositionColored.Format;
					device.DrawPrimitives(PrimitiveType.TriangleList, VERTEX_INDEX, 2);
				}
			}
		}
Exemplo n.º 24
0
		/// <summary>
		/// Paint this node behind any of its children nodes.
		/// </summary>
		/// <param name="paintContext">The paint context to use for painting this node.</param>
		/// <remarks>
		/// <b>Notes to Inheritors:</b>  Subclasses that define a different appearance should
		/// override this method and paint themselves there.
		/// </remarks>
		protected virtual void Paint(PPaintContext paintContext) {
			if (Brush != null) {
				Graphics g = paintContext.Graphics;
				g.FillRectangle(Brush, Bounds);
			}
		}
Exemplo n.º 25
0
			protected override void Paint(PPaintContext paintContext) {
				if (fIsPressed) {
					Graphics g = paintContext.Graphics;
					g.FillRectangle(this.Brush, this.Bounds);
				}
				else {
					base.Paint(paintContext);
				}
			}
Exemplo n.º 26
0
		/// <summary>
		/// Subclasses that wish to do additional painting after their children
		/// are painted should override this method and do that painting here.
		/// </summary>
		/// <param name="paintContext">
		/// The paint context to use for painting after the children are painted.
		/// </param>
		protected virtual void PaintAfterChildren(PPaintContext paintContext) {
		}
Exemplo n.º 27
0
			protected override void Paint(PPaintContext paintContext) {
				float bx = X;
				float by = Y;
				float rightBorder = bx + Width;
				float bottomBorder = by + Height;
				
				GraphicsPath line = new GraphicsPath();
				Graphics g = paintContext.Graphics;				
				Pen pen = new Pen(this.Brush, 0);

				// draw vertical lines
				for (float x = bx; x < rightBorder; x += 5) {
					line.Reset();
					line.AddLine(x, by, x, bottomBorder);
					g.DrawPath(pen, line);
				}
				
				for (float y = by; y < bottomBorder; y += 5) {
					line.Reset();
					line.AddLine(bx, y, rightBorder, y);
					g.DrawPath(pen, line);
				}
			}
Exemplo n.º 28
0
		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			Graphics g = paintContext.Graphics;

			float x = X;
			float y = Y;
			float width = Width;
			float height = Height;
			float[] elements = g.Transform.Elements;
			float magX = elements[0];
			float magY = elements[3];
			float dx = (float)(1.0 / magX);
			float dy = (float)(1.0 / magY);

			g.FillRectangle(Brush, Bounds);

			path.Reset();
			path.AddLine((float)(x+width), (float)y, (float)x, (float)y);
			path.AddLine((float)x, (float)y, (float)x, (float)(y+height));
			pen.Color = topLeftOuterColor;
			g.DrawPath(pen, path);

			path.Reset();
			path.AddLine((float)(x+width), (float)(y+dy), (float)(x+dx), (float)(y+dy));
			path.AddLine((float)(x+dx), (float)(y+dy), (float)(x+dx), (float)(y+height));
			pen.Color = topLeftInnerColor;
			g.DrawPath(pen, path);

			path.Reset();
			path.AddLine((float)(x+width), (float)(y), (float)(x+width), (float)(y+height));
			path.AddLine((float)(x+width), (float)(y+height), (float)(x), (float)(y+height));
			pen.Color = bottomRightOuterColor;
			g.DrawPath(pen, path);

			path.Reset();
			path.AddLine((float)(x+width-dx), (float)(y+dy), (float)(x+width-dx), (float)(y+height-dy));
			path.AddLine((float)(x+width-dx), (float)(y+height-dy), (float)(x), (float)(y+height-dy));
			pen.Color = bottomRightInnerColor;
			g.DrawPath(pen, path);
		}
Exemplo n.º 29
0
        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            if (image != null)
            {
                RectangleF b = Bounds;
                System.Drawing.Graphics g = paintContext.Graphics;

                g.DrawImage((Image)image.Clone(), b);
                if (this is PPathwaySystem)
                    base.Paint(paintContext);
            }
            else
            {
                base.Paint(paintContext);
            }
        }
Exemplo n.º 30
0
		protected override void Paint(PPaintContext paintContext) {
			if (Brush != null) {
				Graphics g = paintContext.Graphics;

				RectangleF bounds = UnionOfChildrenBounds;
				bounds = new RectangleF(bounds.X-INDENT,bounds.Y-INDENT,bounds.Width+2*INDENT,bounds.Height+2*INDENT);
				g.FillRectangle(Brush, bounds);
			}
		}
Exemplo n.º 31
0
		//****************************************************************
		// Painting - Methods for painting a PPath.
		//****************************************************************

		/// <summary>
		/// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			Brush b = this.Brush;
			Graphics g = paintContext.Graphics;

			if (b != null) {
				g.FillPath(b, path);
			}

			if (pen != null) {
				g.DrawPath(pen, path);
			}
		}
Exemplo n.º 32
0
		/// <summary>
		/// Overridden.  See <see cref="PCamera.Paint">PCamera.Paint</see>.
		/// </summary>
		protected override void Paint(PPaintContext paintContext) {
			if (Brush != null) {
				Device device = (paintContext as P3PaintContext).Device;
				device.SetStreamSource(0, GetValidVertexBuffer(device), 0);
				device.VertexFormat = CustomVertex.PositionColored.Format;
				device.DrawPrimitives(PrimitiveType.TriangleList, VERTEX_INDEX, 2);
			}
			PaintTransformedView(paintContext);
		}
Exemplo n.º 33
0
		/// <summary>
		/// Overridden.  Paints the cached image representation of this node's children if
		/// it is not currently being created.
		/// </summary>
		/// <param name="paintContext"></param>
		public override void FullPaint(PPaintContext paintContext) {
			if (validatingCache) {
				base.FullPaint (paintContext);
			} else {
				Graphics g = paintContext.Graphics;
				g.DrawImage(ImageCache, (int) X, (int) Y);
			}
		}
Exemplo n.º 34
0
		/// <summary>
		/// Overridden.  See <see cref="PCamera.PaintDebugFullBounds">PaintDebugFullBounds</see>.
		/// </summary>
		protected override void PaintDebugFullBounds(PPaintContext paintContext, Brush fullBoundsBrush, RectangleF nodeBounds) {
			Device device = (paintContext as P3PaintContext).Device;
			CustomVertex.PositionColored[] colVerts = new CustomVertex.PositionColored[VERTEX_COUNT];
			P3Util.CreateColoredRectangle(colVerts, 0, nodeBounds, (fullBoundsBrush as SolidBrush).Color.ToArgb());
			device.VertexFormat = CustomVertex.PositionColored.Format;
			device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, colVerts);
		}
Exemplo n.º 35
0
		protected override void Paint(PPaintContext paintContext) {
			base.Paint (paintContext);
			ControlPaint.DrawButton(paintContext.Graphics, (int)X, (int)Y, (int)Width, (int)Height, ButtonState.Normal);
		}