 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dettmer, A. L. Guest
|
Posted: Sat Aug 09, 2003 7:58 pm Post subject: Canvas inheritance |
|
|
Hello:
I would like to build a descendant from TCanvas that would create
a PDF file. I need a TCanvas descendant because inside our apps we
use a "universal" report engine that can output to: screen, printer,
metafile and so on.
My BIG problem: nearly everything that TCanvas publish is static and
can't override the original methods, so if I have:
type
TPDFCanvas = class(TCanvas)
private
...
protected
...
end;
And try something like code below I'm in trouble:
procedure SomeMethod(aCanvas : TCanvas);
begin
....
aCanvas.rectangle(x1,x2,y1,y2); //<- call TCanvas.rectangle and not TPDFCanvas.rectangle
....
end;
var
pdfCanvas : TPDFCanvas;
begin
pdfCanvas:= TPDFCanvas.create;
....
someMethod(pdfCanvas);
....
end;
I just couldn't override the inherited methods.
Any idea ?
Thanks
|
|
| Back to top |
|
 |
Yahia El-Qasem Guest
|
Posted: Sat Aug 09, 2003 8:04 pm Post subject: Re: Canvas inheritance |
|
|
For PDF I would recommend using some of the available products - one very
good one is wPDF and AFAIK it provides a canvas.
Yahia
|
|
| Back to top |
|
 |
Dettmer, A. L. Guest
|
Posted: Sat Aug 09, 2003 8:30 pm Post subject: Re: Canvas inheritance |
|
|
Yahia El-Qasem wrote:
| Quote: | For PDF I would recommend using some of the available products - one very
good one is wPDF and AFAIK it provides a canvas.
|
I liked what I see in the site, but using someone else components isn't
as fun as try solve this canvas problem :-)
--
"I can resist anything except to temptations."
Oscar Wilde
|
|
| Back to top |
|
 |
Yahia El-Qasem Guest
|
Posted: Sun Aug 10, 2003 12:33 am Post subject: Re: Canvas inheritance |
|
|
that's true <g>
Yahia
|
|
| Back to top |
|
 |
Alexander Bauer Guest
|
Posted: Sun Aug 10, 2003 1:52 pm Post subject: Re: Canvas inheritance |
|
|
Hi,
I would say TCanves is the implementation of a DC of the Windows GUI system.
Not only Windows DCs also Printer DC and stuff. A Bitmap has a Canvas (DC)
too but no window at all.
Anyway... would it be possible to react on changes to the Canvas for you?
TCanvas offers two Events OnChange and OnChaniging. May be you can use them
to get informed about changes - drawings on the Canvas and the copy these
changes to your PDF.
To be able to profide these Events to the component user simply override
them and set the inherited to call a OnChange procedure where you first copy
the Canvas to the PDF and then fire the event of the user if assigned. If
you need to do the drawing like Ellipse and stuff to your PDF directly
simply write drawing methods as public and call the inherited before drawing
to the PDF. I think this should work.
You cannot override a static method - thats right, but you can write a new
one. Calls from the original TCanvas would alway be to the original version
but call from you TPDFCanvas would use your version.
Regards,
Alexnader Bauer
"Dettmer, A. L." <armando.die (AT) spam (DOT) die.eps.ufsc.br> schrieb im Newsbeitrag
news:3f363c5a$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Danny Thorpe wrote:
TCanvas was designed to be an encapsulation of the Windows DC. It was
not
intended to be repurposed to a completely different task through
inheritance.
Well, now I will need to something around it or duplicate my report
generator code.
I wonder how PDF generators like "PDF in the box" or "llPDFLib" do the
trick.
Just because a VW is a "bug" and a bee is a bug, doesn't mean you can
change
a bee into a VW. ;
:-) Indeed.
Thanks Danny
|
|
|
| Back to top |
|
 |
Danny Thorpe Guest
|
Posted: Sun Aug 10, 2003 10:54 pm Post subject: Re: Canvas inheritance |
|
|
"Dettmer, A. L." <armando.die (AT) spam (DOT) die.eps.ufsc.br> wrote
| Quote: |
Well, now I will need to something around it or duplicate my report
generator code.
I wonder how PDF generators like "PDF in the box" or "llPDFLib" do the
trick. |
You might consider rendering to a metafile (using a canvas), then
enumerating the metafile records and translating those to PDF format.
-Danny
|
|
| Back to top |
|
 |
Danny Thorpe Guest
|
Posted: Mon Aug 11, 2003 6:35 pm Post subject: Re: Canvas inheritance |
|
|
"Dettmer, A. L." <armando.die (AT) spam (DOT) die.eps.ufsc.br> wrote
| Quote: |
You might consider rendering to a metafile (using a canvas), then
enumerating the metafile records and translating those to PDF format.
This appear to be the way llPDFLib do it's tricks, they provide a unit
that translate WMF to PDF.
Could you point me some references about how this could be done ?
|
http://msdn.microsoft.com
Search for EnumMetafile.
-Danny
|
|
| Back to top |
|
 |
Grega Loboda Guest
|
Posted: Tue Aug 12, 2003 7:10 am Post subject: Re: Canvas inheritance |
|
|
Hello
I was wondering. TCanvas is good, but when you come to enummetafile, things
become complicated. There is even a bug in metafile (search graphics group).
So, I'm developing my own metafile (it's a file, where you store your calls
to circle, rectangle,...). It's faster than metafile. I'm planing to use in
report engine at my work. I will store all those data into my metafile and
that just playback my metafile to screen canvas, printer canvas, or to any
file type. Are you interested?
Grega
"Dettmer, A. L." <armando.die (AT) spam (DOT) die.eps.ufsc.br> wrote
| Quote: |
Could you point me some references about how this could be done ?
http://msdn.microsoft.com
Search for EnumMetafile.
Thanks.
|
|
|
| Back to top |
|
 |
Graham Murt Guest
|
Posted: Tue Aug 12, 2003 8:22 am Post subject: Re: Canvas inheritance |
|
|
Hi Grega,
In case you're interested... This is exactly what GmPrintSuite does, plus a
whole lot more!
The best part is that the Lite version is completely free for personal or
commercial use.
If you're interested, download it from here...
http://www.murtsoft.co.uk/downloads.html
Kind regards,
Graham Murt
--
GmPrintSuite Print & Print Preview Components
http://www.murtsoft.co.uk/
"Grega Loboda" <grega.loboda (AT) email (DOT) si> wrote
| Quote: | Hello
I was wondering. TCanvas is good, but when you come to enummetafile,
things
become complicated. There is even a bug in metafile (search graphics
group).
So, I'm developing my own metafile (it's a file, where you store your
calls
to circle, rectangle,...). It's faster than metafile. I'm planing to use
in
report engine at my work. I will store all those data into my metafile and
that just playback my metafile to screen canvas, printer canvas, or to any
file type. Are you interested?
Grega
"Dettmer, A. L." <armando.die (AT) spam (DOT) die.eps.ufsc.br> wrote in message
news:3f382198$1 (AT) newsgroups (DOT) borland.com...
Could you point me some references about how this could be done ?
http://msdn.microsoft.com
Search for EnumMetafile.
Thanks.
|
|
|
| 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
|
|