mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Fix transparent color in bdsup export - the thehulk :)
This commit is contained in:
parent
ad4fdaf914
commit
cb071482a1
@ -308,6 +308,7 @@ namespace Nikse.SubtitleEdit.Core.BluRaySup
|
||||
public static byte[] CreateSupFrame(BluRaySupPicture pic, Bitmap bmp, double fps, int bottomMargin, int leftOrRightMargin, ContentAlignment alignment, Point? overridePosition = null)
|
||||
{
|
||||
var bm = new NikseBitmap(bmp);
|
||||
bm.SetTransparentTo(Color.Transparent);
|
||||
var colorPalette = GetBitmapPalette(bm);
|
||||
var pal = new BluRaySupPalette(colorPalette.Count);
|
||||
for (int i = 0; i < colorPalette.Count; i++)
|
||||
|
@ -1442,14 +1442,14 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Width == bitmap.Width && Height == bitmap.Height &&
|
||||
if (Width == bitmap.Width && Height == bitmap.Height &&
|
||||
Width == 0 && Height == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i<_bitmapData.Length; i++)
|
||||
for (int i = 0; i < _bitmapData.Length; i++)
|
||||
{
|
||||
if (_bitmapData[i] != bitmap._bitmapData[i])
|
||||
{
|
||||
@ -1459,5 +1459,21 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetTransparentTo(in Color transparent)
|
||||
{
|
||||
var buffer = new byte[4];
|
||||
buffer[0] = transparent.B;
|
||||
buffer[1] = transparent.G;
|
||||
buffer[2] = transparent.R;
|
||||
buffer[3] = transparent.A;
|
||||
for (var i = 0; i < _bitmapData.Length; i += 4)
|
||||
{
|
||||
if (_bitmapData[i + 3] == 0)
|
||||
{
|
||||
Buffer.BlockCopy(buffer, 0, _bitmapData, i, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
using Nikse.SubtitleEdit.Core.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Core.Enums;
|
||||
using Nikse.SubtitleEdit.Core.Interfaces;
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Core.VobSub;
|
||||
using Nikse.SubtitleEdit.Forms.Ocr;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.VideoPlayers;
|
||||
using System;
|
||||
@ -20,7 +20,6 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using Nikse.SubtitleEdit.Core.Interfaces;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user