anchor.diff:  var
     I, K: Word;
     T: Cardinal;
  -  Png: TPNGObject;
  +  {$IFDEF WDC} Png: TPNGObject; {$ENDIF}
  +  {$IFDEF FPC} po: TBGRABitmap; {$ENDIF}
     Folder: string;
   begin
     if EXPORT_SPRITE_ATLASES then
  
positive.code:     Folder := ExeDir + 'Export\GenTextures\';
      ForceDirectories(Folder);
  
      Png := TPNGObject.CreateBlank(COLOR_RGBALPHA, 8, aWidth, aHeight);
      try
        for I := 0 to aHeight - 1 do
  
negative.code:     finally
        Png.Free;
      end;
      {$ENDIF}
  
      {$IFDEF FPC}
      po := TBGRABitmap.Create(aWidth, aHeight, BGRABlack);
      try
        for I := 0 to aHeight - 1 do
        for K := 0 to aWidth - 1 do
        begin
          T := (PCardinal(Cardinal(@Data[0]) + (I * aWidth + K) * 4))^;
          //I can't figure out how to get transparency to save in PNGs, so for now everything is opaque
          po.CanvasBGRA.Pixels[K,I] := T and $FFFFFF;
          po.AlphaPixel(K,I,255);
        end;
  
        po.SaveToFile(Folder + aFilename + '.png');
      finally
        po.Free;
      end;
      {$ENDIF}
    end;
  end;
  
  