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


C# NikseBitmap.SetPixel方法代码示例

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


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

示例1: GetExpandedSelectionNew

        internal static ImageSplitterItem GetExpandedSelectionNew(NikseBitmap bitmap, List<ImageSplitterItem> expandSelectionList)
        {
            int minimumX = expandSelectionList[0].X;
            int maximumX = expandSelectionList[expandSelectionList.Count - 1].X + expandSelectionList[expandSelectionList.Count - 1].NikseBitmap.Width;
            int minimumY = expandSelectionList[0].Y;
            int maximumY = expandSelectionList[0].Y + expandSelectionList[0].NikseBitmap.Height;
            var nbmp = new NikseBitmap(bitmap.Width, bitmap.Height);
            foreach (ImageSplitterItem item in expandSelectionList)
            {
                for (int y = 0; y < item.NikseBitmap.Height; y++)
                {
                    for (int x = 0; x < item.NikseBitmap.Width; x++)
                    {
                        int a = item.NikseBitmap.GetAlpha(x, y);
                        if (a > 100)
                            nbmp.SetPixel(item.X + x, item.Y + y, Color.White);
                    }
                }
                if (item.Y < minimumY)
                    minimumY = item.Y;
                if (item.Y + item.NikseBitmap.Height > maximumY)
                    maximumY = item.Y + item.NikseBitmap.Height;
            }
            nbmp.CropTransparentSidesAndBottom(0, true);
            int topCropping;
            nbmp = NikseBitmapImageSplitter.CropTopAndBottom(nbmp, out topCropping);

            return new ImageSplitterItem(minimumX, minimumY, nbmp);
        }
开发者ID:mgziminsky,项目名称:subtitleedit,代码行数:29,代码来源:VobSubOcr.cs

示例2: ToOldBitmap

        public Bitmap ToOldBitmap()
        {
            if (ExpandedList != null && ExpandedList.Count > 0)
            {
                int minX = X;
                int minY = Y;
                int maxX = X + Width;
                int maxY = Y + Height;
                var list = new List<BinaryOcrBitmap>();
                list.Add(this);
                foreach (BinaryOcrBitmap bob in ExpandedList)
                {
                    if (bob.X < minX)
                        minX = bob.X;
                    if (bob.Y < minY)
                        minY = bob.Y;
                    if (bob.X + bob.Width > maxX)
                        maxX = bob.X + bob.Width;
                    if (bob.Y + bob.Height > maxY)
                        maxY = bob.Y + bob.Height;
                    list.Add(bob);
                }
                var nbmp = new BinaryOcrBitmap(maxX - minX, maxY - minY);
                foreach (BinaryOcrBitmap bob in list)
                {
                    for (int y = 0; y < bob.Height; y++)
                    {
                        for (int x = 0; x < bob.Width; x++)
                        {
                            int c = bob.GetPixel(x, y);
                            if (c > 0)
                                nbmp.SetPixel(bob.X - minX + x, bob.Y - minY + y, 1);
                        }
                    }
                }

                return nbmp.ToOldBitmap(); // Resursive
            }
            else
            {
                var nbmp = new NikseBitmap(Width, Height);
                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        Color c = Color.Transparent;
                        if (this.GetPixel(x, y) > 0)
                            c = Color.White;
                        nbmp.SetPixel(x, y, c);
                    }
                }
                return nbmp.GetBitmap();
            }
        }
开发者ID:Tarhan,项目名称:subtitleedit,代码行数:54,代码来源:BinaryOcrBitmap.cs

示例3: ToOldBitmap

        /// <summary>
        /// The to old bitmap.
        /// </summary>
        /// <returns>
        /// The <see cref="Bitmap"/>.
        /// </returns>
        public Bitmap ToOldBitmap()
        {
            if (this.ExpandedList != null && this.ExpandedList.Count > 0)
            {
                int minX = this.X;
                int minY = this.Y;
                int maxX = this.X + this.Width;
                int maxY = this.Y + this.Height;
                List<BinaryOcrBitmap> list = new List<BinaryOcrBitmap>();
                list.Add(this);
                foreach (BinaryOcrBitmap bob in this.ExpandedList)
                {
                    if (bob.X < minX)
                    {
                        minX = bob.X;
                    }

                    if (bob.Y < minY)
                    {
                        minY = bob.Y;
                    }

                    if (bob.X + bob.Width > maxX)
                    {
                        maxX = bob.X + bob.Width;
                    }

                    if (bob.Y + bob.Height > maxY)
                    {
                        maxY = bob.Y + bob.Height;
                    }

                    list.Add(bob);
                }

                BinaryOcrBitmap nbmp = new BinaryOcrBitmap(maxX - minX, maxY - minY);
                foreach (BinaryOcrBitmap bob in list)
                {
                    for (int y = 0; y < bob.Height; y++)
                    {
                        for (int x = 0; x < bob.Width; x++)
                        {
                            int c = bob.GetPixel(x, y);
                            if (c > 0)
                            {
                                nbmp.SetPixel(bob.X - minX + x, bob.Y - minY + y, 1);
                            }
                        }
                    }
                }

                return nbmp.ToOldBitmap(); // Resursive
            }
            else
            {
                NikseBitmap nbmp = new NikseBitmap(this.Width, this.Height);
                for (int y = 0; y < this.Height; y++)
                {
                    for (int x = 0; x < this.Width; x++)
                    {
                        Color c = Color.Transparent;
                        if (this.GetPixel(x, y) > 0)
                        {
                            c = Color.White;
                        }

                        nbmp.SetPixel(x, y, c);
                    }
                }

                return nbmp.GetBitmap();
            }
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:79,代码来源:BinaryOcrBitmap.cs

示例4: RemoveBlackBarRight

 private static void RemoveBlackBarRight(NikseBitmap bmp)
 {
     int xRemoveBlackBar = bmp.Width - 1;
     for (int yRemoveBlackBar = 0; yRemoveBlackBar < bmp.Height; yRemoveBlackBar++)
     {
         byte[] c = bmp.GetPixelColors(xRemoveBlackBar, yRemoveBlackBar);
         if (c[0] == 0 || IsColorClose(c[0], c[1], c[2], c[3], Color.Black, 280))
         {
             if (bmp.GetAlpha(xRemoveBlackBar - 1, yRemoveBlackBar) == 0)
                 bmp.SetPixel(xRemoveBlackBar, yRemoveBlackBar, Color.Transparent);
         }
     }
 }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:13,代码来源:NikseBitmapImageSplitter.cs

示例5: ToOldBitmap

 public Bitmap ToOldBitmap()
 {
     var nbmp = new NikseBitmap(Width, Height);
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             Color c = Color.Transparent;
             if (this.GetPixel(x, y))
                 c = Color.White;
             nbmp.SetPixel(x, y, c);
         }
     }
     return nbmp.GetBitmap();
 }
开发者ID:rebawest,项目名称:subtitleedit,代码行数:15,代码来源:BinaryOcrBitmap.cs


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