Blender V4.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
6#include "Canvas.h"
7#include "StrokeIterators.h"
8
9namespace Freestyle {
10
12{
13 if (!iFileName) {
14 iFileName = "freestyle.txt";
15 }
16 // open the stream:
17 _ofstream.open(iFileName, ios::out);
18 if (!_ofstream.is_open()) {
19 cerr << "couldn't open the output file " << iFileName << endl;
20 }
21 _ofstream << "%!FREESTYLE" << endl;
22 _ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl;
23 // Bounding box
24 _ofstream << 0 << " " << 0 << " " << Canvas::getInstance()->width() << " "
25 << Canvas::getInstance()->height() << endl;
26 _ofstream << "%u x y z tleft tright r g b ..." << endl;
27}
28
30{
31 RenderStrokeRepBasic(iStrokeRep);
32}
33
35{
36 Stroke *stroke = iStrokeRep->getStroke();
37 if (!stroke) {
38 cerr << "no stroke associated with Rep" << endl;
39 return;
40 }
41
44 while (!v.isEnd()) {
45 att = v->attribute();
46 _ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " "
47 << v->getProjectedZ() << " " << att.getThicknessL() << " " << att.getThicknessR()
48 << " " << att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " ";
49 ++v;
50 }
51 _ofstream << endl;
52}
53
54} /* namespace Freestyle */
Class to define a canvas designed to draw style modules.
Iterators used to iterate over the elements of the Stroke.
ATTR_WARN_UNUSED_RESULT const BMVert * v
virtual int height() const =0
virtual int width() const =0
static Canvas * getInstance()
Definition Canvas.h:57
const float getThicknessR() const
Definition Stroke.h:142
const float getColorR() const
Definition Stroke.h:103
const float getColorB() const
Definition Stroke.h:115
const float getThicknessL() const
Definition Stroke.h:148
const float getColorG() const
Definition Stroke.h:109
Stroke * getStroke()
Definition StrokeRep.h:231
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