3
// Copyright (C) : Please refer to the COPYRIGHT file distributed
4
// with this source distribution.
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
///////////////////////////////////////////////////////////////////////////////
22
# include "TextStrokeRenderer.h"
24
# include "StrokeIterators.h"
28
TextStrokeRenderer::TextStrokeRenderer(const char *iFileName)
32
iFileName = "freestyle.txt";
34
_ofstream.open(iFileName, ios::out);
35
if (!_ofstream.is_open()) {
36
cerr << "couldn't open the output file " << iFileName << endl;
38
_ofstream << "%!FREESTYLE" << endl;
39
_ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl;
41
_ofstream << 0 << " "<< 0 << " " << Canvas::getInstance()->width() << " " << Canvas::getInstance()->height() <<
43
_ofstream << "%u x y z tleft tright r g b ..." << endl;
46
TextStrokeRenderer::~TextStrokeRenderer()
51
void TextStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const
53
RenderStrokeRepBasic(iStrokeRep);
56
void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
58
Stroke *stroke = iStrokeRep->getStroke();
60
cerr << "no stroke associated with Rep" << endl;
64
StrokeInternal::StrokeVertexIterator v = stroke->strokeVerticesBegin();
68
_ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " " << v->getProjectedZ() <<
69
" " << att.getThicknessL() << " " << att.getThicknessR() << " " <<
70
att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " ";
76
void TextStrokeRenderer::Close()
78
if (_ofstream.is_open())
82
} /* namespace Freestyle */