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


C# Color.ToColor4方法代码示例

本文整理汇总了C#中Color.ToColor4方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToColor4方法的具体用法?C# Color.ToColor4怎么用?C# Color.ToColor4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Color的用法示例。


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

示例1: ShouldConvertToColor4

 public void ShouldConvertToColor4()
 {
     var color = new Color(0.1f, 0.2f, 0.3f, 0.4f);
     var color4 = color.ToColor4();
     Assert.AreEqual(color.R, color4.R, "Red component mismatch!");
     Assert.AreEqual(color.G, color4.G, "Green component mismatch!");
     Assert.AreEqual(color.B, color4.B, "Blue component mismatch!");
     Assert.AreEqual(color.A, color4.A, "Alpha component mismatch!");
 }
开发者ID:remy22,项目名称:TriEngine,代码行数:9,代码来源:ColorTests.cs

示例2: ShouldReturnValidArgbValue

 public void ShouldReturnValidArgbValue()
 {
     var color = new Color(0.1f, 0.2f, 0.3f, 0.4f);
     var color4 = color.ToColor4();
     var argb = color4.ToArgb();
     var expected =
         (uint) (color4.A * byte.MaxValue) << 24 |
         (uint) (color4.R * byte.MaxValue) << 16 |
         (uint) (color4.G * byte.MaxValue) << 8 |
         (uint) (color4.B * byte.MaxValue);
     Assert.AreEqual(unchecked((int) expected), argb);
 }
开发者ID:remy22,项目名称:TriEngine,代码行数:12,代码来源:ColorTests.cs

示例3: DrawLine

		public void DrawLine(DVector3 pos0, DVector3 pos1, Color color)
		{
			lines.Add(new Gis.CartPoint {
				X = pos0.X,
				Y = pos0.Y,
				Z = pos0.Z,
				Tex0	= Vector4.Zero,
				Color	= color.ToColor4()
			});
			lines.Add(new Gis.CartPoint {
				X = pos1.X,
				Y = pos1.Y,
				Z = pos1.Z,
				Tex0	= Vector4.Zero,
				Color	= color.ToColor4()
			});

			isDirty = true;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:19,代码来源:DebugGisLayer.cs

示例4: VertexPosColTex

 public VertexPosColTex(Vector4 position, Color color, TextureCoordinate textureCoordinate)
     : this(position, color.ToColor4(), textureCoordinate)
 {
 }
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:4,代码来源:VertexPosColTex.cs

示例5: Clear

 public override void Clear(Color color)
 {
     _renderTarget.Clear(color.ToColor4());
     TextBackgroundColor = color;
 }
开发者ID:filipkunc,项目名称:GLGraphics,代码行数:5,代码来源:D2DGraphics.cs

示例6: SetClipRectangle

		/// <summary>
		/// 
		/// </summary>
		/// <param name="index"></param>
		/// <param name="rectangle"></param>
		public void SetClipRectangle ( int index, Rectangle rectangle, Color color )
		{
			if (index<0 || index>=MaxSpriteFrames) {
				throw new ArgumentOutOfRangeException("index", "must be greater or equal to zero and less than MaxClipRectangles (" + MaxSpriteFrames.ToString() + ")");
			}

			var rect	=	new RectangleF( rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height );
			var color4	=	color.ToColor4();
			
			framesData[ index ] = new SpriteFrame( rect, color4 );

			dirty	=	true;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:18,代码来源:SpriteLayer.cs

示例7: InitPlotter

        private void InitPlotter(Vector.FxVectorF vec, PlotType plotType, Color color)
        {
            // init the lists
            listPlotsGeometry = new List<PlotGeometry>();

            // set the position and the size of the element
            this.Position = new Vector.FxVector2f(0);
            this.Size = new Vector.FxVector2f(750, 500);

            // add the vector to the list
            PlotGeometry plot = new PlotGeometry();
            plot.OrigVectorY = vec;
            plot.Color = color.ToColor4();
            plot.Type = plotType;
            plot.StepType = XStepType.ZeroToMax;

            // add the plot to the list
            listPlotsGeometry.Add(plot);

            // set the origin position
            {
                float max = vec.Max();
                float min = vec.Min();
                float orig_y = Size.Y / 2;
                if(max >0 && min<0)
                {
                    orig_y = Size.Y * (min / (max - min));
                }

                if(max >0 && min >= 0)
                {
                    orig_y = -min;
                }

                if(max <=0 && min <0)
                {
                    orig_y = Size.Y + max;
                }
                OriginPosition = new Vector.FxVector2f(5, orig_y);
            }

            // allocate scale
            _scale = new Vector.FxVector2f(1.0f);

            // fit the plots to the view
            FitPlots();

            // set the x_step base on the size of vec and the width
            X_Space = this.Size.x / vec.Size;

            // init format
            _TextFormat = new TextElementFormat();
            _TextFormat.familyName = "Calibri";
            _TextFormat.weight = SharpDX.DirectWrite.FontWeight.Black;
            _TextFormat.fontStyle = SharpDX.DirectWrite.FontStyle.Normal;
            _TextFormat.fontStretch = SharpDX.DirectWrite.FontStretch.Normal;
            _TextFormat.fontSize = 8.0f;

            // init toolstrip
            InitToolStrips();
        }
开发者ID:fxbit,项目名称:FxMath,代码行数:61,代码来源:PloterElement.cs


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