Blender  V3.3
TextStrokeRenderer.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "TextStrokeRenderer.h"
4 #include "Canvas.h"
5 #include "StrokeIterators.h"
6 
7 namespace Freestyle {
8 
10 {
11  if (!iFileName) {
12  iFileName = "freestyle.txt";
13  }
14  // open the stream:
15  _ofstream.open(iFileName, ios::out);
16  if (!_ofstream.is_open()) {
17  cerr << "couldn't open the output file " << iFileName << endl;
18  }
19  _ofstream << "%!FREESTYLE" << endl;
20  _ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl;
21  // Bounding box
22  _ofstream << 0 << " " << 0 << " " << Canvas::getInstance()->width() << " "
23  << Canvas::getInstance()->height() << endl;
24  _ofstream << "%u x y z tleft tright r g b ..." << endl;
25 }
26 
28 {
29  RenderStrokeRepBasic(iStrokeRep);
30 }
31 
33 {
34  Stroke *stroke = iStrokeRep->getStroke();
35  if (!stroke) {
36  cerr << "no stroke associated with Rep" << endl;
37  return;
38  }
39 
41  StrokeAttribute att;
42  while (!v.isEnd()) {
43  att = v->attribute();
44  _ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " "
45  << v->getProjectedZ() << " " << att.getThicknessL() << " " << att.getThicknessR()
46  << " " << att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " ";
47  ++v;
48  }
49  _ofstream << endl;
50 }
51 
52 } /* 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
static Canvas * getInstance()
Definition: Canvas.h:55
virtual int height() const =0
virtual int width() const =0
const float getThicknessR() const
Definition: Stroke.h:140
const float getColorR() const
Definition: Stroke.h:101
const float getColorB() const
Definition: Stroke.h:113
const float getThicknessL() const
Definition: Stroke.h:146
const float getColorG() const
Definition: Stroke.h:107
Stroke * getStroke()
Definition: StrokeRep.h:233
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition: Stroke.cpp:750
TextStrokeRenderer(const char *iFileName=NULL)
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
inherits from class Rep
Definition: AppCanvas.cpp:18
static const pxr::TfToken out("out", pxr::TfToken::Immortal)