mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 06:22:38 +01:00
Trying to fix transparent for "Ocr window" regarding transport streams
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2377 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
4663366bf9
commit
8092da1b7f
@ -1269,6 +1269,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
nDvbBmp.CropTransparentSidesAndBottom(2, true);
|
||||
if (checkBoxTransportStreamGetColorAndSplit.Checked)
|
||||
_dvbSubColor = nDvbBmp.GetBrightestColor();
|
||||
if (checkBoxAutoTransparentBackground.Checked)
|
||||
nDvbBmp.MakeBackgroundTransparent(140); //TODO: Put in UI or settings
|
||||
if (checkBoxTransportStreamGrayscale.Checked)
|
||||
nDvbBmp.GrayScale();
|
||||
dvbBmp.Dispose();
|
||||
|
@ -972,5 +972,23 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Make pixels with some transparency completely transparent
|
||||
/// </summary>
|
||||
/// <param name="minAlpha">Min alpha value, 0=transparent, 255=fully visible</param>
|
||||
internal void MakeBackgroundTransparent(int minAlpha)
|
||||
{
|
||||
byte[] buffer = new byte[4];
|
||||
buffer[0] = 0; // B
|
||||
buffer[1] = 0; // G
|
||||
buffer[2] = 0; // R
|
||||
buffer[3] = 0; // A
|
||||
for (int i = 0; i < _bitmapData.Length; i += 4)
|
||||
{
|
||||
if (_bitmapData[i + 3] < minAlpha)
|
||||
Buffer.BlockCopy(buffer, 0, _bitmapData, i, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user