• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RenderMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Draw

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


示例17: 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 virtual void Render(OpenGL gl, RenderMode renderMode)
 {
     //	Set the quadric properties.
     gl.QuadricDrawStyle(glQuadric, (uint)drawStyle);
     gl.QuadricOrientation(glQuadric, (int)orientation);
     gl.QuadricNormals(glQuadric, (uint)normals);
     gl.QuadricTexture(glQuadric, textureCoords ? 1 : 0);
 }
开发者ID:cvanherk,项目名称:3d-engine,代码行数:13,代码来源:Quadric.cs


示例18: 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)
        {
            //  Call the base.
            base.Render(gl, renderMode);

            //	Draw a quadric with the current settings.
            gl.Cylinder(glQuadric, baseRadius, topRadius, height, slices, stacks);
        }
开发者ID:cvanherk,项目名称:3d-engine,代码行数:13,代码来源:Cylinder.cs


示例19: 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)
        {
            //  Call the base.
            base.Render(gl, renderMode);

            //	Draw a sphere with the current settings.
            gl.Sphere(glQuadric, radius, slices, stacks);
        }
开发者ID:hhool,项目名称:sharpgl,代码行数:13,代码来源:Sphere.cs


示例20: Reset

		public override void Reset()
		{
			cursorTexture = null;
			hotSpot = new FsmVector2 { UseVariable = true };

			renderMode = RenderMode.Auto;
			lockMode = CurState.None;
			hideCursor = true;
		}
开发者ID:gumbomasta,项目名称:Off-Peak,代码行数:9,代码来源:SetCursorMode.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RenderOptions类代码示例发布时间:2022-05-24
下一篇:
C# RenderManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap