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


C# Color.GetLength方法代码示例

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


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

示例1: PaintFill

 public static bool PaintFill(Color[,] colors, int r, int c, Color ncolor)
 {
     if (r < 0 || r >= colors.GetLength (0) || c < 0 || c >= colors.GetLength (1))
         return false;
     if (ncolor == colors [r, c])
         return false;
     return PaintFill (colors, r, c, colors [r, c], ncolor);
 }
开发者ID:slao-learn,项目名称:ctci,代码行数:8,代码来源:Q8_10.cs

示例2: Print

 private static void Print(Color[,] colors)
 {
     for (int r = 0; r < colors.GetLength (0); ++r) {
         for (int c = 0; c < colors.GetLength (1); ++c) {
             Console.Write (colors [r, c].ToString()[0] + " ");
         }
         Console.WriteLine ();
     }
     Console.WriteLine ();
 }
开发者ID:slao-learn,项目名称:ctci,代码行数:10,代码来源:Q8_10.cs

示例3: Image

            ////////////////////////////////////////////////////////////
            /// <summary>
            /// Construct the image directly from an array of pixels
            /// </summary>
            /// <param name="pixels">2 dimensions array containing the pixels</param>
            /// <exception cref="LoadingFailedException" />
            ////////////////////////////////////////////////////////////
            public Image(Color[,] pixels) :
                base(IntPtr.Zero)
            {
                unsafe
                {
                    fixed (Color* PixelsPtr = pixels)
                    {
                        uint Width  = (uint)pixels.GetLength(0);
                        uint Height = (uint)pixels.GetLength(1);
                        SetThis(sfImage_CreateFromPixels(Width, Height, (byte*)PixelsPtr));
                    }
                }

                if (This == IntPtr.Zero)
                    throw new LoadingFailedException("image");
            }
开发者ID:wtfcolt,项目名称:game,代码行数:23,代码来源:Image.cs

示例4: UpdatePixels

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Update the pixels of the image
 /// </summary>
 /// <param name="pixels">2 dimensions array containing the pixels</param>
 /// <param name="x">X position of the rectangle to update</param>
 /// <param name="y">Y position of the rectangle to update</param>
 ////////////////////////////////////////////////////////////
 public void UpdatePixels(Color[,] pixels, uint x, uint y)
 {
     unsafe
     {
         fixed (Color* PixelsPtr = pixels)
         {
             int Width  = pixels.GetLength(0);
             int Height = pixels.GetLength(1);
             sfImage_UpdatePixels(This, PixelsPtr, new IntRect((int)x, (int)y, Width, Height));
         }
     }
 }
开发者ID:wtfcolt,项目名称:game,代码行数:20,代码来源:Image.cs

示例5: Image

            ////////////////////////////////////////////////////////////
            /// <summary>
            /// Construct the image directly from an array of pixels
            /// </summary>
            /// <param name="pixels">2 dimensions array containing the pixels</param>
            /// <exception cref="LoadingFailedException" />
            ////////////////////////////////////////////////////////////
            public Image(Color[,] pixels) :
                base(IntPtr.Zero)
            {
                uint Width = (uint)pixels.GetLength(0);
                uint Height = (uint)pixels.GetLength(1);

                // Transpose the array (.Net gives dimensions in reverse order of what SFML expects)
                Color[,] transposed = new Color[Height, Width];
                for (int x = 0; x < Width; ++x)
                    for (int y = 0; y < Height; ++y)
                        transposed[y, x] = pixels[x, y];

                unsafe
                {
                    fixed (Color* PixelsPtr = transposed)
                    {
                        SetThis(sfImage_createFromPixels(Width, Height, (byte*)PixelsPtr));
                    }
                }

                if (CPointer == IntPtr.Zero)
                    throw new LoadingFailedException("image");
            }
开发者ID:kleopatra999,项目名称:SFML.Net,代码行数:30,代码来源:Image.cs

示例6: recolor

        public static Color[,] recolor(int[,] geo)
        {
            Color[,] geolocal = new Color[geo.GetLength(0), geo.GetLength(1)];
            Random rn = new Random();
            for (int t1 = 0; t1 < geolocal.GetLength(0) / 20; t1++)
            {
                for (int t2 = 0; t2 < geolocal.GetLength(1) / 20; t2++)
                {

                       // int currTheme = (rn.Next(3) * 11) + (rn.Next(2) * 38);
                       // if (currTheme == 2 * 11 || currTheme == 11 + 38)
                         //   break;
                        double hue = rn.Next(60) - 15;
                        hue = (Math.Abs(hue * 360) + hue) % 360;
                        for (int i = 0; i < 20; i++)
                        {
                            for (int j = 0; j < 20; j++)
                            {
                                if (geo[i + (t1 * 20), j + (t2 * 20)] == gr)
                                {
                                    geolocal[i + (t1 * 20), j + (t2 * 20)] = Chroma.RandomBlend(Color.White, Color.FromHsv(hue, rn.NextDouble() / 2.5 + 0.2, 0.8), 0.05, 0.2);
                                }
                                else if (geo[i + (t1 * 20), j + (t2 * 20)] != da)// && geo[i + (t1 * 20), j + (t2 * 20)] != 1187)
                                {
                                    geolocal[i + (t1 * 20), j + (t2 * 20)] = Chroma.RandomBlend(Color.White, Color.FromHsv(hue, rn.NextDouble() / 2.5 + 0.2, 0.8), 0.15, 0.3);
                                }
                            }
                        }

                }
            }
            return geolocal;
        }
开发者ID:tommyettinger,项目名称:AgateDemo,代码行数:33,代码来源:DungeonMap.cs

示例7: Sprite

 public Sprite(Color[,] layout)
 {
     _size = new Size(layout.GetLength(0), layout.GetLength(1));
     _layout = layout;
 }
开发者ID:MarkiyanMatsekh,项目名称:MultiplayerTetris,代码行数:5,代码来源:Sprite.cs


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