本文整理汇总了C#中NikseBitmap类的典型用法代码示例。如果您正苦于以下问题:C# NikseBitmap类的具体用法?C# NikseBitmap怎么用?C# NikseBitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NikseBitmap类属于命名空间,在下文中一共展示了NikseBitmap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BinaryOcrBitmap
public BinaryOcrBitmap(NikseBitmap nbmp, bool italic, int expandCount, string text)
{
InitializeViaNikseBmp(nbmp);
Italic = italic;
ExpandCount = expandCount;
Text = text;
}
示例2: ImageSplitterItem
public ImageSplitterItem(int x, int y, NikseBitmap bitmap)
{
X = x;
Y = y;
NikseBitmap = bitmap;
SpecialCharacter = null;
}
示例3: GetSubImageBuffer
private byte[] GetSubImageBuffer(RunLengthTwoParts twoPartBuffer, NikseBitmap nbmp, Paragraph p, ContentAlignment alignment)
{
var ms = new MemoryStream();
// sup picture datasize
WriteEndianWord(twoPartBuffer.Length + 34, ms);
// first display control sequence table address
int startDisplayControlSequenceTableAddress = twoPartBuffer.Length + 4;
WriteEndianWord(startDisplayControlSequenceTableAddress, ms);
// Write image
const int imageTopFieldDataAddress = 4;
ms.Write(twoPartBuffer.Buffer1, 0, twoPartBuffer.Buffer1.Length);
int imageBottomFieldDataAddress = 4 + twoPartBuffer.Buffer1.Length;
ms.Write(twoPartBuffer.Buffer2, 0, twoPartBuffer.Buffer2.Length);
// Write zero delay
ms.WriteByte(0);
ms.WriteByte(0);
// next display control sequence table address (use current is last)
WriteEndianWord(startDisplayControlSequenceTableAddress + 24, ms); // start of display control sequence table address
// Control command start
if (p.Forced)
ms.WriteByte(0); // ForcedStartDisplay==0
else
ms.WriteByte(1); // StartDisplay==1
// Control command 3 = SetColor
WriteColors(ms); // 3 bytes
// Control command 4 = SetContrast
WriteContrast(ms); // 3 bytes
// Control command 5 = SetDisplayArea
WriteDisplayArea(ms, nbmp, alignment); // 7 bytes
// Control command 6 = SetPixelDataAddress
WritePixelDataAddress(ms, imageTopFieldDataAddress, imageBottomFieldDataAddress); // 5 bytes
// Control command exit
ms.WriteByte(255); // 1 byte
// Control Sequence Table
// Write delay - subtitle duration
WriteEndianWord(Convert.ToInt32(p.Duration.TotalMilliseconds * 90.0 - 1023) >> 10, ms);
// next display control sequence table address (use current is last)
WriteEndianWord(startDisplayControlSequenceTableAddress + 24, ms); // start of display control sequence table address
// Control command 2 = StopDisplay
ms.WriteByte(2);
// extra byte - for compatability with gpac/MP4BOX
ms.WriteByte(255); // 1 byte
return ms.ToArray();
}
示例4: ImageSplitterItem
/// <summary>
/// Initializes a new instance of the <see cref="ImageSplitterItem"/> class.
/// </summary>
/// <param name="x">
/// The x.
/// </param>
/// <param name="y">
/// The y.
/// </param>
/// <param name="bitmap">
/// The bitmap.
/// </param>
public ImageSplitterItem(int x, int y, NikseBitmap bitmap)
{
this.X = x;
this.Y = y;
this.NikseBitmap = bitmap;
this.SpecialCharacter = null;
}
示例5: BinaryOcrBitmap
public BinaryOcrBitmap(NikseBitmap nbmp, bool italic, int expandCount, string text, int x, int y)
{
this.InitializeViaNikseBmp(nbmp);
this.Italic = italic;
this.ExpandCount = expandCount;
this.Text = text;
this.X = x;
this.Y = y;
}
示例6: CropTopAndBottom
public static NikseBitmap CropTopAndBottom(NikseBitmap bmp, out int topCropping, int maxDifferentPixelsOnLine)
{
int startTop = 0;
int maxTop = bmp.Height - 2;
if (maxTop > bmp.Height)
maxTop = bmp.Height;
for (int y = 0; y < maxTop; y++)
{
int difference = 0;
bool allTransparent = true;
for (int x = 1; x < bmp.Width - 1; x++)
{
int a = bmp.GetAlpha(x, y);
if (a != 0)
{
difference++;
if (difference >= maxDifferentPixelsOnLine)
{
allTransparent = false;
break;
}
}
}
if (!allTransparent)
break;
startTop++;
}
if (startTop > 9)
startTop -= 5; // if top space > 9, then allways leave blank 5 pixels on top (so . is not confused with ').
topCropping = startTop;
for (int y = bmp.Height - 1; y > 3; y--)
{
int difference = 0;
bool allTransparent = true;
for (int x = 1; x < bmp.Width - 1; x++)
{
int a = bmp.GetAlpha(x, y);
if (a != 0)
{
difference++;
if (difference >= maxDifferentPixelsOnLine)
{
allTransparent = false;
break;
}
}
}
if (allTransparent == false)
return bmp.CopyRectangle(new Rectangle(0, startTop, bmp.Width - 1, y - startTop + 1));
}
return bmp;
}
示例7: Initialize
internal void Initialize(Bitmap vobSubImage, ImageSplitterItem character, Point position, bool italicChecked, bool showShrink)
{
listBoxLinesForeground.Items.Clear();
listBoxlinesBackground.Items.Clear();
NikseBitmap nbmp = new NikseBitmap(vobSubImage);
nbmp.ReplaceTransparentWith(Color.Black);
vobSubImage = nbmp.GetBitmap();
radioButtonHot.Checked = true;
ShrinkSelection = false;
ExpandSelection = false;
textBoxCharacters.Text = string.Empty;
_nocrChar = new NOcrChar();
_nocrChar.MarginTop = character.Y - character.ParentY;
_imageWidth = character.NikseBitmap.Width;
_imageHeight = character.NikseBitmap.Height;
_drawLineOn = false;
_warningNoNotForegroundLinesShown = false;
buttonShrinkSelection.Visible = showShrink;
if (position.X != -1 && position.Y != -1)
{
StartPosition = FormStartPosition.Manual;
Left = position.X;
Top = position.Y;
}
pictureBoxSubtitleImage.Image = vobSubImage;
pictureBoxCharacter.Image = character.NikseBitmap.GetBitmap();
Bitmap org = (Bitmap)vobSubImage.Clone();
Bitmap bm = new Bitmap(org.Width, org.Height);
Graphics g = Graphics.FromImage(bm);
g.DrawImage(org, 0, 0, org.Width, org.Height);
g.DrawRectangle(Pens.Red, character.X, character.Y, character.NikseBitmap.Width, character.NikseBitmap.Height - 1);
g.Dispose();
pictureBoxSubtitleImage.Image = bm;
pictureBoxCharacter.Top = labelCharacters.Top + 16;
SizePictureBox();
checkBoxItalic.Checked = italicChecked;
_history = new List<NOcrChar>();
_historyIndex = -1;
_nocrChar.Width = _imageWidth;
_nocrChar.Height = _imageHeight;
GenerateLineSegments(150, false, _nocrChar, new NikseBitmap(pictureBoxCharacter.Image as Bitmap));
ShowOcrPoints();
pictureBoxCharacter.Invalidate();
}
示例8: Initialize
internal void Initialize(Bitmap bitmap, int pixelsIsSpace, bool rightToLeft, NOcrDb nOcrDb, VobSubOcr vobSubOcr)
{
_bitmap = bitmap;
var nbmp = new NikseBitmap(bitmap);
nbmp.ReplaceNonWhiteWithTransparent();
bitmap = nbmp.GetBitmap();
_bitmap2 = bitmap;
_nocrChars = nOcrDb.OcrCharacters;
_matchList = new List<VobSubOcr.CompareMatch>();
_vobSubOcr = vobSubOcr;
const int minLineHeight = 6;
_imageList = NikseBitmapImageSplitter.SplitBitmapToLettersNew(nbmp, pixelsIsSpace, rightToLeft, Configuration.Settings.VobSubOcr.TopToBottom, minLineHeight);
// _imageList = NikseBitmapImageSplitter.SplitBitmapToLetters(nbmp, pixelsIsSpace, rightToLeft, Configuration.Settings.VobSubOcr.TopToBottom);
int index = 0;
while (index < _imageList.Count)
{
ImageSplitterItem item = _imageList[index];
if (item.NikseBitmap == null)
{
listBoxInspectItems.Items.Add(item.SpecialCharacter);
_matchList.Add(null);
}
else
{
nbmp = item.NikseBitmap;
nbmp.ReplaceNonWhiteWithTransparent();
item.Y += nbmp.CropTopTransparent(0);
nbmp.CropTransparentSidesAndBottom(0, true);
nbmp.ReplaceTransparentWith(Color.Black);
//get nocr matches
var match = vobSubOcr.GetNOcrCompareMatchNew(item, nbmp, nOcrDb, false, false);
if (match == null)
{
listBoxInspectItems.Items.Add("?");
_matchList.Add(null);
}
else
{
listBoxInspectItems.Items.Add(match.Text);
_matchList.Add(match);
}
}
index++;
}
}
示例9: CropTopAndBottom
public static NikseBitmap CropTopAndBottom(NikseBitmap bmp, out int topCropping)
{
int startTop = 0;
int maxTop = bmp.Height - 2;
if (maxTop > bmp.Height)
maxTop = bmp.Height;
for (int y = 0; y < maxTop; y++)
{
bool allTransparent = true;
for (int x = 0; x < bmp.Width; x++)
{
int a = bmp.GetAlpha(x, y);
if (a != 0)
{
allTransparent = false;
break;
}
}
if (!allTransparent)
break;
startTop++;
}
//if (startTop > 9)
//startTop -= 5; // if top space > 9, then allways leave blank 5 pixels on top (so . is not confused with ').
topCropping = startTop;
int h = bmp.Height;
bool bottomCroppingDone = false;
for (int y = bmp.Height - 1; y > 3; y--)
{
for (int x = 0; x < bmp.Width; x++)
{
int a = bmp.GetAlpha(x, y);
if (a != 0)
{
bottomCroppingDone = true;
break;
}
}
h = y;
if (bottomCroppingDone)
break;
}
if (h - startTop + 1 <= 0)
return new NikseBitmap(0, 0);
return bmp.CopyRectangle(new Rectangle(0, startTop, bmp.Width, h - startTop + 1));
}
示例10: GetExpandedSelection
internal static ImageSplitterItem GetExpandedSelection(NikseBitmap bitmap, List<ImageSplitterItem> expandSelectionList, bool rightToLeft)
{
if (rightToLeft)
{
int minimumX = expandSelectionList[expandSelectionList.Count - 1].X - expandSelectionList[expandSelectionList.Count - 1].NikseBitmap.Width;
int maximumX = expandSelectionList[0].X;
int minimumY = expandSelectionList[0].Y;
int maximumY = expandSelectionList[0].Y + expandSelectionList[0].NikseBitmap.Height;
foreach (ImageSplitterItem item in expandSelectionList)
{
if (item.Y < minimumY)
minimumY = item.Y;
if (item.Y + item.NikseBitmap.Height > maximumY)
maximumY = item.Y + item.NikseBitmap.Height;
}
var part = bitmap.CopyRectangle(new Rectangle(minimumX, minimumY, maximumX - minimumX, maximumY - minimumY));
return new ImageSplitterItem(minimumX, minimumY, part);
}
else
{
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;
foreach (ImageSplitterItem item in expandSelectionList)
{
if (item.Y < minimumY)
minimumY = item.Y;
if (item.Y + item.NikseBitmap.Height > maximumY)
maximumY = item.Y + item.NikseBitmap.Height;
}
var part = bitmap.CopyRectangle(new Rectangle(minimumX, minimumY, maximumX - minimumX, maximumY - minimumY));
return new ImageSplitterItem(minimumX, minimumY, part);
}
}
示例11: Tesseract3DoOcrViaExe
private string Tesseract3DoOcrViaExe(Bitmap bmp, string language, string psmMode)
{
// change yellow color to white - easier for Tesseract
var nbmp = new NikseBitmap(bmp);
nbmp.ReplaceYellowWithWhite(); // optimized replace
string tempTiffFileName = Path.GetTempPath() + Guid.NewGuid() + ".png";
string tempTextFileName;
using (var b = nbmp.GetBitmap())
{
b.Save(tempTiffFileName, System.Drawing.Imaging.ImageFormat.Png);
tempTextFileName = Path.GetTempPath() + Guid.NewGuid();
}
using (var process = new Process())
{
process.StartInfo = new ProcessStartInfo(Configuration.TesseractFolder + "tesseract.exe");
process.StartInfo.UseShellExecute = true;
process.StartInfo.Arguments = "\"" + tempTiffFileName + "\" \"" + tempTextFileName + "\" -l " + language;
if (checkBoxTesseractMusicOn.Checked)
process.StartInfo.Arguments += "+music";
if (!string.IsNullOrEmpty(psmMode))
process.StartInfo.Arguments += " " + psmMode.Trim();
process.StartInfo.Arguments += " hocr";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
if (Configuration.IsRunningOnLinux() || Configuration.IsRunningOnMac())
{
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = "tesseract";
}
else
{
process.StartInfo.WorkingDirectory = (Configuration.TesseractFolder);
}
try
{
process.Start();
}
catch
{
if (Configuration.IsRunningOnLinux() || Configuration.IsRunningOnMac())
{
MessageBox.Show("Unable to start 'Tesseract' - make sure tesseract-ocr 3.x is installed!");
}
else
{
MessageBox.Show("Unable to start 'Tesseract' (" + Configuration.TesseractFolder + "tesseract.exe) - make sure tesseract-ocr 3.x is installed!");
}
throw;
}
process.WaitForExit(5000);
}
string result = string.Empty;
string outputFileName = tempTextFileName + ".html";
if (!File.Exists(outputFileName))
outputFileName = tempTextFileName + ".hocr";
try
{
if (File.Exists(outputFileName))
{
result = File.ReadAllText(outputFileName);
result = ParseHocr(result);
File.Delete(outputFileName);
}
File.Delete(tempTiffFileName);
}
catch
{
}
return result;
}
示例12: NocrFastCheck
public string NocrFastCheck(Bitmap bitmap)
{
var nbmpInput = new NikseBitmap(bitmap);
nbmpInput.ReplaceNonWhiteWithTransparent();
var matches = new List<CompareMatch>();
List<ImageSplitterItem> list = NikseBitmapImageSplitter.SplitBitmapToLetters(nbmpInput, (int)numericUpDownNumberOfPixelsIsSpaceNOCR.Value, checkBoxRightToLeft.Checked, Configuration.Settings.VobSubOcr.TopToBottom);
foreach (ImageSplitterItem item in list)
{
if (item.NikseBitmap != null)
{
item.NikseBitmap.ReplaceTransparentWith(Color.Black);
}
}
int index = 0;
while (index < list.Count)
{
ImageSplitterItem item = list[index];
if (item.NikseBitmap == null)
{
matches.Add(new CompareMatch(item.SpecialCharacter, false, 0, null));
}
else
{
CompareMatch match = null;
var nbmp = item.NikseBitmap;
int topMargin = item.Y - item.ParentY;
foreach (NOcrChar oc in _nOcrDb.OcrCharacters)
{
if (Math.Abs(oc.Width - nbmp.Width) < 3 && Math.Abs(oc.Height - nbmp.Height) < 4 && Math.Abs(oc.MarginTop - topMargin) < 4)
{ // only very accurate matches
bool ok = true;
var index2 = 0;
while (index2 < oc.LinesForeground.Count && ok)
{
NOcrPoint op = oc.LinesForeground[index2];
foreach (Point point in op.ScaledGetPoints(oc, nbmp.Width, nbmp.Height))
{
if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
{
Color c = nbmp.GetPixel(point.X, point.Y);
if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
{
}
else
{
Point p = new Point(point.X - 1, point.Y);
if (p.X < 0)
p.X = 1;
c = nbmp.GetPixel(p.X, p.Y);
if (nbmp.Width > 20 && c.A > 150 && c.R + c.G + c.B > NocrMinColor)
{
}
else
{
ok = false;
break;
}
}
}
}
index2++;
}
index2 = 0;
while (index2 < oc.LinesBackground.Count && ok)
{
NOcrPoint op = oc.LinesBackground[index2];
foreach (Point point in op.ScaledGetPoints(oc, nbmp.Width, nbmp.Height))
{
if (point.X >= 0 && point.Y >= 0 && point.X < nbmp.Width && point.Y < nbmp.Height)
{
Color c = nbmp.GetPixel(point.X, point.Y);
if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
{
Point p = new Point(point.X, point.Y);
if (oc.Width > 19 && point.X > 0)
p.X = p.X - 1;
c = nbmp.GetPixel(p.X, p.Y);
if (c.A > 150 && c.R + c.G + c.B > NocrMinColor)
{
ok = false;
break;
}
}
}
}
index2++;
}
if (ok)
match = new CompareMatch(oc.Text, oc.Italic, 0, null);
}
}
if (match == null)
{
matches.Add(new CompareMatch("*", false, 0, null));
//.........这里部分代码省略.........
示例13: SaveCompareItem
private string SaveCompareItem(NikseBitmap newTarget, string text, bool isItalic, int expandCount)
{
string path = Configuration.VobSubCompareFolder + comboBoxCharacterDatabase.SelectedItem + Path.DirectorySeparatorChar;
string databaseName = path + "Images.db";
FileStream f;
long pos;
if (!File.Exists(databaseName))
{
if (!Directory.Exists(Configuration.OcrFolder))
{
Directory.CreateDirectory(Configuration.OcrFolder);
}
using (f = new FileStream(databaseName, FileMode.Create))
{
pos = f.Position;
new ManagedBitmap(newTarget).AppendToStream(f);
}
}
else
{
using (f = new FileStream(databaseName, FileMode.Append))
{
pos = f.Position;
new ManagedBitmap(newTarget).AppendToStream(f);
}
}
string name = pos.ToString(CultureInfo.InvariantCulture);
if (_compareDoc == null)
{
_compareDoc = new XmlDocument();
_compareDoc.LoadXml("<OcrBitmaps></OcrBitmaps>");
}
if (_compareBitmaps == null)
_compareBitmaps = new List<CompareItem>();
_compareBitmaps.Add(new CompareItem(new ManagedBitmap(newTarget), name, isItalic, expandCount, text));
XmlElement element = _compareDoc.CreateElement("Item");
XmlAttribute attribute = _compareDoc.CreateAttribute("Text");
attribute.InnerText = text;
element.Attributes.Append(attribute);
if (expandCount > 0)
{
XmlAttribute expandSelection = _compareDoc.CreateAttribute("Expand");
expandSelection.InnerText = expandCount.ToString(CultureInfo.InvariantCulture);
element.Attributes.Append(expandSelection);
}
if (isItalic)
{
XmlAttribute italic = _compareDoc.CreateAttribute("Italic");
italic.InnerText = "true";
element.Attributes.Append(italic);
}
element.InnerText = pos.ToString(CultureInfo.InvariantCulture);
_compareDoc.DocumentElement.AppendChild(element);
_compareDoc.Save(path + "Images.xml");
return name;
}
示例14: OcrViaNOCR
private string OcrViaNOCR(Bitmap bitmap, int listViewIndex)
{
if (_ocrFixEngine == null)
comboBoxDictionaries_SelectedIndexChanged(null, null);
string line = string.Empty;
if (_nocrThreadResults != null)
line = _nocrThreadResults[listViewIndex];
if (string.IsNullOrEmpty(line))
{
var nbmpInput = new NikseBitmap(bitmap);
var matches = new List<CompareMatch>();
int minLineHeight = _binOcrLastLowercaseHeight - 3;
if (minLineHeight < 5)
minLineHeight = _nocrLastLowercaseHeight - 3;
if (minLineHeight < 5)
minLineHeight = 5;
List<ImageSplitterItem> list = NikseBitmapImageSplitter.SplitBitmapToLettersNew(nbmpInput, (int)numericUpDownNumberOfPixelsIsSpaceNOCR.Value, checkBoxRightToLeft.Checked, Configuration.Settings.VobSubOcr.TopToBottom, minLineHeight);
foreach (ImageSplitterItem item in list)
{
if (item.NikseBitmap != null)
{
item.NikseBitmap.ReplaceTransparentWith(Color.Black);
}
}
int index = 0;
bool expandSelection = false;
bool shrinkSelection = false;
var expandSelectionList = new List<ImageSplitterItem>();
while (index < list.Count)
{
ImageSplitterItem item = list[index];
if (expandSelection || shrinkSelection)
{
expandSelection = false;
if (shrinkSelection && index > 0)
{
shrinkSelection = false;
}
else if (index + 1 < list.Count && list[index + 1].NikseBitmap != null) // only allow expand to EndOfLine or space
{
index++;
expandSelectionList.Add(list[index]);
}
item = GetExpandedSelection(nbmpInput, expandSelectionList, checkBoxRightToLeft.Checked);
if (item.NikseBitmap != null)
{
item.NikseBitmap.ReplaceTransparentWith(Color.Black);
}
_vobSubOcrNOcrCharacter.Initialize(bitmap, item, _manualOcrDialogPosition, _italicCheckedLast, expandSelectionList.Count > 1);
DialogResult result = _vobSubOcrNOcrCharacter.ShowDialog(this);
_manualOcrDialogPosition = _vobSubOcrNOcrCharacter.FormPosition;
if (result == DialogResult.OK && _vobSubOcrNOcrCharacter.ShrinkSelection)
{
shrinkSelection = true;
index--;
if (expandSelectionList.Count > 0)
expandSelectionList.RemoveAt(expandSelectionList.Count - 1);
}
else if (result == DialogResult.OK && _vobSubOcrNOcrCharacter.ExpandSelection)
{
expandSelection = true;
}
else if (result == DialogResult.OK)
{
var c = _vobSubOcrNOcrCharacter.NOcrChar;
if (expandSelectionList.Count > 1)
c.ExpandCount = expandSelectionList.Count;
_nOcrDb.Add(c);
SaveNOcrWithCurrentLanguage();
string text = _vobSubOcrNOcrCharacter.NOcrChar.Text;
//string name = SaveCompareItem(item.NikseBitmap, text, _vobSubOcrNOcrCharacter.IsItalic, expandSelectionList.Count);
//var addition = new ImageCompareAddition(name, text, item.NikseBitmap, _vobSubOcrNOcrCharacter.IsItalic, listViewIndex);
//_lastAdditions.Add(addition);
matches.Add(new CompareMatch(text, _vobSubOcrNOcrCharacter.IsItalic, expandSelectionList.Count, null));
expandSelectionList = new List<ImageSplitterItem>();
}
else if (result == DialogResult.Abort)
{
_abort = true;
}
else
{
matches.Add(new CompareMatch("*", false, 0, null));
}
_italicCheckedLast = _vobSubOcrNOcrCharacter.IsItalic;
}
else if (item.NikseBitmap == null)
{
matches.Add(new CompareMatch(item.SpecialCharacter, false, 0, null));
}
else
{
CompareMatch match = GetNOcrCompareMatchNew(item, nbmpInput, _nOcrDb, checkBoxNOcrItalic.Checked, !checkBoxNOcrCorrect.Checked);
if (match == null)
{
//.........这里部分代码省略.........
示例15: 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)
{