Jump to content
Turan Can

Is there codec for FMX, Android Bitmap ?

Recommended Posts

Hi All,

 

FMX Project.

"TBitmapCodecManager" doesn't support bitmap on Android?

These are the only ones that come when I enter this "TBitmapCodecManager.SaveToStream(" method.

POSIX

jpg, tif, png

 

WINDOWS

jpg, tif, png, bmp ...

 

 

for Descriptor in FBitmapCodecClassDescriptors do

if (SameText(Extension, Descriptor.Extension, loUserLocale) or SameText('.' + Extension, Descriptor.Extension,  loUserLocale)) and Descriptor.CanSave then

 

--------------------------------------------------------------------

uses FMX.Graphics, FMX.Surfaces;

 

var

  Stream: TMemoryStream;
  Surf: TBitmapSurface;

begin

                Stream := TMemoryStream.Create;
                try
                  Surf := TBitmapSurface.Create;
                  try
                    Surf.Assign(FBmpNew);
                    //TBitmapCodecManager.RegisterBitmapCodecClass('.bmp', 'bmp', True, ......??? 
                    TBitmapCodecManager.SaveToStream(Stream, Surf, '.bmp');
                  finally
                    Surf.Free;
                  end;
                  Stream.Position := 0;
                  Stream.SaveToStream(FStream);
                finally
                  Stream.Free;
                end;

Share this post


Link to post

No, FMX does not support the BMP format on Android by default.  The documentation is quite clear on which formats are implemented on each platform:

 

formats.thumb.png.9bd99a3bfc173e49677e4b0d6527925c.png

 

If you want to use BMP on Android, you can write your own class derived from TCustomBitmapCodec to handle that, and then register it with TBitmapCodecManager at runtime.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×