Hi,

1) Yes, that's something that does have to be fixed - things like
sterols and cyclopentane will look odd upside-down.

2) I hadn't thought of users accidentally using the Visitor
setRendererModel method; that won't work. What happens in the code you
post is that the renderer over-writes the model you are setting in the
visitor, and your settings are lost. Better to do:

model = renderer.getRenderer2DModel
model.setAtomColorer Color::CPKAtomColors.new
...

that way, you only use the model that the renderer has.

gilleain

On Sat, May 23, 2009 at 10:40 AM, sebi <sebastian.kl...@hispeed.ch> wrote:
> Hi
>
> I switched to the jchempaint-primary branch and it works well now. But I
> have two questions.
>
> 1) The pictures are flipped vertical compared to the old code and I
> couldn't find a method to flip it back. Not so important, just
> wondering.
>
> 2) I tried to make settings to the RendererModel, but without result.
> I'd like to change the bond width and more important, I'd like to use
> the CPKAtomColors. Not sure if I'm doing right, so here's my code. (It's
> Ruby with Java classes)
>
> -------------------------------------------------------------------
> def self.draw( molecule, width, height )
>  # prepare molecule
>  sdg = Layout::StructureDiagramGenerator.new
>  sdg.setMolecule molecule
>  sdg.generateCoordinates
>  mol = sdg.getMolecule
>
>  # prepare image
>  area = Java::Awt::Rectangle.new width, height
>  img = Java::Awt::Image::BufferedImage.new width, height,
>  Java::Awt::Image::BufferedImage.TYPE_INT_RGB
>  g2d = img.createGraphics
>  g2d.setColor Java::Awt::Color.WHITE
>  g2d.fillRect 0, 0, width, height
>
>  # prepare renderer
>  generators = Java::Util::ArrayList.new
>  generators.add Generators::BasicBondGenerator.new
>  generators.add Generators::BasicAtomGenerator.new
>  font = Font::AWTFontManager.new
>  renderer = Renderer.new generators, font
>  visitor = Visitor::AWTDrawVisitor.new g2d
>
>  # the lines below have no effect ???
>  model = RendererModel.new
>  model.setAtomColorer Color::CPKAtomColors.new
>  model.setForeColor Java::Awt::Color.GREEN
>  visitor.setRendererModel model
>
>  # paint
>  renderer.paintMolecule mol, visitor, area, true
>  img
> end
> -------------------------------------------------------------
>
> On Sam, 2009-05-23 at 09:33 +0200, Egon Willighagen wrote:
>> Yes, I removed it, and the rendering code should have had to be
>> removed from 1.2.0 already, but I forgot this. Release 1.2.3 'Don't
>> use this Renderer' release will be made asap, but was slightly delayed
>> by panic in the Bioclipse camp.
>>
>> Egon
>>
>
> A note somewhere would have been useful,
> but you guys are nice and quick with answers :)
>
> Sebastian
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to