[Biojava-l] Generate Graphics with BioJava

Mark Schreiber markjschreiber at gmail.com
Wed May 9 07:43:41 UTC 2007


Hi Bernhard -

It is possible but it is not as easy as it should be (this is an area
where we have considered a redesign).

Essentially most of the current graphics components of BioJava extend
Swing components. The drawing of features etc is done by biojava code
that draws into the Graphics2D objects of the component. This code is
usually found in the paintComponent() method.

What you can do it use exactly the same drawing code but use it to
draw into the Graphics2D object of a java BufferedImage. You then use
a java class called (I think) ImageIO to write it as JPG, PNG, TIFF
etc.

There is a nice project called Batik. This has objects that give you
access to an implementation of a Graphics2D object. You 'draw' into
that object in the normal java way and then the object converts
everything you 'drew' into SVG which is useful in webpages or with SVG
viewers.

Ultimately biojava shouldn't really have swing components. What it
should have is code that draws into Graphics2D objects which could be
from Batik or Swing or a BufferedImage or something else entirely.
This would provide much more flexible graphics system.

- Mark

On 5/7/07, Bernhard Heinzel <bernhard.heinzel at gmail.com> wrote:
> Hi,
>
> I am a total newbie to BioJava...
> Is it possible to generate Image Files(PNG,GIF,JPG) of Sequence Features?
>
> Thanks in Advance
> Bernhard
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l
>



More information about the Biojava-l mailing list