Discussion:
about the OSG SVG plugin
Gianluca Natale
2013-01-10 10:47:12 UTC
Permalink
Hi all,
I'm trying to use the OSG SVG plugin to read some .svg file, to be used as textures on some surfaces.

Since .svg is a 'vector' graphic format, it could be rasterized at any resolution.
So, I should be able to ask any desired size for the image read by the plugin.
I'm using following call:

osgDB::readImageFile(fileName)

but I don't see any way to pass such options to the reader.
Is that possible?

I took a quick look at implementation (ReaderWriterSVG.cpp), and found this in
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const:

RsvgDimensionData dimensionData;
RsvgHandle* handle = rsvg_handle_new_from_file (fileName.c_str(), NULL);
rsvg_handle_get_dimensions( handle, &dimensionData);

So, it seems to me that there is no way to set the size of the image, since dimensions are gotten from the handle, whose constructor just takes the name of the file.
Is this a limitation of the plugin? So, how does the RsvgHandle choose those dimensions?

Thanks,
Gianluca
Gianluca Natale
2013-01-10 16:22:19 UTC
Permalink
Sorry for that silly question,
I just realized that I have to pass the required dimensions in 'options' in
osgDB::readImageFile(filename, options).


Da: osg-users-bounces-***@public.gmane.org [mailto:osg-users-***@lists.openscenegraph.org] Per conto di Gianluca Natale
Inviato: giovedì 10 gennaio 2013 11:47
A: OpenSceneGraph Users
Oggetto: [osg-users] about the OSG SVG plugin

Hi all,
I'm trying to use the OSG SVG plugin to read some .svg file, to be used as textures on some surfaces.

Since .svg is a 'vector' graphic format, it could be rasterized at any resolution.
So, I should be able to ask any desired size for the image read by the plugin.
I'm using following call:

osgDB::readImageFile(fileName)

but I don't see any way to pass such options to the reader.
Is that possible?

I took a quick look at implementation (ReaderWriterSVG.cpp), and found this in
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const:

RsvgDimensionData dimensionData;
RsvgHandle* handle = rsvg_handle_new_from_file (fileName.c_str(), NULL);
rsvg_handle_get_dimensions( handle, &dimensionData);

So, it seems to me that there is no way to set the size of the image, since dimensions are gotten from the handle, whose constructor just takes the name of the file.
Is this a limitation of the plugin? So, how does the RsvgHandle choose those dimensions?

Thanks,
Gianluca

Loading...