 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Peter Clarke Guest
|
Posted: Wed May 18, 2005 2:43 pm Post subject: Printer problems with Brush Hatch Styles |
|
|
Hi everyone
I have also posted this question on the nativeapi and vcl newsgroups as it
seems to span all these areas.
My application draws rectangles and other polygons which can be filled using
the various standard hatch styles such as diagonal lines, cross, vertical
lines etc. To set the hatch colours and styles, I use the
Canvas->Brush->Color and Canvas->Brush->Style properties. All is fine when
displayed on the monitor, but when printing, most printers draw the space
between the hatch lines in black, I want the spaces left white or
transparent.
I thought this problem may be solved by playing with the background
colour/style by using the Windows GDI functions SetBkColor() and
SetBkStyle(), but nothing I do has any result.
Can anyone help me get the printing right.
Regards
Peter
|
|
| Back to top |
|
 |
PaoloItaly Guest
|
Posted: Wed May 18, 2005 3:52 pm Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
What method do you use to print your canvas ?
|
|
| Back to top |
|
 |
Peter Clarke Guest
|
Posted: Thu May 19, 2005 7:49 pm Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
Paolo,
Thank you for your response. I use the Printer Canvas to draw on, using the
Canvas methods (eg Canvas->Rectangle() or Canvas->Polygon() etc. Is this
what you are asking?
Peter
"PaoloItaly" <paolot (AT) FAKETHESPAMMERsirius-es (DOT) it> wrote
| Quote: | What method do you use to print your canvas ?
|
|
|
| Back to top |
|
 |
PaoloItaly Guest
|
Posted: Fri May 20, 2005 10:38 am Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
Try using metafiles:
TCanvas *c = new TCanvas;
TPrinter *prn = Printer();
int width = ::GetDeviceCaps(prn->Handle, HORZSIZE);
int height = ::GetDeviceCaps(prn->Handle, VERTSIZE);
prn->BeginDoc();
TRect r(0, 0, width, height);
c->Handle = ::CreateEnhMetaFile(prn->Handle, NULL, &r, NULL);
/*
Here use the canvas to draw on
*/
HENHMETAFILE enh = ::CloseEnhMetaFile(c->Handle);
::PlayEnhMetaFile(prn->Handle, enh, &r);
::DeleteEnhMetaFile(enh);
prn->EndDoc();
delete c;
I think this will work and much faster than draw directly on printer canvas
Ciao
|
|
| Back to top |
|
 |
Peter Clarke Guest
|
Posted: Sat May 21, 2005 8:31 am Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
Thanks for the advice. I shall try this method.
You answer however reminds me of another problem I have. I wrote an
application that saves charts in the form of metafiles (both standard and
enhanced metafiles) and found that most graphics applications cannot open
them. Instead I get an "out of memory" message, even though they are not
large files. This is the case with packages such as Coral Draw and Paint
Shop Pro. Strangely though, there is no problem importing these metafiles
into Word or Excel. Are you aware of any problems with Builder created
metafiles. I use Builder 5.
Thanks
Peter
"PaoloItaly" <paolot (AT) FAKETHESPAMMERsirius-es (DOT) it> wrote
| Quote: | Try using metafiles:
TCanvas *c = new TCanvas;
TPrinter *prn = Printer();
int width = ::GetDeviceCaps(prn->Handle, HORZSIZE);
int height = ::GetDeviceCaps(prn->Handle, VERTSIZE);
prn->BeginDoc();
TRect r(0, 0, width, height);
c->Handle = ::CreateEnhMetaFile(prn->Handle, NULL, &r, NULL);
/*
Here use the canvas to draw on
*/
HENHMETAFILE enh = ::CloseEnhMetaFile(c->Handle);
::PlayEnhMetaFile(prn->Handle, enh, &r);
::DeleteEnhMetaFile(enh);
prn->EndDoc();
delete c;
I think this will work and much faster than draw directly on printer
canvas
Ciao
|
|
|
| Back to top |
|
 |
PaoloItaly Guest
|
Posted: Mon May 23, 2005 11:12 am Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
The problem about "out of memory" i think depends by the dimensions in pixel
of
your metafile canvas, not caused by the dimension of the source file.
If you have only a line in your file, but the line is 0, 0, 10000, 10000 the
amount of memory needed
to reproduce the line as a bitmap will be
10000*10000*8/24/32
depending of the number of colors used.
|
|
| Back to top |
|
 |
Peter Clarke Guest
|
Posted: Sat Jun 04, 2005 11:02 am Post subject: Re: Printer problems with Brush Hatch Styles |
|
|
I thought it was the size of the metafiles as-well, so I created some very
small metafiles and still got the "out of memory" message.
"PaoloItaly" <paolot (AT) FAKETHESPAMMERsirius-es (DOT) it> wrote
| Quote: | The problem about "out of memory" i think depends by the dimensions in
pixel
of
your metafile canvas, not caused by the dimension of the source file.
If you have only a line in your file, but the line is 0, 0, 10000, 10000
the
amount of memory needed
to reproduce the line as a bitmap will be
10000*10000*8/24/32
depending of the number of colors used.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|