Board index » delphi » Canvas-drawing to Graphics-file

Canvas-drawing to Graphics-file

Hi:

Can anyone help me with the following?

I want to save whatever is painted on a TCanvas to a graphics-file
(BMP, PCX maybe). My hitherto attempts to translate Pascal BGI-to-PCX
routines have failed altogether.

Does anyone have a clue (Replies both to the news.group and to private
eMail hartkamp@uni-duesseldorf are welcome).

Regards, N. Hartkamp

 

Re:Canvas-drawing to Graphics-file


Quote
Dr. Norbert Hartkamp wrote:
> I want to save whatever is painted on a TCanvas to a graphics-file
> (BMP, PCX maybe). My hitherto attempts to translate Pascal BGI-to-PCX
> routines have failed altogether.

If you are drawing on a bitmap's canvas, you can use the SaveToFile
method.  Otherwise, copy the image from the canvas to a TBitmap, and
then use SaveToFile.

Cheers.
E.

---------------------------------
Eckhard Gartz
UNIBase Development
gart...@telkom.co.za

Re:Canvas-drawing to Graphics-file


On Tue, 11 Mar 1997 15:21:42 +0200, Eckhard Gartz

Quote
<gart...@telkom.co.za> wrote:
>If you are drawing on a bitmap's canvas, you can use the SaveToFile
>method.  Otherwise, copy the image from the canvas to a TBitmap, and
>then use SaveToFile.

>Cheers.
>E.

Seems that I've missed the obvious.
Thanks, N. Hartkamp

Re:Canvas-drawing to Graphics-file


On Tue, 11 Mar 1997 15:21:42 +0200, Eckhard Gartz

Quote
<gart...@telkom.co.za> wrote:
>If you are drawing on a bitmap's canvas, you can use the SaveToFile
>method.  Otherwise, copy the image from the canvas to a TBitmap, and
>then use SaveToFile.

>Cheers.
>E.

Seems that I've missed the obvious.
Thanks, N. Hartkamp

Re:Canvas-drawing to Graphics-file


Quote
Dr. Norbert Hartkamp wrote:

> Hi:

> Can anyone help me with the following?

> I want to save whatever is painted on a TCanvas to a graphics-file
> (BMP, PCX maybe). My hitherto attempts to translate Pascal BGI-to-PCX
> routines have failed altogether.

> Does anyone have a clue (Replies both to the news.group and to private
> eMail hartkamp@uni-duesseldorf are welcome).

> Regards, N. Hartkamp

procedure TMainForm.WallPaper(Sender: TObject; Tiled:Integer);
const
        WPFile = 'c:\Windows\BryanV.BMP';
var
        i:tinifile;
        bits:tBitmap;
        l:Boolean;
{       s:string;
        p:pointer;}
begin
        bits:=tBitmap.create;
        with ActiveMDIChild as tTargaView do begin
                Bits.Height:=Canvas.cliprect.Bottom;
                Bits.Width:=Canvas.Cliprect.Right;

                Bits.Canvas.CopyMode := cmSrcCopy;
                Bits.Canvas.CopyRect(ClientRect, Canvas, ClientRect);

                Bits.SaveToFile(wpfile);
        end;
        bits.free;
        {save it}
        i:=tinifile.create('Win.ini');
        i.WriteString('Desktop','WallPaper',wpfile);
        i.WriteInteger('Desktop','TileWallPaper',Tiled);
        i.free;

        l:=SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, NIL,
SPIF_SENDWININICHANGE);

end;

--
-----------------------------------------
Software Services - Making Windows Scream
http://www.invsn.com/softserv/
bry...@thevision.net
-----------------------------------------

Re:Canvas-drawing to Graphics-file


try sth like that:

//***************************
procedure TForm3.SaveasBitmap1Click(Sender: TObject);
var
  Bitmap1  : TBitmap;
  x,y      : longint;
  Filename : string;
begin
  Bitmap1 := TBitmap.Create;
  x:=Form3.clientwidth;
  y:=Form3.clientheight;
  Bitmap1.width:=x;
  Bitmap1.height:=y;
//******here comes the important part************
  Bitmap1.Canvas.CopyRect(Rect(0,0,x,y), Canvas, Rect(0,0,x,y));
//***********************************************
  SaveDialog1.Filter := 'Bitmaps|*.bmp';
  SaveDialog1.Execute;
  if Savedialog1.Filename='' then Filename:='noname.bmp'
  else begin
    Filename:=SaveDialog1.Filename;
    Filename:=Filename+'.bmp';
  end;
  Bitmap1.savetoFile(Filename);
  Bitmap1.Free;
end;
//**************************

good luck,

guenter

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

Quote
On Tue, 11 Mar 1997, Eckhard Gartz wrote:
> Dr. Norbert Hartkamp wrote:

> > I want to save whatever is painted on a TCanvas to a graphics-file
> > (BMP, PCX maybe). My hitherto attempts to translate Pascal BGI-to-PCX
> > routines have failed altogether.

> If you are drawing on a bitmap's canvas, you can use the SaveToFile
> method.  Otherwise, copy the image from the canvas to a TBitmap, and
> then use SaveToFile.

> Cheers.
> E.

> ---------------------------------
> Eckhard Gartz
> UNIBase Development
> gart...@telkom.co.za

Re:Canvas-drawing to Graphics-file


does anybody know where to get FFT and other math-routines for
pascal/delphi?

thanx a lot,

guenter

Re:Canvas-drawing to Graphics-file


In article
<Pine.HPP.3.92.970311194849.28166E-100...@wpax22.physik.uni-wuerzburg.de>,
   Guenter Guttroff <g...@Cip.Physik.Uni-Wuerzburg.DE> wrote:
]-does anybody know where to get FFT and other math-routines for
]-pascal/delphi?
]-

Try this...

        Some Sources of Numerical Analysis Code in Pascal

          =>   ftp://cloudlab.larc.nasa.gov/pnumsrc.htm

there are several links to libraries containing FFT code.

Mark Vaughan

Re:Canvas-drawing to Graphics-file


Guenter,
        This is extremely useful.  I am looking for saving to GIF, so using
this method all I really need if just top convert now from BMP to GIF.  

Is anyone aware of such as beast that would allow me to do it in memory
rather than saving to disk and using utilities?

Thanks, Gus

Quote
Guenter Guttroff wrote:

> try sth like that:

> //***************************
> procedure TForm3.SaveasBitmap1Click(Sender: TObject);

 .....

Quote
> //**************************

--
+--------------------------------------------------------------------+
| Gus Estrella                 International Bull Telecommunications |
| Manager, Network Management Systems                    Groupe Bull |
| G.Estre...@bull.com           http://www.digitaldaze.com/estrella/ |
|                                                                    |
| "Don't assume intent or malice until stupidity has been ruled out" |
+--------------------------------------------------------------------+

Re:Canvas-drawing to Graphics-file


In article <5g7or4$...@reznor.larc.nasa.gov>,
   m.a.vaug...@larc.nasa.gov (Mark Vaughan) wrote:
]-In article
]-<Pine.HPP.3.92.970311194849.28166E-100...@wpax22.physik.uni-wuerzburg.de>,
]-   Guenter Guttroff <g...@Cip.Physik.Uni-Wuerzburg.DE> wrote:
]-]-does anybody know where to get FFT and other math-routines for
]-]-pascal/delphi?
]-]-
]-
]-
]-Try this...
]-
]-        Some Sources of Numerical Analysis Code in Pascal
]-
]-          =>   ftp://cloudlab.larc.nasa.gov/pnumsrc.htm
]-
]-there are several links to libraries containing FFT code.
]-
]-
]-Mark Vaughan

and if it's just FFT stuff you want, then search recent posts to
this group using DejaNews...there was a fairly lengthy exchange
by David Ullrich et. al. with LOTS of code included.

Mark Vaughan

Re:Canvas-drawing to Graphics-file


Quote
Mark Vaughan wrote:
> [..]

> and if it's just FFT stuff you want, then search recent posts to
> this group using DejaNews...there was a fairly lengthy exchange
> by David Ullrich et. al. with LOTS of code included.

        Yeah. If anybody does look up those things he or she
should be certain to find the one that says something about
"... correct version" in the title - my first couple of
posts on the topic were wrong, wrong, wrong.

        If you find a post containg an embarassed explanation
of how the wrong wrong wrong version could slip through the
cracks the way it did you may be safe - I believe the version
there is correct.

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Re:Canvas-drawing to Graphics-file


Quote
In article <332C4C46.2...@math.okstate.edu>, David Ullrich <ullr...@math.okstate.edu> wrote:
>Mark Vaughan wrote:
>> [..]

>> and if it's just FFT stuff you want, then search recent posts to
>> this group using DejaNews...there was a fairly lengthy exchange
>> by David Ullrich et. al. with LOTS of code included.

>        Yeah. If anybody does look up those things he or she
>should be certain to find the one that says something about
>"... correct version" in the title - my first couple of
>posts on the topic were wrong, wrong, wrong.

>        If you find a post containg an embarassed explanation
>of how the wrong wrong wrong version could slip through the
>cracks the way it did you may be safe - I believe the version
>there is correct.

The corrected version is also on my site.

Check the MATH section

The Graphical Gome      (r...@ktibv.nl)

Senior Software Engineer

--------------------------------------------------------------------------------------------------------------
Delphi developers FAQ at http://www.gnomehome.demon.nl/uddf/index.htm
Non frame version     at  http://www.gnomehome.demon.nl/uddf/indexnf.htm

Re:Canvas-drawing to Graphics-file


Quote
The Graphical Gnome wrote:

> In article <332C4C46.2...@math.okstate.edu>, David Ullrich <ullr...@math.okstate.edu> wrote:
> >Mark Vaughan wrote:
> >> [..]

> >> and if it's just FFT stuff you want, then search recent posts to
> >> this group using DejaNews...there was a fairly lengthy exchange
> >> by David Ullrich et. al. with LOTS of code included.

> >        Yeah. If anybody does look up those things he or she
> >should be certain to find the one that says something about
> >"... correct version" in the title - my first couple of
> >posts on the topic were wrong, wrong, wrong.

> >        If you find a post containg an embarassed explanation
> >of how the wrong wrong wrong version could slip through the
> >cracks the way it did you may be safe - I believe the version
> >there is correct.

> The corrected version is also on my site.

> Check the MATH section

        And thanks again for changing that {*word*249}sy bug when I asked.
(Actually the "final" version that got posted here gives a little
better performance than the previous versions, in addition to
fixing the wrong wrong wrong part. Never did get it up to the
speed of the Numerical Recipes version but it's close, and I
personally like the recursive one better, it's easier for me to
see what's going on.)

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Re:Canvas-drawing to Graphics-file


In
Article<Pine.HPP.3.92.970311194849.28166E-100...@wpax22.physik.uni-wuerzburg.de

Quote
>, <g...@Cip.Physik.Uni-Wuerzburg.DE> writes:
> Path:

news.NetVision.net.il!news-penn.gsl.net!news.gsl.net!xfer.kren.nm.kr!nntp.kreon
et.re.kr!usenet.kornet.nm.kr!howland.erols.net!cam-news-hub1.bbnplanet.com!news
bbnplanet.com!news.maxwell.syr.edu!news.apfel.de!fu-berlin.de!uniol!uni-erlang
en.de!winx03!wpax22.physik.uni-wuerzburg.de!ggut
Quote
> From: Guenter Guttroff <g...@Cip.Physik.Uni-Wuerzburg.DE>
> Newsgroups:

comp.lang.pascal.delphi.misc,comp.lang.pascal.delphi.components.misc
Quote
> Subject: FFT-routines???
> Date: Tue, 11 Mar 1997 19:50:44 +0100
> Organization: University of Wuerzburg, Germany
> Lines: 7
> Message-ID:

<Pine.HPP.3.92.970311194849.28166E-100...@wpax22.physik.uni-wuerzburg.de>
Quote
> References: <332444d0.80...@eunetnews.germany.eu.net>

<33255C66.4...@telkom.co.za>
<Pine.HPP.3.92.970311193748.28166D-100...@wpax22.physik.uni-wuerzburg.de>
Quote
> NNTP-Posting-Host: wpax22.physik.uni-wuerzburg.de
> Mime-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> X-Sender: g...@wpax22.physik.uni-wuerzburg.de
> In-Reply-To:

<Pine.HPP.3.92.970311193748.28166D-100...@wpax22.physik.uni-wuerzburg.de>
Quote
> Xref: news.NetVision.net.il comp.lang.pascal.delphi.misc:51530

comp.lang.pascal.delphi.components.misc:4583

Quote

> does anybody know where to get FFT and other math-routines for
> pascal/delphi?

> thanx a lot,

> guenter

Hai and thenks I remmember youre Q was discused so look in www.dejanews.com

         arnon

Re:Canvas-drawing to Graphics-file


Quote
arn...@netvision.net.il wrote:

> Hai and thenks I remmember youre Q was discused so look in www.dejanews.com

>          arnon

Can anyone email me a tested FFT dataset before and after transform? I
am finishing a FFT component and wanted to test it.

Thanks,

Michael

Other Threads