Skip to content

Commit

Permalink
Merge pull request #231 from birbilis/master
Browse files Browse the repository at this point in the history
Fix for R-B color channels swap on Android and MacOS-X
  • Loading branch information
carloBarazzetta authored Jun 15, 2022
2 parents 7a332f5 + 63c01f3 commit 086c9fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ __recovery/

# Boss dependency manager vendor folder https://github.com/HashLoad/boss
modules/

Demo/Bin
6 changes: 4 additions & 2 deletions Image32/source/Img32.SVG.Core.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1187,9 +1187,11 @@ function UTF8StringToColor32(const value: UTF8String; var color: TColor32): Bool
//and in case the opacity has been set before the color
if (alpha < 255) then
color := (color and $FFFFFF) or alpha shl 24;
{$IFDEF ANDROID}

{$IF Defined(ANDROID) or Defined(MACOS) or Defined(MACOSX)}
color := SwapRedBlue(color);
{$ENDIF}
{$IFEND}

Result := true;
end;
//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Source/FMX.Image32SVG.pas
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ procedure TFmxImage32SVG.PaintToBitmap(ABitmap: TBitmap;

//Copy Image32 to Bitmap
FImage32.PreMultiply;
LSource := TBitMapData.Create(FImage32.Width, FImage32.Height, TPixelFormat.BGRA);
LSource := TBitMapData.Create(FImage32.Width, FImage32.Height, TPixelFormat.{$IF Defined(ANDROID) or Defined(MACOS) or Defined(MACOSX)}RGBA{$ELSE}BGRA{$IFEND});
LSource.Data := FImage32.PixelBase;
LSource.Pitch := FImage32.Width * 4;
ABitmap.SetSize(FImage32.Width, FImage32.Height);
Expand Down

0 comments on commit 086c9fc

Please sign in to comment.