Esempio n. 1
0
		/// <summary>
		/// This method is called when the render quality is set to high.
		/// </summary>
		/// <param name="graphics">
		/// The graphics context associated with this paint context.
		/// </param>
		/// <param name="canvas">The canvas that this paint context will render on.</param>
		/// <remarks>
		/// Override this method to change how the high render quality is set.
		/// </remarks>
		protected virtual void OnHighRenderQuality(Graphics graphics, PCanvas canvas) {
			// Set default high quality flags.
			graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
			graphics.SmoothingMode = SmoothingMode.HighQuality;
			graphics.TextRenderingHint = GridFitText ? TextRenderingHint.AntiAliasGridFit :
				TextRenderingHint.AntiAlias;
			graphics.CompositingQuality = CompositingQuality.HighQuality;
			graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

			// Notify the canvas.
			if (canvas != null && canvas.HighRenderQuality != null) {
				canvas.HighRenderQuality(graphics);
			}
		}
Esempio n. 2
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();
		}
Esempio n. 3
0
		/// <summary>
		/// This method is called when the render quality is set to low.
		/// </summary>
		/// <param name="graphics">
		/// The graphics context associated with this paint context.
		/// </param>
		/// <param name="canvas">The canvas that this paint context will render on.</param>
		/// <remarks>
		/// Override this method to change how the low render quality is set.
		/// </remarks>
		protected virtual void OnLowRenderQuality(Graphics graphics, PCanvas canvas) {
			// Set default low quality flags.
			graphics.InterpolationMode = InterpolationMode.Low;
			graphics.SmoothingMode = SmoothingMode.HighSpeed;
			graphics.TextRenderingHint = GridFitText ? TextRenderingHint.SingleBitPerPixelGridFit
				: TextRenderingHint.SingleBitPerPixel;
			graphics.CompositingQuality = CompositingQuality.HighSpeed;
			graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;

			// Notify the canvas.
			if (canvas != null && canvas.LowRenderQuality != null) {
				canvas.LowRenderQuality(graphics);
			}
		}
Esempio n. 4
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(Graphics2D graphics, PCanvas canvas)
        {
            this.graphics = graphics;
            this.canvas = canvas;
            clipStack = new Stack();
            localClipStack = new Stack();
            cameraStack = new Stack();
            transformStack = new Stack();
            RenderQuality = RenderQuality.HighQuality;

            Region clip = graphics.Clip;
            if (clip.IsInfinite(graphics.Graphics)) {
                clip = new Region(
                    new Rectangle(-int.MaxValue / 2,
                    -int.MaxValue / 2,
                    int.MinValue,
                    int.MaxValue));
                graphics.Clip = clip;
            }

            localClipStack.Push(graphics.ClipBounds);
            CURRENT_PAINT_CONTEXT = this;
        }