Blender
V4.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
5
#include "
TextStrokeRenderer.h
"
6
#include "
Canvas.h
"
7
#include "
StrokeIterators.h
"
8
9
namespace
Freestyle
{
10
11
TextStrokeRenderer::TextStrokeRenderer
(
const
char
*iFileName)
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
29
void
TextStrokeRenderer::RenderStrokeRep
(
StrokeRep
*iStrokeRep)
const
30
{
31
RenderStrokeRepBasic
(iStrokeRep);
32
}
33
34
void
TextStrokeRenderer::RenderStrokeRepBasic
(
StrokeRep
*iStrokeRep)
const
35
{
36
Stroke
*stroke = iStrokeRep->
getStroke
();
37
if
(!stroke) {
38
cerr <<
"no stroke associated with Rep"
<< endl;
39
return
;
40
}
41
42
StrokeInternal::StrokeVertexIterator
v
= stroke->
strokeVerticesBegin
();
43
StrokeAttribute
att;
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 */
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.hh:17
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:57
Freestyle::StrokeAttribute
Definition
Stroke.h:46
Freestyle::StrokeAttribute::getThicknessR
const float getThicknessR() const
Definition
Stroke.h:142
Freestyle::StrokeAttribute::getColorR
const float getColorR() const
Definition
Stroke.h:103
Freestyle::StrokeAttribute::getColorB
const float getColorB() const
Definition
Stroke.h:115
Freestyle::StrokeAttribute::getThicknessL
const float getThicknessL() const
Definition
Stroke.h:148
Freestyle::StrokeAttribute::getColorG
const float getColorG() const
Definition
Stroke.h:109
Freestyle::StrokeInternal::StrokeVertexIterator
Definition
StrokeIterators.h:35
Freestyle::StrokeRep
Definition
StrokeRep.h:164
Freestyle::StrokeRep::getStroke
Stroke * getStroke()
Definition
StrokeRep.h:231
Freestyle::Stroke
Definition
Stroke.h:489
Freestyle::Stroke::strokeVerticesBegin
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition
Stroke.cpp:756
Freestyle::TextStrokeRenderer::_ofstream
ofstream _ofstream
Definition
TextStrokeRenderer.h:50
Freestyle::TextStrokeRenderer::RenderStrokeRep
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
Definition
TextStrokeRenderer.cpp:29
Freestyle::TextStrokeRenderer::TextStrokeRenderer
TextStrokeRenderer(const char *iFileName=nullptr)
Definition
TextStrokeRenderer.cpp:11
Freestyle::TextStrokeRenderer::RenderStrokeRepBasic
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
Definition
TextStrokeRenderer.cpp:34
Freestyle
inherits from class Rep
Definition
AppCanvas.cpp:20
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0