• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - salvok5

1
Help & Questions / Re: Trasparent Gif on Firemonkey
22 December 2012, 15:50:26
On delphi XE3 the "ImagingFmx.pas" by 4 error.
2
Help & Questions / Trasparent Gif on Firemonkey
20 December 2012, 17:25:05
I'm trying to convert a frame of animated gif file to "FMX TImage".
The problem with this code is that there is no transparency in the alpha channel does not work.
Sorry for my bad inghlese.

Code (pascal) Select
procedure TForm5.Button1Click(Sender: TObject);
var
  I,y,x: LongInt;
  T: Int64;
  io:Tmemorystream;
  Dest, Src: PByte;
  Alpha: Byte;
begin
    try
      FImage := TMultiImage.Create;
      FImage2 := TMultiImage.Create;

      // Load all subimages in file
      T := ImagingUtility.GetTimeMicroseconds;
      FImage.LoadMultiFromFile('E:\espulso.gif');
      FImage2.LoadMultiFromFile('E:\espulso.gif');

      for I := 0 to FImage.ImageCount - 1 do
      begin
        FImage.ActiveImage := I;
        if not (FImage.Format in TImagingCanvas.GetSupportedFormats) then
          FImage.Format := ifA8R8G8B8;
        for Y := 0 to Height - 1 do
        begin
          Src := FImage.Scanline[y];
          Dest := FImage2.ScanLine[y];
          for X := 0 to Width - 1 do
          begin
            Alpha := Src[X * 4 + 3];
            Dest[X * 4 + 0] := Src[x * 4 + 0] * Alpha div 255;
            Dest[X * 4 + 1] := Src[x * 4 + 1] * Alpha div 255;
            Dest[X * 4 + 2] := Src[x * 4 + 2] * Alpha div 255;
            Dest[X * 4 + 3] := Alpha;
          end;
        end;
        io:=Tmemorystream.Create;
        FImage2.SaveToStream('gif',io);
        image1.Bitmap.LoadFromStream(io);
        ............
        break;

      end;
      // Activate first image and update UI
      FImage.ActiveImage := 0;
    except
      raise;
    end;

end;


SMF spam blocked by CleanTalk