Hi all,

I'm trying to create a program that autopopulates my asdb file with images , for testing I'm trying to load a bmp image 32x32 .
Code:
 procedure TForm1.Button1Click(Sender: TObject);
var
 PxFm: TPxFm;
 pSize: TPoint;
 Image: TBitmap;
 Dest: TBitmap;
 Tolerance: Integer;
 MaskColor: Cardinal;
 IsMasked: Boolean;
 Stream: TMemoryStream;
begin
 ASDB := TAsdb.Create(Self);
 ASDB.FileName:='media.asdb';
 ASDB.OpenMode:=opUpdate;
  if (not ASDb.Update()) then
   begin
    ShowMessage('Failed opening ASDb archive!');
    Exit;
   end;
// change the following format, if necessary
 PxFm.Format:= COLOR_A8R8G8B8;
 // retreive Texture Size from edit boxes
 PxFm.TextureWidth := 32;
 PxFm.TextureHeight:= 32;
 // retreive Pattern Size from edit boxes
 PxFm.PatternWidth := 32;
 PxFm.PatternHeight:= 32;
 // this variable is used for better readability only
 pSize:= Point(PxFm.PatternWidth, PxFm.PatternHeight);
 // this size can be smaller than pattern size to add padding
 PxFm.VisibleWidth := PxFm.PatternWidth;
 PxFm.VisibleHeight:= PxFm.PatternHeight;
 // retreive mask color and tolerance
 IsMasked:= false;
 MaskColor := Shape1.Brush.Color and $FFFFFF;
 Tolerance:= 15;
 // load the image
 Image:= TBitmap.Create();
 LoadBitmap('0.bmp', Image, ifBMP);
 // update some attributes
 PxFm.PatternCount:= (Image.Width div pSize.X) * (Image.Height div pSize.Y);
 // create destination bitmap
 Dest:= TBitmap.Create();
 TileBitmap(Dest, Image, Point(PxFm.TextureWidth, PxFm.TextureHeight),
  pSize, pSize, IsMasked, MaskColor, Tolerance);
 // create auxiliary stream to write PxFm-formatted image data
 Stream:= TMemoryStream.Create();
 WriteBitmapPxFm(Stream, Dest, PxFm);
 // we don't need destination image anymore
 Dest.Free();
 // position to the beginning of our stream
 Stream.Seek(0, soFromBeginning);
 ASDb.WriteStream('0.image', Stream, recGraphics);
 Stream.Free();
end;
I get a SIGSEGV at TileBitmap , specifically this one :

Code:
 
 procedure UnmaskAlpha(Dest: TBitmap);
var
 i, j: Integer;
 pl: PLongword;
begin
 Dest.PixelFormat:= pf32bit;
 for j:= 0 to Dest.Height - 1 do
  begin
   pl:= bmp2xlbmp(Dest).Scanline[j];
   for i:= 0 to Dest.Width - 1 do
    begin
     pl^:= pl^ or $FF000000;  <--------------------------- here 
     Inc(pl);
    end;
  end;
end;
Any idea what is wrong, manually adding this file with the Asphyre Manager , same properties is working fine. But it takes a lot of time to add 259 images....

Greeetings
Robert