Skip to content

Commit

Permalink
Windows RGBA bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LongDirtyAnimAlf committed Jul 3, 2018
1 parent 389bd83 commit f623c0d
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions Lazarus/Windows/vfwdemo1/UConvert.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@ interface
PARGB = ^TARGB;
TARGB = packed record
case Byte of
1: (B, G, R, A: Byte);
1: (A, R, G, B: Byte);
2: (Color: LongWord);
end;

PARGBArray = ^TARGBArray;
TARGBArray = array[0..0] of TARGB;

PBGRA = ^TBGRA;
TBGRA = packed record
case Byte of
1: (B, G, R, A: Byte);
2: (Color: LongWord);
end;
PBGRAArray = ^TBGRAArray;
TBGRAArray = array[0..0] of TBGRA;

PRGB = ^TRGB;
TRGB = packed record
B, G, R: Byte;
Expand All @@ -52,6 +60,7 @@ interface
end;

function CodecToARGB(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word; Codec: LongWord): Boolean;
function CodecToBGRA(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word; Codec: LongWord): Boolean;
function ARGBToCodec(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word; Codec: LongWord): Boolean;

function Conv15To32(Color: Word): LongWord; overload;
Expand Down Expand Up @@ -93,6 +102,25 @@ function CodecToARGB(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word;
end;
end;

function CodecToBGRA(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word; Codec: LongWord): Boolean;
begin
Result:=True;
{
case Codec of
BI_RGB: case BitCount of
16: Conv16To32(src, dest, Width, Height);
24: Conv24To32(src, dest, Width, Height);
32: Move(src^, dest^, Width*Height*4);
end;
UYVY: UYVYtoARGB(src, dest, Width, Height);
YUY2: YUY2toARGB(src, dest, Width, Height);
I420: I420toARGB(src, dest, Width, Height);
else
Result:=False;
end;
}
end;

function ARGBToCodec(Src, Dest: Pointer; Width, Height: Integer; BitCount: Word; Codec: LongWord): Boolean;
begin
Result:=True;
Expand Down

0 comments on commit f623c0d

Please sign in to comment.