Blender
V3.3
source
blender
freestyle
intern
stroke
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
9
TextStrokeRenderer::TextStrokeRenderer
(
const
char
*iFileName)
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
27
void
TextStrokeRenderer::RenderStrokeRep
(
StrokeRep
*iStrokeRep)
const
28
{
29
RenderStrokeRepBasic
(iStrokeRep);
30
}
31
32
void
TextStrokeRenderer::RenderStrokeRepBasic
(
StrokeRep
*iStrokeRep)
const
33
{
34
Stroke
*stroke = iStrokeRep->
getStroke
();
35
if
(!stroke) {
36
cerr <<
"no stroke associated with Rep"
<< endl;
37
return
;
38
}
39
40
StrokeInternal::StrokeVertexIterator
v
= stroke->
strokeVerticesBegin
();
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 */
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
v
ATTR_WARN_UNUSED_RESULT const BMVert * v
Definition:
bmesh_query_inline.h:15
Freestyle::Canvas::getInstance
static Canvas * getInstance()
Definition:
Canvas.h:55
Freestyle::Canvas::height
virtual int height() const =0
Freestyle::Canvas::width
virtual int width() const =0
Freestyle::StrokeAttribute
Definition:
Stroke.h:44
Freestyle::StrokeAttribute::getThicknessR
const float getThicknessR() const
Definition:
Stroke.h:140
Freestyle::StrokeAttribute::getColorR
const float getColorR() const
Definition:
Stroke.h:101
Freestyle::StrokeAttribute::getColorB
const float getColorB() const
Definition:
Stroke.h:113
Freestyle::StrokeAttribute::getThicknessL
const float getThicknessL() const
Definition:
Stroke.h:146
Freestyle::StrokeAttribute::getColorG
const float getColorG() const
Definition:
Stroke.h:107
Freestyle::StrokeInternal::StrokeVertexIterator
Definition:
StrokeIterators.h:33
Freestyle::StrokeRep
Definition:
StrokeRep.h:166
Freestyle::StrokeRep::getStroke
Stroke * getStroke()
Definition:
StrokeRep.h:233
Freestyle::Stroke
Definition:
Stroke.h:487
Freestyle::Stroke::strokeVerticesBegin
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition:
Stroke.cpp:750
Freestyle::TextStrokeRenderer::TextStrokeRenderer
TextStrokeRenderer(const char *iFileName=NULL)
Definition:
TextStrokeRenderer.cpp:9
Freestyle::TextStrokeRenderer::_ofstream
ofstream _ofstream
Definition:
TextStrokeRenderer.h:48
Freestyle::TextStrokeRenderer::RenderStrokeRep
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
Definition:
TextStrokeRenderer.cpp:27
Freestyle::TextStrokeRenderer::RenderStrokeRepBasic
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
Definition:
TextStrokeRenderer.cpp:32
Freestyle
inherits from class Rep
Definition:
AppCanvas.cpp:18
usdtokens::out
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1