Changeset 59 for trunk/Forms


Ignore:
Timestamp:
Dec 8, 2021, 11:33:52 PM (3 years ago)
Author:
chronos
Message:
  • Added: Support for GIF images for contact photo.
  • Fixed: Saving multi-line values.
  • Fixed: Escaping combined values with backslash symbol.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContact.pas

    r58 r59  
    288288  Stream: TMemoryStream;
    289289  JpegImage: TJpegImage;
     290  GifImage: TGIFImage;
    290291  PngImage: TPortableNetworkGraphic;
    291292begin
     
    344345          PngImage.Free;
    345346        end;
     347      end else
     348      if PhotoProperty.Attributes.IndexOf('GIF') <> -1 then begin
     349        GifImage := TGIFImage.Create;
     350        try
     351          try
     352            GifImage.SetSize(ImagePhoto.Picture.Bitmap.Width, ImagePhoto.Picture.Bitmap.Height);
     353            GifImage.Canvas.Draw(0, 0, ImagePhoto.Picture.Bitmap);
     354            GifImage.SaveToStream(Stream);
     355          except
     356          end;
     357        finally
     358          GifImage.Free;
     359        end;
    346360      end else begin
    347361        try
     
    372386  JpegImage: TJpegImage;
    373387  PngImage: TPortableNetworkGraphic;
     388  GifImage: TGIFImage;
    374389  Stream: TMemoryStream;
    375390  PhotoProperty: TContactProperty;
     
    436451            PngImage.Free;
    437452          end;
     453        end else
     454        if PhotoProperty.Attributes.IndexOf('GIF') <> -1 then begin
     455          GifImage := TGIFImage.Create;
     456          try
     457            try
     458              GifImage.LoadFromStream(Stream);
     459              with ImagePhoto.Picture.Bitmap do begin
     460                PixelFormat := pf24bit;
     461                SetSize(GifImage.Width, GifImage.Height);
     462                Canvas.Draw(0, 0, GifImage);
     463              end;
     464              ProfilePhotoActive := True;
     465            except
     466              ProfilePhotoActive := False;
     467            end;
     468          finally
     469            GifImage.Free;
     470          end;
    438471        end else begin
    439472          try
Note: See TracChangeset for help on using the changeset viewer.