> -----Original Message-----
> From: jim moore [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 11, 2002 16:00
> To: Paulo Soares; [EMAIL PROTECTED]
> Subject: Re: [iText-questions] PdfGraphics2D class
>
> A couple thoughts on this version (graphics2d-02):
>
> First, I'm not sure if it is a good idea to expand the public interface of
> the class beyond the standard Graphics2D public interface. This iteration
> has a finished() method, a getTemplate method, and a static createTemplate
> method. I don't think non-package classes using this object should ever
> need
> to be aware of its concrete class. (Does anyone know the actual concrete
> class they are using when they call BufferedImage.getGraphics() or
> Component.getGraphics()?--I don't think so--you just know it is a
> Graphics2D
> and use it as such).
>
> As for the finished method(), I can understand the reasoning behind it,
> but
> maybe it makes more sense to move the body of the finished() method into
> dispose() or finalize().
>
Yes for dispose(). finalize() definitively not.
> I think the static factory method and public constructor are fine now for
> the testing, but I think for release, it makes more sense to move them to
> more appropriate classes, probably PdfContentByte. So instead of including
> a
> static factory method and public constructor, for release I would make the
> constructor protected or default, remove the static method, and add the
> following method to PdfContentByte:
>
> public void Graphics2D getGraphics() {
> Document doc = this.getPdfDocument();
> PdfGraphics2D result = new PdfGraphics2D(this,
> doc.getPageSize().width(), doc.getPageSize().height());
> return result;
> }
>
> In PdfTemplate, it would be overriden as:
>
> public void Graphics2D getGraphics() {
> PdfGraphics2D result = new PdfGraphics2D(this, getWidth(),
> getHeight());
> return result;
> }
>
Yes, this is the way to go. It will need more parameters for the
dimensions and the font mapping but you are right in the concept.
> This seems to me to be a closer reflection of how Graphics object are
> generally obtained in java: BufferedImage.getGraphics(),
> Component.getGraphics(), etc.
>
> In the java docs for these methods, you can make a statement to the effect
> of: "Be sure to call dispose() after you finish drawing to a graphics
> obtained from this method." (this is assuming we move the body of finished
> into dispose.)
>
> Also, there is now some confusion with member variables cb and template.
> Particularly in the following 2 lines of code from createTemplate():
>
> PdfGraphics2D g2 = new PdfGraphics2D(template, width, height);
> g2.template = template;
>
> Here, both this.cb and this.template are going to be pointing to the same
> object. This smells wrong. Also, the only reason I can see for having the
> PdfTemplate template variable is so that it can be returned from
> getTemplate() (and if you are drawing to a PdfContentByte directly, not a
> template, it will return null anyway). As my points above show, I am
> personally in favor of losing this method all together and then we can
> lose
> the PdfTemplate variable as well.
>
That was for testing. This weekend I'll prepare a new iText version
with PdfGraphics2D integrated along your lines and we'll tweek the interface
from there.
Best Regards,
Paulo Soares
> thoughts?
>
> --jim
> ----- Original Message -----
> From: "Paulo Soares" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 11, 2002 8:24 AM
> Subject: [iText-questions] PdfGraphics2D class
>
>
> > This time with support for setClip() without templates.
> >
> > http://www.geocities.com/itextpdf/graphics2d-02.zip
> >
> > Best Regards,
> > Paulo Soares
> >
> >
> > _______________________________________________
> > iText-questions mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions