Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-06

Two fpimage questions

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

theo

Hello

Can I resample / resize an TFpMemoryImage without losing the alpha channel? If I use StretchDraw, the resulting image is no longer alpha-transparent. Am I missing sth.?

Ist it possible to unregister / replace an fpimagereader? I saw they are registered in the initialization section using ImageHandlers.RegisterImageReader (..

Thank you
Best regards
Theo

Reply by email

Michael Van Canneyt
to theo
theo wrote 5 lines
Hello Can I resample / resize an TFpMemoryImage without losing the alpha channel? If I use StretchDraw, the resulting image is no longer alpha-transparent. Am I missing sth.?

It probably depends on the default stretching algorithm ?

Ist it possible to unregister / replace an fpimagereader? I saw they are registered in the initialization section using ImageHandlers.RegisterImageReader (..

You cannot. A workaround is maybe to keep references to all registered handlers, free the manager, recreate it and re-register all handlers except the one you want removed.

Please file a bugreport (feature request) so a handler can be un-registered.

Michael.

Reply by email

theo
You cannot. A workaround is maybe to keep references to all registered

handlers,

free the manager, recreate it and re-register all handlers except the one you want removed. Please file a bugreport (feature request) so a handler can be un-registered.

Thanks. I've tried that, and it works. But I saw that Lazarus is not using these registered handlers, so it doesn't really help me. For the record:

  Om:=ImageHandlers;
  ImageHandlers:=TImageHandlersManager.Create;
  for i:=0 to Om.Count-1 do
    begin
      tn:=Om.TypeNames[i];
      ext:=Om.Extentions[tn];
      ir:=Om.ImageReader[tn];
      iw:=Om.ImageWriter[tn];
      if tn'JPEG Graphics'then if irnil then
ImageHandlers.RegisterImageReader(tn,ext,ir);
      if iwnil then ImageHandlers.RegisterImageWriter(tn,ext,iw);
    end;
  Om.Free;

Thank you Michael!

Reply by email

theo
You cannot. A workaround is maybe to keep references to all registered

handlers,

free the manager, recreate it and re-register all handlers except the one you want removed. Please file a bugreport (feature request) so a handler can be un-registered.

Thanks. I've tried that, and it works. But I saw that Lazarus is not using these registered handlers, so it doesn't really help me. For the record:

  Om:=ImageHandlers;
  ImageHandlers:=TImageHandlersManager.Create;
  for i:=0 to Om.Count-1 do
    begin
      tn:=Om.TypeNames[i];
      ext:=Om.Extentions[tn];
      ir:=Om.ImageReader[tn];
      iw:=Om.ImageWriter[tn];
      if tn'JPEG Graphics'then if irnil then
ImageHandlers.RegisterImageReader(tn,ext,ir);
      if iwnil then ImageHandlers.RegisterImageWriter(tn,ext,iw);
    end;
  Om.Free;

Thank you Michael!

Reply by email