anchor.diff:    {$IFDEF FPC}
     po: TBGRABitmap;
     {$ENDIF}
  -  FileNameA: string;
  +  MaskFile: array [TMaskType] of string;
  +  MaskTyp: TMaskType;
     Transparent: Byte;
   begin
     Assert(SameText(ExtractFileExt(aFilename), '.png'));
  
positive.code:       {$IFDEF WDC}
        for K := 0 to po.Height - 1 do
        for I := 0 to po.Width - 1 do
        if Cardinal(po.Pixels[I,K] and $FFFFFF) <> 0 then
        begin
          Tr := fRXData.RGBA[aIndex, K*po.Width+I] and $FF;
          Tg := fRXData.RGBA[aIndex, K*po.Width+I] shr 8 and $FF;
          Tb := fRXData.RGBA[aIndex, K*po.Width+I] shr 16 and $FF;
  
          //Determine color brightness
          ConvertRGB2HSB(Tr, Tg, Tb, Thue, Tsat, Tbri);
  
          //Make background RGBA black or white for more saturated colors
          if Tbri < 0.5 then
            fRXData.RGBA[aIndex, K*po.Width+I] := FLAG_COLOR_DARK
          else
            fRXData.RGBA[aIndex, K*po.Width+I] := FLAG_COLOR_LITE;
  
          //Map brightness from 0..1 to 0..255..0
          T := Trunc((0.5 - Abs(Tbri - 0.5)) * 510);
          fRXData.Mask[aIndex, K*po.Width+I] := T;
        end;
        {$ENDIF}
        {$IFDEF FPC}
        for K := 0 to po.Height - 1 do
        for I := 0 to po.Width - 1 do
        if Cardinal(po.GetPixel(I,K).red) <> 0 then
        begin
          Tr := fRXData.RGBA[aIndex, K*po.Width+I] and $FF;
          Tg := fRXData.RGBA[aIndex, K*po.Width+I] shr 8 and $FF;
          Tb := fRXData.RGBA[aIndex, K*po.Width+I] shr 16 and $FF;
  
          //Determine color brightness
          ConvertRGB2HSB(Tr, Tg, Tb, Thue, Tsat, Tbri);
  
          //Make background RGBA black or white for more saturated colors
          if Tbri < 0.5 then
            fRXData.RGBA[aIndex, K*po.Width+I] := FLAG_COLOR_DARK
          else
            fRXData.RGBA[aIndex, K*po.Width+I] := FLAG_COLOR_LITE;
  
          //Map brightness from 0..1 to 0..255..0
          T := Trunc((0.5 - Abs(Tbri - 0.5)) * 510);
          fRXData.Mask[aIndex, K*po.Width+I] := T;
        end;
        {$ENDIF}
      end;
      po.Free;
  
negative.code:       if fRXData.HasMask[ID] and (fRXData.Mask[ID, I*SizeX + K] > 0) then
        begin
          M := fRXData.Mask[ID, I*SizeX + K];
  
          //Replace background with corresponding brightness of Red
          if fRXData.RGBA[ID, I*SizeX + K] = FLAG_COLOR_DARK then
            //Brightness < 0.5, mix with black
            Png.Pixels[K,I] := M
          else
            //Brightness > 0.5, mix with white
            Png.Pixels[K,I] := $FF + (255 - M) * $010100;
        end
        else
  