當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。