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


C# ImageBuffer.GetBounds方法代码示例

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


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

示例1: FloodFillDemo

        public FloodFillDemo()
        {
            BackgroundColor = RGBA_Bytes.White;
            imageToFillOn = new ImageBuffer(400, 300, 32, new BlenderBGRA());
            Graphics2D imageToFillGraphics = imageToFillOn.NewGraphics2D();
            imageToFillGraphics.Clear(RGBA_Bytes.White);
            imageToFillGraphics.DrawString("Click to fill", 20, 30);
            imageToFillGraphics.Circle(new Vector2(200, 150), 35, RGBA_Bytes.Black);
            imageToFillGraphics.Circle(new Vector2(200, 150), 30, RGBA_Bytes.Green);
            imageToFillGraphics.Rectangle(20, 50, 210, 280, RGBA_Bytes.Black);
            imageToFillGraphics.Rectangle(imageToFillOn.GetBounds(), RGBA_Bytes.Blue);

            Random rand = new Random();
            for (int i = 0; i < 20; i++)
            {
                Ellipse elipse = new Ellipse(rand.Next(imageToFillOn.Width), rand.Next(imageToFillOn.Height), rand.Next(10, 60), rand.Next(10, 60));
                Stroke outline = new Stroke(elipse);
                imageToFillGraphics.Render(outline, RGBA_Bytes.Black);
            }
            

            m_slider1 = new Slider(new Vector2(80, 10), 510);
            m_slider2 = new Slider(new Vector2(80, 10 + 20), 510);

            m_slider1.ValueChanged += new EventHandler(NeedsRedraw);
            m_slider2.ValueChanged += new EventHandler(NeedsRedraw);

            AddChild(m_slider1);
            AddChild(m_slider2);

            m_slider1.Text = "Pixel size={0:F3}";
            m_slider1.SetRange(8, 100);
            m_slider1.NumTicks = 23;
            m_slider1.Value = 32;

            m_slider2.Text = "gamma={0:F3}";
            m_slider2.SetRange(0.0, 3.0);
            m_slider2.Value = 1.0;
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:39,代码来源:FloodFill.cs

示例2: DEBUG_saveImageBuffer

        private void DEBUG_saveImageBuffer(ImageBuffer buf)
        {
            int hash = 0;
            var bounds = buf.GetBounds ();
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap (bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
            for (int x = 0; x < bounds.Width; x++) {
                for (int y = 0; y < bounds.Height; y++) {
                    var pcolor = buf.GetPixel (x, y);
                    var wcolor = Color.FromArgb (pcolor.alpha, pcolor.red, pcolor.green, pcolor.green);

                    hash += wcolor.ToArgb () ^ 0x1f2f019f;
                    hash <<= 1;

                    bitmap.SetPixel (x, y, wcolor);
                }
            }
            string filename = String.Format (@"C:\tmp\masktest-{0}.bmp", hash);
            if (!System.IO.File.Exists (filename)) {
                bitmap.Save (filename, ImageFormat.Bmp);
            }
        }
开发者ID:RealRui,项目名称:SimpleScene,代码行数:21,代码来源:GDIviaAGG.cs


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