Blender
V5.3
source
blender
freestyle
intern
stroke
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
9
#include "
TextStrokeRenderer.h
"
10
#include "
Canvas.h
"
11
#include "
StrokeIterators.h
"
12
13
namespace
Freestyle
{
14
15
TextStrokeRenderer::TextStrokeRenderer
(
const
char
*iFileName)
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
33
void
TextStrokeRenderer::RenderStrokeRep
(
StrokeRep
*iStrokeRep)
const
34
{
35
RenderStrokeRepBasic
(iStrokeRep);
36
}
37
38
void
TextStrokeRenderer::RenderStrokeRepBasic
(
StrokeRep
*iStrokeRep)
const
39
{
40
Stroke
*stroke = iStrokeRep->
getStroke
();
41
if
(!stroke) {
42
cerr <<
"no stroke associated with Rep"
<< endl;
43
return
;
44
}
45
46
StrokeInternal::StrokeVertexIterator
v = stroke->
strokeVerticesBegin
();
47
StrokeAttribute
att;
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 */
Canvas.h
Class to define a canvas designed to draw style modules.
StrokeIterators.h
Iterators used to iterate over the elements of the Stroke.
TextStrokeRenderer.h
Freestyle::Canvas::height
virtual int height() const =0
Freestyle::Canvas::width
virtual int width() const =0
Freestyle::Canvas::getInstance
static Canvas * getInstance()
Definition
Canvas.h:55
Freestyle::StrokeAttribute
Definition
Stroke.h:44
Freestyle::StrokeAttribute::getColorR
float getColorR() const
Definition
Stroke.h:101
Freestyle::StrokeAttribute::getColorG
float getColorG() const
Definition
Stroke.h:107
Freestyle::StrokeAttribute::getThicknessR
float getThicknessR() const
Definition
Stroke.h:140
Freestyle::StrokeAttribute::getColorB
float getColorB() const
Definition
Stroke.h:113
Freestyle::StrokeAttribute::getThicknessL
float getThicknessL() const
Definition
Stroke.h:146
Freestyle::StrokeInternal::StrokeVertexIterator
Definition
StrokeIterators.h:35
Freestyle::StrokeRep
Definition
StrokeRep.h:162
Freestyle::StrokeRep::getStroke
Stroke * getStroke()
Definition
StrokeRep.h:229
Freestyle::Stroke
Definition
Stroke.h:483
Freestyle::Stroke::strokeVerticesBegin
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition
Stroke.cpp:756
Freestyle::TextStrokeRenderer::_ofstream
ofstream _ofstream
Definition
TextStrokeRenderer.h:49
Freestyle::TextStrokeRenderer::RenderStrokeRep
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
Definition
TextStrokeRenderer.cpp:33
Freestyle::TextStrokeRenderer::TextStrokeRenderer
TextStrokeRenderer(const char *iFileName=nullptr)
Definition
TextStrokeRenderer.cpp:15
Freestyle::TextStrokeRenderer::RenderStrokeRepBasic
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
Definition
TextStrokeRenderer.cpp:38
Freestyle
inherits from class Rep
Definition
AppCanvas.cpp:20
Generated on
for Blender by
doxygen
1.18.0