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


C# Pixel类代码示例

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


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

示例1: SetColor

        public virtual void SetColor(int x, int y, ColorRGBA color)
        {
            // Create a pixel for the color
            Pixel pel = new Pixel(PixRectInfo.GetPixelInformation(), Pixel.GetBytesForColor(PixRectInfo.GetPixelInformation(), color));

            SetPixel(x, y, pel);
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:7,代码来源:PixelAccessor.cs

示例2: Clear

 public virtual void Clear(Pixel color)
 {
     for (uint i = 0; i < Data.Length; i++)
     {
         Data[i] = color;
     }
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:Image.cs

示例3: getLonLatFromViewPortPx

        public LonLat getLonLatFromViewPortPx(Pixel viewPortPx)
        {
            LonLat lonlat = null;
            if (viewPortPx != null)
            {
                Size size = _map.getSize();
                LonLat center = _map.getCenter();
                if (center != null)
                {
                    float res = _map.getResolution().Value;

                    float delta_x = (float)(viewPortPx.x - (size.Width / 2));
                    float delta_y = (float)(viewPortPx.y - (size.Height / 2));

                    lonlat = new LonLat(center.lon + delta_x * res,
                                                center.lat - delta_y * res);

                    if (_wrapDateLine)
                    {
                        lonlat = lonlat.wrapDateLine(_maxExtent);
                    }
                }
            }
            return lonlat;
        }
开发者ID:mustafayalcin,项目名称:sharplayers,代码行数:25,代码来源:Layer.cs

示例4: Node

 public Node( Pixel data, int level )
 {
     // This creates a leaf by default.
     //location = (NodeLocation)(-1);
     this.level = level;
     BecomeLeaf( data );
 }
开发者ID:And-G,项目名称:Magellan,代码行数:7,代码来源:Node.cs

示例5: Test_IEquatable

    public void Test_IEquatable()
    {
      Pixel first = new Pixel(0, 0, 3);
      first.SetChannel(0, 100);
      first.SetChannel(1, 100);
      first.SetChannel(2, 100);

      Assert.IsFalse(first == null);
      Assert.IsFalse(first.Equals(null));
      Assert.IsTrue(first.Equals(first));
      Assert.IsTrue(first.Equals((object)first));

      Pixel second = new Pixel(10, 10, 3);
      second.SetChannel(0, 100);
      second.SetChannel(1, 0);
      second.SetChannel(2, 100);

      Assert.IsTrue(first != second);
      Assert.IsTrue(!first.Equals(second));
      Assert.IsTrue(!first.Equals((object)second));

      second.SetChannel(1, 100);

      Assert.IsTrue(first == second);
      Assert.IsTrue(first.Equals(second));
      Assert.IsTrue(first.Equals((object)second));
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:27,代码来源:PixelTests.cs

示例6: RawImage

 public RawImage( int zoom, Rectangle bounds, Pixel[,] memory )
 {
     this.zoom = zoom;
     this.bounds = bounds;
     if ( memory.GetLength(0) != bounds.Width || memory.GetLength(1) != bounds.Height ) throw new ArgumentOutOfRangeException( "memory" );
     this.memory = memory;
 }
开发者ID:And-G,项目名称:Magellan,代码行数:7,代码来源:RawImage.cs

示例7: AddColor

		public TransparencyColor AddColor(Pixel color)
		{
			TransparencyColor transparencyColor = new TransparencyColor(color, 2, 0);
			this._colorList.Add(transparencyColor);
			this.SetDirty();
			return transparencyColor;
		}
开发者ID:chharam,项目名称:Capstone_IPM_RV,代码行数:7,代码来源:TransparencyOptions.cs

示例8: BackNForth

        public void BackNForth()
        {
            Pixel[] start = new Pixel[]
            {
                Pixel.Colour.Red,
                Pixel.Colour.Red,
                Pixel.Colour.Red,
                Pixel.Colour.Red,
                Pixel.Colour.Green,
                Pixel.Colour.Green,
                Pixel.Colour.Green,
                Pixel.Colour.Green,
                Pixel.Colour.Blue,
                Pixel.Colour.Blue,
                Pixel.Colour.Blue,
                Pixel.Colour.Blue
            };

            Update(start);
            Thread.Sleep(200);
            for (int j = 1; j < 5; j++) {
                for (int i = 0; i < 20; i++) {
                    RotateDisplay();
                    Thread.Sleep(100);
                }
                for (int h = 0; h < 20; h++) {
                    RotateDisplay(-1);
                    Thread.Sleep(100);
                }
            }
        }
开发者ID:StephanieMak,项目名称:IoT-Maker-Den-NETMF,代码行数:31,代码来源:NeoPixelRing.cs

示例9: updateSize

        private void updateSize()
        {
            Size newSize = getCurrentSize();
            Size oldSize = getSize();

            if (oldSize == Size.Empty)
            {
                _size = oldSize = newSize;                
            }
            if (!newSize.Equals(oldSize))
            {
                _size = newSize;
                
                // @@@ notify layers on resize?

                if (_baseLayer != null)
                {
                    Pixel center = new Pixel((float)(newSize.Width / 2), (float)(newSize.Height / 2));
                    LonLat lonlat = getLonLatFromViewPortPx(center);
                    int zoom = getZoom().Value;
                    _zoom = null;
                    setCenter(getCenter(), zoom, null, null);
                }
            }
        }
开发者ID:mustafayalcin,项目名称:sharplayers,代码行数:25,代码来源:Map.cs

示例10: Superpixels

        private double s = 0; // Superpixel Intervall Int

        #endregion Fields

        #region Constructors

        // =============== Konstruktor ===============
        public Superpixels(Image<Bgr, Byte> imageBgr, int superpixelCount)
        {
            // Werte setzen
            k = superpixelCount;
            n = imageBgr.Width * imageBgr.Height;
            s = Math.Sqrt((double)n / (double)k);
            area = Convert.ToInt32(2 * s * 2 * s);
            m = 12;

            // BGR to LAB Umrechnung und Vektormatrix erstellen
            imageLab = imageBgr.Convert<Lab, Byte>();
            pixels = new Pixel[imageBgr.Width, imageBgr.Height];
            for (int r = 0; r < imageLab.Height; r++)
            {
                for (int c = 0; c < imageLab.Width; c++)
                {
                    double l = (double)imageLab.Data[r, c, 0] * 100 / 255;
                    double a = (double)imageLab.Data[r, c, 1] - 128;
                    double b = (double)imageLab.Data[r, c, 2] - 128;

                    Bgr bgr = new Bgr(imageBgr.Data[r, c, 0], imageBgr.Data[r, c, 1], imageBgr.Data[r, c, 2]);

                    pixels[c, r] = new Pixel(new Vector5(l, a, b, c, r), bgr);

                    //Console.WriteLine("BGR = " + imageBgr.Data[r, c, 0] + " " + imageBgr.Data[r, c, 1] + " " + imageBgr.Data[r, c, 2]);
                    //Console.WriteLine("RGB = " + imageBgr.Data[r, c, 2] + " " + imageBgr.Data[r, c, 1] + " " + imageBgr.Data[r, c, 0]);
                    //Console.WriteLine("LAB = " + labValues[r, c].X + " " + labValues[r, c].Y + " " + labValues[r, c].Z);
                }
            }
        }
开发者ID:Thomas214,项目名称:MA-Code,代码行数:37,代码来源:Superpixels.cs

示例11: GenerateRandomPixel

 private static Pixel GenerateRandomPixel(int xMax, int yMax, Random random)
 {
     var randomX = random.Next(xMax);
     var randomY = random.Next(yMax);
     var pixel = new Pixel(randomX, randomY);
     return pixel;
 }
开发者ID:PictoCrypt,项目名称:ImageTools,代码行数:7,代码来源:LsbWithRandomness.cs

示例12: start

        public static Pixel[] start()
        {
            Pixel[] pixels = new Pixel[Constants.WIN_X * Constants.WIN_Y];
             Point3 viewPlane = new Point3(-Constants.WIN_X / 2, -Constants.WIN_X / 2, 0);

             createScene();

             for (int y = 0; y < Constants.WIN_Y; y++)
             {
            for (int x = 0; x < Constants.WIN_X; x++)
            {
               Pixel p = new Pixel();
               p.rect.X = x;
               p.rect.Y = Constants.WIN_Y - 1 - y;

               Point3 viewPixel = new Point3();
               viewPixel.x = viewPlane.x + x;
               viewPixel.y = viewPlane.y + y;
               viewPixel.z = viewPlane.z;

               Ray r = new Ray();
               r.direction = Point3.vectorize(layout.Cam.Eye, viewPixel);
               r.start = layout.Cam.Eye;

               p.color = fireRay(r, Constants.MIN_DEPTH, null);

               pixels[y * Constants.WIN_X + x] = p;
            }
             }

             return pixels;
        }
开发者ID:qrush,项目名称:q-tracer,代码行数:32,代码来源:Tracer.cs

示例13: IsBlack

 public static bool IsBlack(Pixel p)
 {
     if (p.R == 0 && p.G == 0 && p.B == 0)
         return true;
     else
         return false;
 }
开发者ID:MoustaphaSaad,项目名称:Handwritten-Text-Detection,代码行数:7,代码来源:Image.cs

示例14: Unshade32

        public RawImage Unshade32( int zoom, Rectangle bounds, int[] colorbuffer, int[] idbuffer, int[] borderbuffer )
        {
            if ( bounds.Width*bounds.Height != colorbuffer.Length )
                throw new ArgumentOutOfRangeException( "colorbuffer", "The colorbuffer and bounds parameters have mismatching sizes" );
            if ( colorbuffer.Length != idbuffer.Length || colorbuffer.Length != borderbuffer.Length )
                throw new ArgumentOutOfRangeException( "colorbuffer", "The various buffers have mismatching sizes." );

            int bufidx = 0;
            Pixel[,] memory = new Pixel[bounds.Width, bounds.Height];
            for ( int y=0; y<bounds.Height; ++y ) {
                for ( int x=0; x<bounds.Width; ++x ) {
                    // Shading
                    memory[x,y].Color = (byte)((0xFF-((colorbuffer[bufidx] >> 16) & 0xFF))>>2);

                    // ID
                    memory[x,y].ID = idc.ConvertRGB( idbuffer[bufidx] );

                    // Border
                    unchecked {
                        memory[x,y].Border = (byte)((borderbuffer[bufidx] & (int)0xFF0000) > 0 ? 2 : 0);
                    }

                    bufidx++;
                }
            }

            return new RawImage( zoom, bounds, memory );
        }
开发者ID:And-G,项目名称:Magellan,代码行数:28,代码来源:IOShader.cs

示例15: PixelToBytes

 public static void PixelToBytes(Pixel[] src, int srcIndex, ref byte[] bytes, ref int destIndex, int bytesPerPixel)
 {
     for (int index = 0; index < bytesPerPixel; index++)
     {
         bytes[destIndex++] = (byte)(src[srcIndex].Value >> (index * 8));
     }
 }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:7,代码来源:PixelConverter.cs


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