SVG generation problems
Posted: 2011-08-05T04:23:12-07:00
Hello,
First, sorry for my english mistakes.
Well, i'm trying to generate some SVG images. Here is the interesting part of the code:
The code is supposed to Draw several Blue circles and three yellow squares around a logo (the image is a .svg). The generated file shows black circles (instead of blue) and the central logo is absent...
In order to fix it, i wrote two "kod.display()" to see the appearance of the file during the process. The command displays a correct image, with blue circles and the central logo... So it seems that the saving is the root of the problem.
I tried to save in JPG instead of SVG, it works too. So my question is: Why doesn't it want to save the colors and the logo when I generate a .SVG?
Thank you very much,
Sniceper.
First, sorry for my english mistakes.
Well, i'm trying to generate some SVG images. Here is the interesting part of the code:
Code: Select all
Image kod( Geometry(formatX+4*sizeP, formatY+4*sizeP), Color("white"));
Image logo_image("/home/logos/" + logo);
list<Drawable> ToDraw;
for (int i=0;i<tailleY;i++)
{
for (int j=0;j<tailleX;j++)
{
if (matrix[i][j])
{
ToDraw.push_back(DrawableCircle((double)(sizeP*j+2*sizeP+sizeP/2),(double)(sizeP*i+2*sizeP+sizeP/2),(double)(sizeP*j+2*sizeP+5),(double)(sizeP*i+2*sizeP+5)));
}
}
}
kod.fillColor("blue");
kod.draw(ToDraw);
kod.display();
ToDraw.clear();
if (secubit[0]) ToDraw.push_back(DrawableRectangle(2*sizeP-((sizeP/2)-1)+2*sizeP, 2*sizeP-((sizeP/2)-1)+2*sizeP, 2*sizeP-((sizeP/2)+1)+2*sizeP, 2*sizeP-((sizeP/2)+1)+2*sizeP));
if (secubit[1]) ToDraw.push_back(DrawableRectangle(3*sizeP-((sizeP/2)-1)+2*sizeP, 2*sizeP-((sizeP/2)-1)+2*sizeP, 3*sizeP-((sizeP/2)+1)+2*sizeP, 2*sizeP-((sizeP/2)+1)+2*sizeP));
if (secubit[2]) ToDraw.push_back(DrawableRectangle(4*sizeP-((sizeP/2)-1)+2*sizeP, 2*sizeP-((sizeP/2)-1)+2*sizeP, 4*sizeP-((sizeP/2)+1)+2*sizeP, 2*sizeP-((sizeP/2)+1)+2*sizeP));
kod.fillColor("yellow");
kod.draw(ToDraw);
Geometry new_size(formatX-10*sizeP,formatY-10*sizeP);
new_size.aspect(true);
logo_image.resize(new_size);
kod.composite(logo_image,7*sizeP,7*sizeP,OverCompositeOp);
kod.display();
kod.write( "generated/" + ID +".svg");
return 0;
}
In order to fix it, i wrote two "kod.display()" to see the appearance of the file during the process. The command displays a correct image, with blue circles and the central logo... So it seems that the saving is the root of the problem.
I tried to save in JPG instead of SVG, it works too. So my question is: Why doesn't it want to save the colors and the logo when I generate a .SVG?
Thank you very much,
Sniceper.