?
Solved

How do create a routine to print a Delphi TImage together with other Objects on TImage's Parent

Posted on 2009-04-02
10
Medium Priority
?
367 Views
Last Modified: 2013-11-23
I have an application that applies a floor plan as dumb JPG picture as the picture property of a TImage. The parent of the TImage is a TPanel. Inteligent icons also of TPanel are placed and dragged into place on the TPanel.  See attached sample picture file.  I need to print the floor plan together with the TPanel icons in high quality.  I tried to use a screen print but upon printing the quality becomes hazy so I need to write a proper printer routine for my application, pleae advise.
Floor-Plan.JPG
0
Comment
Question by:HenryM2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 14

Expert Comment

by:SteveBay
ID: 24049222
You will not be able to make low quality image print as a high quality image.
Think you are going to have to render a high quality image and print that.  You could create a Bitmap in memory and draw your objects to that and then print it or perhaps you could draw directly to the Printer.Canvas.  You would have to scale every thing up and do all of the drawing manually.
Either method is going to require a lot of code as I don't believe there is a simple solution to this without going to third party components.

0
 

Author Comment

by:HenryM2
ID: 24049390
Tanks for your reply. By high quality print, I mean the print should be at least the quality of what is viewed on the screen, not worse.  Is this still a difficult thing to achieve?  How would one render a high quality image?
0
 
LVL 14

Expert Comment

by:SteveBay
ID: 24049634
The problem is that screen resolution is considerably less than the resolution of printers. When you print the screen capture you are printing using all of the image data that are available. It's just does not look good when scaled up to fill a printer canvans. If you were to print pixel for pixel from the screen to the printer you would find an image with exactly the same quality but it would be quite small.
To draw a higher resolution images you should look at the drawing methods of TCanvas.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:HenryM2
ID: 24050297
This may sound silly, but would there be a way to basically redraw the screen immage onto the TCanvas?  Thus, some code that can recognise lines and coloured blocks, (possibly text will be seen as a series of lines) on the screen immage, and recreate them on the canvas as vector graphics.
0
 
LVL 14

Expert Comment

by:SteveBay
ID: 24050437
While I don't know how you are drawing on the screen to begin with, I can imagine that you could re-use some of your code by simply adding a multiplier in the the drawing methods. Rectangle sizes, line lengths, and font sizes all multiply by 1 on screen and by 6 on printer. The ratio of 1/6 is a guess on my part so you may need to do a little trial and error on that.
0
 

Author Comment

by:HenryM2
ID: 24051425
As said in the biginning, I am not realy drawing on the screen.  The background is an imported JPG in the TImage picture property.  The small coloured blocks are coloured panels with  the text added in the panel's caption property.  The TImage object is placed on another large TPanel component and the small colured panels also placed on the large TPanel.
0
 
LVL 14

Expert Comment

by:SteveBay
ID: 24051519
What is the resolution (size) of the JPG? Can you print a decent quality versoin of it?
0
 

Author Comment

by:HenryM2
ID: 24052734
The current bitmap resolution is 800 x 600 and the little panels making up the couloured icons are 40x15.  I think I can thus solve the problem by scaling up the JPS on the external drawing package and also scale the icons up.  Now the second question, lets forget about the print quality for a moment, how does one print the panels (Icons) on the TPanel parent as well as the overlayed TImage containing the JPG picture.
0
 
LVL 14

Accepted Solution

by:
SteveBay earned 1500 total points
ID: 24053301
Two thoughts come to mind:
You could draw something that looks like them. It appears as though they are simple Rectangles filled with color and some text. Believe it or not these are simple things to draw using:
     Printer.Canvas.Rectangle();
     Printer.Canvas.FillRect();
     Printer.Canvas.TextRect();

Or you could  make the two images for each item, a small version for screen and a large version for printing
 Icon : TIcon;
    ....
 Icon.LoadFromFile('LargeImage.ico');
 Printer.Canvas.Draw(x,y,Icon);


0
 

Author Closing Comment

by:HenryM2
ID: 31565750
Thanks I think drawing the rectangles is going to be tha answer, I will play around with this and may ask more questions later on.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

765 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