Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Programmatically alter the default colour of .svg image?(Seeking how to programmatically alter or modify the default colour of .svg image)
Programmatically alter the default colour of .svg image? [message #543854] Wed, 30 June 2010 19:50 Go to next message
pokemonluvr is currently offline pokemonluvrFriend
Messages: 2
Registered: June 2010
Junior Member
Hey everyone,

Right now I use quite a few custom figures, which are read from .svg files by the ScalableImageFigure class.

What i'm trying to do now is programmatically manipulate the colour that shows up. That is, override the default .svg colour with one of my own.

For some reason, using the setBackgroundColor() method does not result in a change,
(though other methods of the same scope like setMaintainAspectRatio(), setVisible() all work).

I'm not quite certain why, and if any tips would help that would be great!!

Thanks!
PL
Re: Programmatically alter the default colour of .svg image? [message #544516 is a reply to message #543854] Sat, 03 July 2010 07:26 Go to previous messageGo to next message
pokemonluvr is currently offline pokemonluvrFriend
Messages: 2
Registered: June 2010
Junior Member
I've made some small progress!

modifying the paintFigure(Graphics graphics) method allows me to overwrite the foreground colour by using setRenderInfo for the image

basically before the listener call in paintfigure, i do this
rndInfo.setValues(rndInfo.getWidth(), rndInfo.getHeight(), rndInfo.shouldMaintainAspectRatio(), rndInfo.shouldAntiAlias(), new RGB(255, 255, 0), new RGB(255, 255, 0));
                setRenderedImage(getRenderedImage().getNewRenderedImage(rndInfo));


This changes the outline colour/fill colour!
But SADLY, background colour remains elusive, even though I am in fact offering a background colour RGB.. would anyone have any thoughts as to how to change the background colour as well?
Re: Programmatically alter the default colour of .svg image? [message #544915 is a reply to message #544516] Tue, 06 July 2010 04:41 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Does SVG actually have a background colour, or is it transparent? If you
change the background colour and export to BMP, does the background
colour persist?

Jevon

pokemonluvr wrote:
> I've made some small progress!
>
> modifying the paintFigure(Graphics graphics) method allows me to
> overwrite the foreground colour by using setRenderInfo for the image
>
> basically before the listener call in paintfigure, i do this
>
> rndInfo.setValues(rndInfo.getWidth(), rndInfo.getHeight(),
> rndInfo.shouldMaintainAspectRatio(), rndInfo.shouldAntiAlias(), new
> RGB(255, 255, 0), new RGB(255, 255, 0));
>
> setRenderedImage(getRenderedImage().getNewRenderedImage(rndI nfo));
>
>
> This changes the outline colour/fill colour!
> But SADLY, background colour remains elusive, even though I am in fact
> offering a background colour RGB.. would anyone have any thoughts as to
> how to change the background colour as well?
Previous Topic:Parser Exception after migration to helios
Next Topic:Classes in DOS Fileformat?
Goto Forum:
  


Current Time: Sat Nov 09 02:35:20 GMT 2024

Powered by FUDForum. Page generated in 0.03616 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top