Blender V5.3
TextStrokeRenderer.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2012-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "Canvas.h"
11#include "StrokeIterators.h"
12
13namespace Freestyle {
14
16{
17 if (!iFileName) {
18 iFileName = "freestyle.txt";
19 }
20 // open the stream:
21 _ofstream.open(iFileName, ios::out);
22 if (!_ofstream.is_open()) {
23 cerr << "couldn't open the output file " << iFileName << endl;
24 }
25 _ofstream << "%!FREESTYLE" << endl;
26 _ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl;
27 // Bounding box
28 _ofstream << 0 << " " << 0 << " " << Canvas::getInstance()->width() << " "
29 << Canvas::getInstance()->height() << endl;
30 _ofstream << "%u x y z tleft tright r g b ..." << endl;
31}
32
34{
35 RenderStrokeRepBasic(iStrokeRep);
36}
37
39{
40 Stroke *stroke = iStrokeRep->getStroke();
41 if (!stroke) {
42 cerr << "no stroke associated with Rep" << endl;
43 return;
44 }
45
48 while (!v.isEnd()) {
49 att = v->attribute();
50 _ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " "
51 << v->getProjectedZ() << " " << att.getThicknessL() << " " << att.getThicknessR()
52 << " " << att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " ";
53 ++v;
54 }
55 _ofstream << endl;
56}
57
58} /* namespace Freestyle */
Class to define a canvas designed to draw style modules.
Iterators used to iterate over the elements of the Stroke.
virtual int height() const =0
virtual int width() const =0
static Canvas * getInstance()
Definition Canvas.h:55
float getColorR() const
Definition Stroke.h:101
float getColorG() const
Definition Stroke.h:107
float getThicknessR() const
Definition Stroke.h:140
float getColorB() const
Definition Stroke.h:113
float getThicknessL() const
Definition Stroke.h:146
Stroke * getStroke()
Definition StrokeRep.h:229
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition Stroke.cpp:756
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
TextStrokeRenderer(const char *iFileName=nullptr)
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
inherits from class Rep
Definition AppCanvas.cpp:20