当前位置: 首页>>代码示例>>C#>>正文


C# RenderMode类代码示例

本文整理汇总了C#中RenderMode的典型用法代码示例。如果您正苦于以下问题:C# RenderMode类的具体用法?C# RenderMode怎么用?C# RenderMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RenderMode类属于命名空间,在下文中一共展示了RenderMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

        public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
        {
            Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

            if (applyRect.Width == 0 || applyRect.Height == 0)
            {
                // nothing to do
                return;
            }
            GraphicsState state = graphics.Save();
            if (Invert)
            {
                graphics.SetClip(applyRect);
                graphics.ExcludeClip(rect);
            }
            ColorMatrix grayscaleMatrix = new ColorMatrix(new[] {
                new[] {.3f, .3f, .3f, 0, 0},
                new[] {.59f, .59f, .59f, 0, 0},
                new[] {.11f, .11f, .11f, 0, 0},
                new float[] {0, 0, 0, 1, 0},
                new float[] {0, 0, 0, 0, 1}
            });
            using (ImageAttributes ia = new ImageAttributes())
            {
                ia.SetColorMatrix(grayscaleMatrix);
                graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
            }
            graphics.Restore(state);
        }
开发者ID:Grifs99,项目名称:ShareX,代码行数:29,代码来源:GrayscaleFilter.cs

示例2: Apply

		/// <summary>
		/// Implements the Apply code for the Brightness Filet
		/// </summary>
		/// <param name="graphics"></param>
		/// <param name="applyBitmap"></param>
		/// <param name="rect"></param>
		/// <param name="renderMode"></param>
		public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode) {
			Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

			if (applyRect.Width == 0 || applyRect.Height == 0) {
				// nothing to do
				return;
			}
			GraphicsState state = graphics.Save();
			if (Invert) {
				graphics.SetClip(applyRect);
				graphics.ExcludeClip(rect);
			}
			using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect)) {
				Color highlightColor = GetFieldValueAsColor(FieldType.FILL_COLOR);
				for (int y = fastBitmap.Top; y < fastBitmap.Bottom; y++) {
					for (int x = fastBitmap.Left; x < fastBitmap.Right; x++) {
						Color color = fastBitmap.GetColorAt(x, y);
						color = Color.FromArgb(color.A, Math.Min(highlightColor.R, color.R), Math.Min(highlightColor.G, color.G), Math.Min(highlightColor.B, color.B));
						fastBitmap.SetColorAt(x, y, color);
					}
				}
				fastBitmap.DrawTo(graphics, applyRect.Location);
			}
			graphics.Restore(state);
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:32,代码来源:HighlightFilter.cs

示例3: Apply

        public override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
        {
            Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);

            if (applyRect.Width == 0 || applyRect.Height == 0)
            {
                // nothing to do
                return;
            }
            int magnificationFactor = GetFieldValueAsInt(FieldType.MAGNIFICATION_FACTOR);
            GraphicsState state = graphics.Save();
            if (Invert)
            {
                graphics.SetClip(applyRect);
                graphics.ExcludeClip(rect);
            }
            graphics.SmoothingMode = SmoothingMode.None;
            graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.PixelOffsetMode = PixelOffsetMode.None;
            int halfWidth = rect.Width / 2;
            int halfHeight = rect.Height / 2;
            int newWidth = rect.Width / magnificationFactor;
            int newHeight = rect.Height / magnificationFactor;
            Rectangle source = new Rectangle(rect.X + halfWidth - (newWidth / 2), rect.Y + halfHeight - (newHeight / 2), newWidth, newHeight);
            graphics.DrawImage(applyBitmap, rect, source, GraphicsUnit.Pixel);
            graphics.Restore(state);
        }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:28,代码来源:MagnifierFilter.cs

示例4: InitShader

        void IRenderable.Render(OpenGL gl, RenderMode renderMode)
        {
            if (positionBuffer != null && colorBuffer != null && radiusBuffer != null)
            {
                if (this.shaderProgram == null)
                {
                    this.shaderProgram = InitShader(gl, renderMode);
                }
                if (this.vertexArrayObject == null)
                {
                    CreateVertexArrayObject(gl, renderMode);
                }

                BeforeRendering(gl, renderMode);

                if (this.RenderGrid && this.vertexArrayObject != null)
                {
                    gl.Enable(OpenGL.GL_BLEND);
                    gl.BlendFunc(SharpGL.Enumerations.BlendingSourceFactor.SourceAlpha, SharpGL.Enumerations.BlendingDestinationFactor.OneMinusSourceAlpha);

                    gl.BindVertexArray(this.vertexArrayObject[0]);
                    gl.DrawArrays(OpenGL.GL_POINTS, 0, count);
                    gl.BindVertexArray(0);

                    gl.Disable(OpenGL.GL_BLEND);
                }

                AfterRendering(gl, renderMode);
            }
        }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:30,代码来源:PointGrid.cs

示例5: Render

        /// <summary>
        /// Render to the provided instance of OpenGL.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        /// <param name="renderMode">The render mode.</param>
        public override void Render(OpenGL gl, RenderMode renderMode)
        {
            //	Create the evaluator.
            gl.Map1(OpenGL.GL_MAP1_VERTEX_3,//	Use and produce 3D points.
                0,								//	Low order value of 'u'.
                1,								//	High order value of 'u'.
                3,								//	Size (bytes) of a control point.
                ControlPoints.Width,			//	Order (i.e degree plus one).
                ControlPoints.ToFloatArray());	//	The control points.

            //	Enable the type of evaluator we wish to use.
            gl.Enable(OpenGL.GL_MAP1_VERTEX_3);

            //	Beging drawing a line strip.
            gl.Begin(OpenGL.GL_LINE_STRIP);

            //	Now draw it.
            for (int i = 0; i <= segments; i++)
                gl.EvalCoord1((float)i / segments);

            gl.End();

            //	Draw the control points.
            ControlPoints.Draw(gl, DrawControlPoints, DrawControlGrid);
        }
开发者ID:hhool,项目名称:sharpgl,代码行数:30,代码来源:Evaluator1D.cs

示例6: Init

 public void Init(RenderMode renderMode)
 {
     if (renderMode == RenderMode.Render2D)
     {
         GL.MatrixMode(MatrixMode.Projection);
         var aspectRatio = (float)form.ClientSize.Width / form.ClientSize.Height;
         GL.LoadIdentity();
         GL.Scale(1, aspectRatio, 1);
         GL.MatrixMode(MatrixMode.Modelview);
     }
     else
     {
         GL.Enable(EnableCap.DepthTest);
         GL.ShadeModel(ShadingModel.Smooth);
         GL.Enable(EnableCap.Lighting);
         GL.Light(LightName.Light0, LightParameter.Ambient, new[] { .2f, .2f, .2f, 1.0f });
         GL.Light(LightName.Light0, LightParameter.Diffuse, new[] { 1, 1, 1, 1.0f });
         GL.Light(LightName.Light0, LightParameter.Position,
             new[] { Common.LightPosition.x, Common.LightPosition.y, Common.LightPosition.z });
         GL.Enable(EnableCap.Light0);
         GL.MatrixMode(MatrixMode.Projection);
         Common.ProjectionMatrix = Matrix4.CreatePerspectiveFieldOfView(Common.FieldOfView,
             form.ClientSize.Width / (float)form.ClientSize.Height, Common.NearPlane, Common.FarPlane);
         GL.LoadMatrix(ref Common.ProjectionMatrix);
         GL.MatrixMode(MatrixMode.Modelview);
         Common.ViewMatrix = Matrix4.LookAt(Common.CameraPosition.x, Common.CameraPosition.y,
             Common.CameraPosition.z, 0, 0, 4, 0, 0, 1);
         GL.LoadMatrix(ref Common.ViewMatrix);
     }
 }
开发者ID:BenjaminNitschke,项目名称:PhysicsCourse,代码行数:30,代码来源:OpenGLGraphics.cs

示例7: GetCanvas

		public static Canvas GetCanvas(RenderMode renderMode) {
			Canvas canvas = null;

			Canvas[] sceneCanvases = GameObject.FindObjectsOfType<Canvas>();
			for (int i = 0; i < sceneCanvases.Length; i++) {
				if (sceneCanvases[i].renderMode == renderMode) {
					canvas = sceneCanvases[i];
					break;
				}
			}

			if (canvas == null) {
				GameObject canvasGO = new GameObject("Canvas");
				canvasGO.layer = LayerMask.NameToLayer("UI");
				canvasGO.AddComponent<GraphicRaycaster>();
				canvas = canvasGO.GetComponent<Canvas>();
				canvas.renderMode = renderMode;

				if (GameObject.FindObjectOfType<EventSystem>() == null) {
					GameObject eventSystemGO = new GameObject("EventSystem");
					eventSystemGO.AddComponent<EventSystem>();
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IPHONE)
					eventSystemGO.AddComponent<TouchInputModule>();
#else
					eventSystemGO.AddComponent<StandaloneInputModule>();
#endif
				}
			}

			return canvas;
		}
开发者ID:UpdateShu,项目名称:ForceFury_Unity5,代码行数:31,代码来源:Utils.cs

示例8: ActivityButton

 public ActivityButton()
 {
     this.Image = new Uri("pack://application:,,,/Images/activity.PNG");
     this.Text = "Default";
     this.RenderMode = RenderMode.ImageAndText;
     this.VerticalAlignment = System.Windows.VerticalAlignment.Center;
 }
开发者ID:madebysoren,项目名称:NooSphere,代码行数:7,代码来源:ActivityButton.cs

示例9: Draw

		public override void Draw(Graphics graphics, RenderMode rm) {
			int lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);
			Color lineColor = GetFieldValueAsColor(FieldType.LINE_COLOR);
			bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
			bool lineVisible = (lineThickness > 0 && Colors.IsVisible(lineColor));
			if (lineVisible) {
				graphics.SmoothingMode = SmoothingMode.HighSpeed;
				graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
				graphics.CompositingQuality = CompositingQuality.HighQuality;
				graphics.PixelOffsetMode = PixelOffsetMode.None;
				//draw shadow first
				if (shadow) {
					int basealpha = 100;
					int alpha = basealpha;
					int steps = 5;
					int currentStep = lineVisible ? 1 : 0;
					while (currentStep <= steps) {
						using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100), lineThickness)) {
							Rectangle shadowRect = GuiRectangle.GetGuiRectangle(Left + currentStep, Top + currentStep, Width, Height);
							graphics.DrawRectangle(shadowPen, shadowRect);
							currentStep++;
							alpha = alpha - (basealpha / steps);
						}
					}
				}
				Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
				if (lineThickness > 0) {
					using (Pen pen = new Pen(lineColor, lineThickness)) {
						graphics.DrawRectangle(pen, rect);
					}
				}
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:33,代码来源:FilterContainer.cs

示例10: Generate

        private static void Generate(string xamlFile, string outputFile, RenderMode renderMode, string desiredNamespace, string defaultAssembly)
        {
            string xaml = string.Empty;
            using (TextReader tr = File.OpenText(xamlFile))
            {
                xaml = tr.ReadToEnd();
            }

            if (!string.IsNullOrEmpty(defaultAssembly))
                xaml = Regex.Replace(xaml,
                    @"xmlns(:\w+)?=\""clr-namespace:([.\w]+)(;assembly=)?\""",
                    [email protected]"xmlns$1=""clr-namespace:$2;assembly=" + defaultAssembly + '"');

            UserInterfaceGenerator generator = new UserInterfaceGenerator();
            string generatedCode = string.Empty;
            try
            {
                generatedCode = generator.GenerateCode(xamlFile, xaml, renderMode, desiredNamespace);
            }
            catch (Exception ex)
            {
                generatedCode = "#error " + ex.Message;
                throw;
            }
            finally
            {
                using (StreamWriter outfile = new StreamWriter(outputFile))
                {
                    outfile.Write(generatedCode);
                }
            }
            }
开发者ID:aravol,项目名称:UI_Generator,代码行数:32,代码来源:Program.cs

示例11: Draw

 public override void Draw(Graphics g, RenderMode rm)
 {
     Rectangle rect = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height);
     g.FillRectangle(GetBrush(rect), rect);
     Pen pen = new Pen(foreColor) { Width = thickness };
     g.DrawRectangle(pen, rect);
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:7,代码来源:RectangleContainer.cs

示例12: Tile

      public Tile(Image image, TileCoordinate tile, RenderMode mode)
      {
         this.tile = tile;
         if(image != null)
         {
            this.mode = mode;

            switch(mode)
            {
               case RenderMode.GDI:
               {
                  using(Bitmap bitmap = new Bitmap(image))
                  {
                     this.ptrHbitmap = bitmap.GetHbitmap();
                  }
               }
               break;

               case RenderMode.GDI_PLUS:
               {
                  this.image = image;
               }
               break;
            }
         }
      }
开发者ID:gipasoft,项目名称:Sfera,代码行数:26,代码来源:Tile.cs

示例13: Apply

 public unsafe override void Apply(Graphics graphics, Bitmap applyBitmap, Rectangle rect, RenderMode renderMode)
 {
     int blurRadius = GetFieldValueAsInt(FieldType.BLUR_RADIUS);
     double previewQuality = GetFieldValueAsDouble(FieldType.PREVIEW_QUALITY);
     Rectangle applyRect = ImageHelper.CreateIntersectRectangle(applyBitmap.Size, rect, Invert);
     if (applyRect.Width == 0 || applyRect.Height == 0)
     {
         return;
     }
     GraphicsState state = graphics.Save();
     if (Invert)
     {
         graphics.SetClip(applyRect);
         graphics.ExcludeClip(rect);
     }
     if (GDIplus.IsBlurPossible(blurRadius))
     {
         GDIplus.DrawWithBlur(graphics, applyBitmap, applyRect, null, null, blurRadius, false);
     }
     else
     {
         using (IFastBitmap fastBitmap = FastBitmap.CreateCloneOf(applyBitmap, applyRect))
         {
             ImageHelper.ApplyBoxBlur(fastBitmap, blurRadius);
             fastBitmap.DrawTo(graphics, applyRect);
         }
     }
     graphics.Restore(state);
     return;
 }
开发者ID:Edison6351,项目名称:ShareX,代码行数:30,代码来源:BlurFilter.cs

示例14: DrawEllipse

		/// <summary>
		/// This allows another container to draw an ellipse
		/// </summary>
		/// <param name="caller"></param>
		/// <param name="graphics"></param>
		/// <param name="renderMode"></param>
		public static void DrawEllipse(Rectangle rect, Graphics graphics, RenderMode renderMode, int lineThickness, Color lineColor, Color fillColor, bool shadow) {

			bool lineVisible = (lineThickness > 0 && Colors.IsVisible(lineColor));
			// draw shadow before anything else
			if (shadow && (lineVisible || Colors.IsVisible(fillColor))) {
				int basealpha = 100;
				int alpha = basealpha;
				int steps = 5;
				int currentStep = lineVisible ? 1 : 0;
				while (currentStep <= steps) {
					using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) {
						shadowPen.Width = lineVisible ? lineThickness : 1;
						Rectangle shadowRect = GuiRectangle.GetGuiRectangle(rect.Left + currentStep, rect.Top + currentStep, rect.Width, rect.Height);
						graphics.DrawEllipse(shadowPen, shadowRect);
						currentStep++;
						alpha = alpha - basealpha / steps;
					}
				}
			}
			//draw the original shape
			if (Colors.IsVisible(fillColor)) {
				using (Brush brush = new SolidBrush(fillColor)) {
					graphics.FillEllipse(brush, rect);
				}
			}
			if (lineVisible) {
				using (Pen pen = new Pen(lineColor, lineThickness)) {
					graphics.DrawEllipse(pen, rect);
				}
			}
		}
开发者ID:logtcn,项目名称:greenshot,代码行数:37,代码来源:EllipseContainer.cs

示例15: Draw

 public override void Draw(Graphics g, RenderMode rm)
 {
     g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
     Rectangle rect = GuiRectangle.GetGuiRectangle(this.Left, this.Top, this.Width, this.Height);
     if (Selected && rm.Equals(RenderMode.EDIT)) DrawSelectionBorder(g, rect);
     Brush fontBrush = new SolidBrush(foreColor);
     g.DrawString(childLabel.Text, childLabel.Font, fontBrush, rect);
 }
开发者ID:modulexcite,项目名称:ZScreen_Google_Code,代码行数:8,代码来源:TextContainer.cs


注:本文中的RenderMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。