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


C# Color.ToArgb方法代码示例

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


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

示例1: DrawLine

        private void DrawLine(Vector3 from, Vector3 to, Color color)
        {
            var vertices = new List<PositionColored>();

            vertices.Add(new PositionColored(from, color.ToArgb()));
            vertices.Add(new PositionColored(to, color.ToArgb()));

            var buffer = vertices.ToArray();

            SetTarget(Vector3.Zero);

            D3D.Device.DrawUserPrimitives(PrimitiveType.LineStrip, vertices.Count - 1, buffer);
        }
开发者ID:alex-v-odesk,项目名称:IceFlake,代码行数:13,代码来源:DebugScript.cs

示例2: LinearGradientBrush

		public LinearGradientBrush (RectangleF rect, Color color1, Color color2, LinearGradientMode linearGradientMode)
		{
			Status status = GDIPlus.GdipCreateLineBrushFromRect (ref rect, color1.ToArgb (), color2.ToArgb (), linearGradientMode, WrapMode.Tile, out nativeObject);
			GDIPlus.CheckStatus (status);

			rectangle = rect;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:LinearGradientBrush.cs

示例3: DrawPixel

 public override void DrawPixel(int x, int y, Color color)
 {
     DX.DrawBox(
         x*pixelWidth, y*pixelHeight,
         x*pixelWidth + pixelWidth, y*pixelHeight + pixelHeight,
         color.ToArgb(), 1);
 }
开发者ID:oxyflour,项目名称:old-repos,代码行数:7,代码来源:canvas.cs

示例4: ShouldConvertToArgb

 public void ShouldConvertToArgb()
 {
     // 0xAARRGGBB
     const int val = 0x11223344;
     var color = new Color(val);
     var argb = color.ToArgb();
     Assert.AreEqual(val, argb);
 }
开发者ID:remy22,项目名称:TriEngine,代码行数:8,代码来源:ColorTests.cs

示例5: DrawRectangle

        public void DrawRectangle(float x, float y, float width, float height, Color color)
        {
            _device.Device.VertexFormat = CustomVertex.TransformedColored.Format;
            color = Color.Red;
            var vertex = new CustomVertex.TransformedColored[4];

            vertex[0].Position = new Vector4(x, y, 0f, 0f);
            vertex[0].Color = color.ToArgb();
            vertex[1].Position = new Vector4(x + width, y, 0f, 0f);
            vertex[1].Color = color.ToArgb();
            vertex[2].Position = new Vector4(x, y + height, 0f, 0f);
            vertex[2].Color = color.ToArgb();
            vertex[3].Position = new Vector4(x + width, y + height, 0f, 0f);
            vertex[3].Color = color.ToArgb();

            _device.Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, vertex);
        }
开发者ID:Rewtek,项目名称:GameLibrary,代码行数:17,代码来源:GemoetryRenderer.cs

示例6: FormatColourString

 public static string FormatColourString(Color colour, ColourRepresentations format)
 {
     switch (format)
     {
         case ColourRepresentations.RGB:
             return colour.R.ToString() + "," + colour.G.ToString() + "," + colour.B.ToString();
         case ColourRepresentations.Hex:
             return "#" + colour.ToArgb().ToString("X6");
         default:
             return colour.ToString();
     }
 }
开发者ID:tdwright,项目名称:ColourPickerComponents,代码行数:12,代码来源:ColourHandler.cs

示例7: NameAvailable

    public static bool NameAvailable(string name, ListBox colList, Color col)
    {
        //        foreach (ListItem li in colList.Items)
        //            if (li.Text == name)
        //                return false;

        if (colList.Items.FindByText(name) != null)
            return false;

        if (colList.Items.FindByValue(col.ToArgb().ToString()) !=  null)
            return false;

        return true;
    }
开发者ID:kbridgeman1,项目名称:CMPE2300,代码行数:14,代码来源:Processing.cs

示例8: SetPixel

 public static void SetPixel(this BitmapData bd, uint x, uint y, Color c)
 {
     bd.SetPixelInt(x, y, (uint)c.ToArgb());
 }
开发者ID:Jaex,项目名称:Terraria-API,代码行数:4,代码来源:BitmapDataEx.cs

示例9: SetWrapMode

		public void SetWrapMode (WrapMode mode, Color color, bool clamp)
		{
			Status status = GDIPlus.GdipSetImageAttributesWrapMode (nativeImageAttr, mode, color.ToArgb (), clamp);
    			GDIPlus.CheckStatus (status);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:ImageAttributes.cs

示例10: SetColorKey

		public void SetColorKey (Color colorLow, Color colorHigh, ColorAdjustType type)
		{
			Status status = GDIPlus.GdipSetImageAttributesColorKeys (nativeImageAttr, type, true, 
				colorLow.ToArgb (), colorHigh.ToArgb ());
			GDIPlus.CheckStatus (status);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:ImageAttributes.cs

示例11: SetFormatColor

            /// <summary>
            /// Establece el color de fuente actual.
            /// </summary>
            /// <param name="val">Color de la fuente.</param>
            public void SetFormatColor(Color val)
            {
                if (currentFormat.Color.ToArgb() != val.ToArgb())
                {
                    int indColor = colorTable.IndexOf(val);

                    if (indColor == -1)
                    {
                        colorTable.AddColor(val);
                        indColor = colorTable.IndexOf(val);
                    }

                    currentFormat.Color = val;
                    mainGroup.AppendChild(new RtfTreeNode(RtfNodeType.Keyword, "cf", true, indColor));
                }
            }
开发者ID:Bartizan,项目名称:nrtftree,代码行数:20,代码来源:RtfDocument.cs

示例12: AddColor

 /// <summary>
 /// Inserta un nuevo color en la tabla de colores.
 /// </summary>
 /// <param name="color">Nuevo color a insertar.</param>
 public void AddColor(Color color)
 {
     colors.Add(color.ToArgb());
 }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:8,代码来源:RtfColorTable.cs

示例13: DrawText

    /// <summary>
    /// Draw some text on the screen
    /// </summary>
    public void DrawText(float xpos, float ypos, Color color, string text, RenderFlags flags)
    {
        if (text == null)
            return;

        // Setup renderstate
        savedStateBlock.Capture();
        drawTextStateBlock.Apply();
        device.SetTexture(0, fontTexture);
        device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
        device.PixelShader = null;
        device.SetStreamSource(0, vertexBuffer, 0);

        // Set filter states
        if ((flags & RenderFlags.Filtered) != 0) {
            samplerState0.MinFilter = TextureFilter.Linear;
            samplerState0.MagFilter = TextureFilter.Linear;
        }

        // Adjust for character spacing
        xpos -= spacingPerChar;
        float fStartX = xpos;

        // Fill vertex buffer
        int iv = 0;
        int dwNumTriangles = 0;

        foreach (char c in text) {
            if (c == '\n') {
                xpos = fStartX;
                ypos += (textureCoords[0,3]-textureCoords[0,1])*textureHeight;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float ty1 = textureCoords[c-32,1];
            float tx2 = textureCoords[c-32,2];
            float ty2 = textureCoords[c-32,3];

            float w = (tx2-tx1) *  textureWidth / textureScale;
            float h = (ty2-ty1) * textureHeight / textureScale;

            int intColor = color.ToArgb();
            if (c != ' ') {
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx1, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx1, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx2, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,0.9f,1.0f), intColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,0.9f,1.0f), intColor, tx1, ty1);
                dwNumTriangles += 2;

                if (dwNumTriangles*3 > (MaxNumfontVertices-6)) {
                    // Set the data for the vertexbuffer
                    vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
                    device.DrawPrimitives(PrimitiveType.TriangleList, 0, dwNumTriangles);
                    dwNumTriangles = 0;
                    iv = 0;
                }
            }

            xpos += w - (2 * spacingPerChar);
        }

        // Set the data for the vertex buffer
        vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
        if (dwNumTriangles > 0)
            device.DrawPrimitives(PrimitiveType.TriangleList, 0, dwNumTriangles);

        // Restore the modified renderstates
        savedStateBlock.Apply();
    }
开发者ID:timdetering,项目名称:BeginningNetGameProgramming,代码行数:77,代码来源:d3dfont.cs

示例14: IndexOf

 /// <summary>
 /// Obtiene el índice de un color determinado en la tabla.
 /// </summary>
 /// <param name="color">Color a consultar.</param>
 /// <returns>Indice del color consultado.</returns>
 public int IndexOf(Color color)
 {
     return colors.IndexOf(color.ToArgb());
 }
开发者ID:mnibecker,项目名称:nrtftree,代码行数:9,代码来源:RtfColorTable.cs

示例15: Clear

 public void Clear(Color color)
 {
     ABitmap.EraseColor(color.ToArgb());
 }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:4,代码来源:Bitmap.cs


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