Pixelated Bitmap

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Ed
Newbie
Newbie
Posts: 33
Joined: Tue Mar 09, 2004 5:00 am
Location: Oregon, USA
Contact:

Pixelated Bitmap

Post by Ed » Wed Jun 27, 2007 4:01 pm

I am creating a bitmap from a TChart at run time to print in a report. (One series in the chart has Transparent set to True, which means I can not use the WMF format as this is not supported).

I use the following code:

lBmp.Width := lRect.Right;
lBmp.Height := lRect.Bottom;
lChart.Draw(lBmp.Canvas, lRect);

Problem is that the bitmap shows up pixelated--is there any way to improve the quality of the printed image? (I looked at th properties of the TBitmap, which would seem the natural place, but could not find it). I know I could increaste the values of .Right and .Bottom (e.g. double the values) but then the fonts are too small.

Any suggestions?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jun 28, 2007 8:31 am

Hi Ed,

One way to enhance the quality of the bitmap to be printed would be increasing its size.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Ed
Newbie
Newbie
Posts: 33
Joined: Tue Mar 09, 2004 5:00 am
Location: Oregon, USA
Contact:

Post by Ed » Thu Jun 28, 2007 1:50 pm

narcis wrote:One way to enhance the quality of the bitmap to be printed would be increasing its size.
Yes, but increasing the size decreases the font size. I know, then increase the font size.... and that becomes much more work. I thought that there must be an easier way to do this. Maybe not.

Pep
Site Admin
Site Admin
Posts: 3279
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jul 02, 2007 11:54 am

Hi Ed,

I'm afraid the easiest way is (as you said) to increase the Font size depending on the image size, not using the Font.Size property, but the FontZoom, i.e :

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  if SaveDialog1.Execute then  { <-- ask for a filename first }
  begin
   { SAVE IT !! }

    Chart1.Width := Chart1.Width + Chart1.Width;
    Chart1.Height := chart1.Height + chart1.Height;
    Chart1.Aspect.FontZoom := 140;


{    CLIPPING WORKS FINE BUT DO NOT ALLOW MOVEABLE OR RESIZEABLE METAFILES }
{    TO FORCE CLIPPING WITH METAFILES UNCOMMENT THIS LINE: }
{    TeeClipWhenMetafiling:=True;  }

    Chart1.SaveToMetafile(SaveDialog1.FileName);

   { THIS METHOD CAN BE USED TOO: }
(*
      Chart1.SaveToMetafileRect( SaveDialog1.FileName,
      Rect( 0,0, round(21{cm}*37.8), round(10{cm}*37.8)));
*)
{   ( this equals to 96 * 21 / 2.54 , 96 * 10 /2.54 )   }

    { now it's loaded HERE ! }
    Image1.Picture.LoadFromFile(SaveDialog1.FileName);
    Image1.Refresh;

    Chart1.Width := Chart1.Width - Chart1.Width;
    Chart1.Height := chart1.Height - chart1.Height;
    Chart1.Aspect.FontZoom := 100;
  end;
end;

Post Reply