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


C# NikseBitmap.MakeBackgroundTransparent方法代码示例

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


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

示例1: GetSubtitleBitmap


//.........这里部分代码省略.........
                                        fbmp.SetPixel(x, y, emphasis1);
                                    else
                                        fbmp.SetPixel(x, y, c);
                                }
                            }
                            fbmp.UnlockImage();
                        }
                        if (checkBoxAutoTransparentBackground.Checked)
                            b.MakeTransparent();
                        returnBmp = b;
                    }
                }
            }
            else if (_xSubList != null)
            {
                if (index >= 0 && index < _xSubList.Count)
                {
                    if (checkBoxCustomFourColors.Checked)
                    {
                        GetCustomColors(out background, out pattern, out emphasis1, out emphasis2);
                        returnBmp = _xSubList[index].GetImage(background, pattern, emphasis1, emphasis2);
                    }
                    else
                    {
                        returnBmp = _xSubList[index].GetImage();
                    }
                }
            }
            else if (_dvbSubtitles != null)
            {
                if (index >= 0 && index < _dvbSubtitles.Count)
                {
                    var dvbBmp = _dvbSubtitles[index].GetActiveImage();
                    var nDvbBmp = new NikseBitmap(dvbBmp);
                    nDvbBmp.CropTopTransparent(2);
                    nDvbBmp.CropTransparentSidesAndBottom(2, true);
                    if (checkBoxTransportStreamGetColorAndSplit.Checked)
                        _dvbSubColor = nDvbBmp.GetBrightestColorWhiteIsTransparent();
                    if (checkBoxAutoTransparentBackground.Checked)
                        nDvbBmp.MakeBackgroundTransparent((int)numericUpDownAutoTransparentAlphaMax.Value);
                    if (checkBoxTransportStreamGrayscale.Checked)
                        nDvbBmp.GrayScale();
                    dvbBmp.Dispose();
                    returnBmp = nDvbBmp.GetBitmap();
                }
            }
            else if (_dvbPesSubtitles != null)
            {
                if (index >= 0 && index < _dvbPesSubtitles.Count)
                {
                    var dvbBmp = _dvbPesSubtitles[index].GetImageFull();
                    var nDvbBmp = new NikseBitmap(dvbBmp);
                    nDvbBmp.CropTopTransparent(2);
                    nDvbBmp.CropTransparentSidesAndBottom(2, true);
                    if (checkBoxTransportStreamGetColorAndSplit.Checked)
                        _dvbSubColor = nDvbBmp.GetBrightestColorWhiteIsTransparent();
                    if (checkBoxAutoTransparentBackground.Checked)
                        nDvbBmp.MakeBackgroundTransparent((int)numericUpDownAutoTransparentAlphaMax.Value);
                    if (checkBoxTransportStreamGrayscale.Checked)
                        nDvbBmp.GrayScale();
                    dvbBmp.Dispose();
                    returnBmp = nDvbBmp.GetBitmap();
                }
            }
            else if (_bluRaySubtitlesOriginal != null)
            {
                if (index >= 0 && index < _bluRaySubtitles.Count)
                {
                    returnBmp = _bluRaySubtitles[index].GetBitmap();
                }
            }
            else if (index >= 0 && index < _vobSubMergedPackist.Count)
            {
                if (checkBoxCustomFourColors.Checked)
                {
                    GetCustomColors(out background, out pattern, out emphasis1, out emphasis2);

                    returnBmp = _vobSubMergedPackist[index].SubPicture.GetBitmap(null, background, pattern, emphasis1, emphasis2, true);
                    if (checkBoxAutoTransparentBackground.Checked)
                        returnBmp.MakeTransparent();
                }
                else
                {
                    returnBmp = _vobSubMergedPackist[index].SubPicture.GetBitmap(_palette, Color.Transparent, Color.Black, Color.White, Color.Black, false);
                    if (checkBoxAutoTransparentBackground.Checked)
                        returnBmp.MakeTransparent();
                }
            }

            if (returnBmp == null)
                return null;

            if ((_binaryOcrDb == null && _nOcrDb == null) || _fromMenuItem)
                return returnBmp;

            var n = new NikseBitmap(returnBmp);
            n.MakeTwoColor(280);
            returnBmp.Dispose();
            return n.GetBitmap();
        }
开发者ID:mgziminsky,项目名称:subtitleedit,代码行数:101,代码来源:VobSubOcr.cs


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