Sign in Join

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

Mailing lists / lazarus / 2008-05

from hfiandor

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Héctor Fiandor Rosario

Dear sirs:

I am a new member of the FP group, with litle experience in turboPascal and Delphi5.

Now I am trying to rewrite some of my products in Delphi5 to FreePascal for windows

I have e methods used in Delphi5 with this declaration:

FormImage := fDiplo2Interno.GetFormImage;

because I prepare a Form with some components and the appearence of a Diploma, and when finished,
I convert to a jpeg image and SaveToFile as a jpeg.

I have not found in FreePascal how to do this.

If you can help me, I will thanks you very much.

yours,

Ing. H?ctor F. Fiandor

Reply by email

Marco Alvarado
to Héctor Fiandor Rosario

Hello! You can use the Vampyre imaging library:

http://imaginglib.sourceforge.net/

It has a complete documentation.

-Marco

2008/5/12 H?ctor Fiandor Rosario :

Show quoted text 30 lines
Dear sirs: I am a new member of the FP group, with litle experience in turboPascal and Delphi5. Now I am trying to rewrite some of my products in Delphi5 to FreePascal for windows I have e methods used in Delphi5 with this declaration: FormImage := fDiplo2Interno.GetFormImage; because I prepare a Form with some components and the appearence of a Diploma, and when finished, I convert to a jpeg image and SaveToFile as a jpeg. I have not found in FreePascal how to do this. If you can help me, I will thanks you very much. yours, Ing. H?ctor F. Fiandor _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Gerard N/A
to Héctor Fiandor Rosario: Dear sirs: I am a new member of the FP group, with litle experience in turboPascal and…

Hi,

Get TCustomForm.GetFormImage is not yet implemented. I opened a bug report about his:
http://bugs.freepascal.org/view.php?id=11292
I was about to propose a quick pach, but can't figure out how to get the right offset to paint just the form's client area, since it seems (in win32 widgetset, at least) that ClientWidth=Width and Clientheight=Height.

Regards,

Gerard.

H?ctor Fiandor Rosario wrote 30 lines
Dear sirs: I am a new member of the FP group, with litle experience in turboPascal and Delphi5. Now I am trying to rewrite some of my products in Delphi5 to FreePascal for windows I have e methods used in Delphi5 with this declaration: FormImage := fDiplo2Interno.GetFormImage; because I prepare a Form with some components and the appearence of a Diploma, and when finished, I convert to a jpeg image and SaveToFile as a jpeg. I have not found in FreePascal how to do this. If you can help me, I will thanks you very much. yours, Ing. H?ctor F. Fiandor _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Gerard N/A
to Gerard N/A
Gerard N/A wrote 10 lines
Hi, Get TCustomForm.GetFormImage is not yet implemented. I opened a bug report about his: http://bugs.freepascal.org/view.php?id=11292 I was about to propose a quick pach, but can't figure out how to get the right offset to paint just the form's client area, since it seems (in win32 widgetset, at least) that ClientWidth=Width and Clientheight=Height.

Here's a quick and dirty solution without patching the LCL:

interface
type
  THackForm = class(TForm)
  public
    function GetClientOrigin: TPoint; override;
  end;
implementation
function THackForm.GetClientOrigin: TPoint;
begin
  Result:=inherited GetClientOrigin;
end;

and then

function GetFormImage(aForm: TForm): TBitmap;
begin
  Result := TBitmap.Create;
  try
   Result.Width  := aForm.ClientWidth;
   Result.Height := aForm.ClientHeight;
   Result.Canvas.Brush := aForm.Brush;
   Result.Canvas.FillRect(aForm.ClientRect);
   Result.Canvas.Lock;
   try
     aForm.PaintTo(Result.Canvas.Handle,
aForm.Left-THackForm(aForm).GetClientOrigin.X,
aForm.Top-THackForm(aForm).GetClientOrigin.Y);
   finally
     Result.Canvas.Unlock;
   end;
  except
   Result.Free;
   raise;
  end;
end;

Regards,

Gerard.

Reply by email

Gerard N/A
to Héctor Fiandor Rosario

Hi Hector,

This has been fixed in the latest SVN release for Win32 and GTK2.

Saludos,

Gerard.

H?ctor Fiandor Rosario wrote 20 lines
Dear sirs: thanks to all who answer my question about FormImage := fDiplo2Interno.GetFormImage; I have received a contribution by a friend from Guatemala and really, it works very pretty. Very simple. thanks very much, Ing. H?ctor F. Fiandor _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email