Solved

Saving TImages to memory

Posted on 2002-06-07
6
159 Views
Last Modified: 2010-04-04
I have a TImage on my form. How do i save the TImage to the memory and then draw it directly from the memory to the form at the co-ordinates I want it at? (i.e. like the QBASIC Get() and Put() functions).
0
Comment
Question by:tim_nash
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7061553
? just store it in the needed imageobject
(TBitmap for a bitmap for example)

use the bitblt-api to draw the image where you want
0
 

Author Comment

by:tim_nash
ID: 7061604
The image is a JPEG TImage. What would the code to do this be please (I am a newbie and am not sure how to work these things). I need two pieces of code:
1 piece Stores the image in the memory
1 piece draws the image from the memory to the correct co-ordinates
0
 

Accepted Solution

by:
Stormmin66 earned 75 total points
ID: 7062236
add JPEG to uses

MyJPeg: TJPegImage;

MyJPeg := Image1.Picture.Graphic; // Load image
Form1.Canvas.Draw( 100, 0, MyJPeg ); // Draw image
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Stormmin66
ID: 7062250
could just save as bitmap as well, really doesn't matter, using TBitMap instead of TJPegImage.
0
 

Expert Comment

by:Stormmin66
ID: 7062254
sorry bout above mees up.

should be MyJPeg := TJPegImage.Create;
MyJPeg.Assign( Image1.Picture.Graphic );
0
 

Author Comment

by:tim_nash
ID: 7062780
Perfect. The code I was planning on using was kinda fifty lines long whereas this is really easy to use as WELL as short. Thanx to stormmin66. Definately recommended.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question