• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Pixel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Map

        public override void Map(Pixel[] image)
        {
            List<Pixel[]> tiles = new List<Pixel[]>();
            List<MapInfo> infos = new List<MapInfo>();
            int tileLength = this.TileSize.Width * this.TileSize.Height;

            // Get tiles
            for (int i = 0; i < mappedImage.Length; i += tileLength) {
                Pixel[] tile = new Pixel[tileLength];
                Array.Copy(mappedImage, i, tile, 0, tileLength);
                tiles.Add(tile);
            }

            // Perfom search
            for (int i = 0; i < image.Length; i += tileLength) {
                // Get tile
                Pixel[] tile = new Pixel[tileLength];
                Array.Copy(image, i, tile, 0, tileLength);

                bool flipX;
                bool flipY;
                int index = CompressMapping.Search(tile, tiles, this.TileSize, out flipX, out flipY);

                if (index == -1)
                    throw new Exception("Tile not found.");

                // Finally create map info
                infos.Add(new MapInfo(index, 0, flipX, flipY));
            }

            this.mapInfo = infos.ToArray();
        }
开发者ID:pleonex,项目名称:ninoimager,代码行数:32,代码来源:MatchMapping.cs


示例17: DataInfo

 public DataInfo(int dataSize, XRayInfoIDStruct xrayInfo, byte numberOfBytesPerPixel)
 {
     LineData = new Pixel[dataSize];
     NumberOfBytesPerPixel = numberOfBytesPerPixel;
     XRayInfo = xrayInfo;
     TotalBytesReceived = 0;
 }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:7,代码来源:DataInfo.cs


示例18: changeQueue

 protected override void changeQueue(Pixel p)
 {
     for (int i = 0; i < p.Neighbors.Length; i++)
     {
         Pixel np = p.Neighbors[i];
         if (np.Empty)
         {
             // if p has an empty neighbor, it belongs in the queue
             if (p.QueueIndex == -1)
             {
                 queue.Add(p);
             }
         }
         else
         {
             // p has a filled neighbor, and p was just filled
             // so that neighbor may not belong in the queue anymore
             bool stillok = false;
             for (int j = 0; j < np.Neighbors.Length; j++)
             {
                 if (np.Neighbors[j].Empty)
                 {
                     stillok = true;
                     break;
                 }
             }
             if (!stillok)
                 queue.Remove(np);
         }
     }
 }
开发者ID:n-j-m,项目名称:pixelate,代码行数:31,代码来源:OneNeighborSqAlgorithm.cs


示例19: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            Random rnd = new Random();
            for (int i = 0; i < 1; i++)
            {
                Pixel p = new Pixel(new Position(rnd.Next(WidthRender * 1000) / 1000f,
                                                    rnd.Next(HeightRender * 1000) / 1000f,
                                                    rnd.Next(1000000) / 1000f));
                p.color = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
                pixels.Add(p);
            }
            for (int i = 0; i < 10000; i++)
            {
                Pixel p = new MovingPixel(new Position(rnd.Next(WidthRender * 1000) / 1000f,
                                                    rnd.Next(HeightRender * 1000) / 1000f,
                                                    rnd.Next(1000000) / 1000f),
                                    new Position((rnd.Next(100) - 50) / 100f,
                                                (rnd.Next(100) - 50) / 100f,
                                                (rnd.Next(100) - 50) / 100f));
                p.color = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));

                pixels.Add(p);
                updates.Add(p as IUpdate);
            }
        }
开发者ID:Booom3,项目名称:Winformtest,代码行数:25,代码来源:Form1.cs


示例20: GetDrawingFitness

        public double GetDrawingFitness(DnaDrawing newDrawing, Pixel[] sourcePixels)
        {
            double error = 0;

            Renderer.Render(newDrawing, _g, 1);

            BitmapData bd = _bmp.LockBits(
                new Rectangle(0, 0, Tools.MaxWidth, Tools.MaxHeight),
                ImageLockMode.ReadOnly,
                PixelFormat.Format32bppArgb);

            unchecked
            {
                unsafe
                {
                    fixed (Pixel* psourcePixels = sourcePixels)
                    {
                        Pixel* p1 = (Pixel*)bd.Scan0.ToPointer();
                        Pixel* p2 = psourcePixels;
                        for (int i = sourcePixels.Length; i > 0; i--, p1++, p2++)
                        {
                            int a = p1->A - p2->A; //delete
                            int r = p1->R - p2->R;
                            int g = p1->G - p2->G;
                            int b = p1->B - p2->B;
                            error += r * r + g * g + b * b;
                        }
                    }
                }
            }
            _bmp.UnlockBits(bd);

            return error;
        }
开发者ID:matthew-lake,项目名称:EvoImageCompression,代码行数:34,代码来源:FitnessCalculator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PixelBuffer类代码示例发布时间:2022-05-24
下一篇:
C# Pixbuf类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap