本文整理汇总了C++中Stroke类的典型用法代码示例。如果您正苦于以下问题:C++ Stroke类的具体用法?C++ Stroke怎么用?C++ Stroke使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stroke类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseXML
void CReadXML::parseXML(TiXmlDocument* document){
TiXmlElement* rootElement = document->RootElement();
const char* name = rootElement->Attribute("name");
character.setName(name);
const char* seq = rootElement->Attribute("stroke_seq_id");
character.setStrokeSeq(seq);
TiXmlElement* outlineElement = rootElement->FirstChildElement();
TiXmlElement* strokeElement = outlineElement->FirstChildElement();
Bujian bujian;
for (strokeElement;strokeElement;strokeElement = strokeElement->NextSiblingElement())
{
TiXmlElement* trunpoint = strokeElement->FirstChildElement();
Stroke stroke;
for (trunpoint;trunpoint;trunpoint = trunpoint->NextSiblingElement())
{
const char* x = trunpoint->Attribute("x");
const char* y = trunpoint->Attribute("y");
const char* statusPoint = trunpoint->Attribute("status");
stroke.addStatus(statusPoint);
stroke.addPoint(ccp(atof(x),atof(y)));
}
bujian.addStroke(stroke);
}
character.addBujian(bujian);
}
示例2: AddStrk2SG
void StrokeGroup::AppendStrk2Char(Stroke strk1,int mode)
{
try
{
if(nstrokes==0)
{
strklist.clear();
strk1.ChangeStrkCoords(origin,mode);
strklist.push_back(strk1);
nstrokes++;
return;
}
else
{
strk1.ChangeStrkCoords(origin,mode);
AddStrk2SG(strk1);
}
}
catch(exception& e)
{
string str="StrokeGroup:Exception in AppendStrk2Char: ";
str.append(e.what());
logwrite(str);
}
}
示例3: set_join_caps
void set_join_caps(Stroke const& stroke_, PathType & stroke)
{
line_join_e join=stroke_.get_line_join();
switch (join)
{
case MITER_JOIN:
stroke.generator().line_join(agg::miter_join);
break;
case MITER_REVERT_JOIN:
stroke.generator().line_join(agg::miter_join);
break;
case ROUND_JOIN:
stroke.generator().line_join(agg::round_join);
break;
default:
stroke.generator().line_join(agg::bevel_join);
}
line_cap_e cap=stroke_.get_line_cap();
switch (cap)
{
case BUTT_CAP:
stroke.generator().line_cap(agg::butt_cap);
break;
case SQUARE_CAP:
stroke.generator().line_cap(agg::square_cap);
break;
default:
stroke.generator().line_cap(agg::round_cap);
}
}
示例4: set_join_caps_aa
void set_join_caps_aa(Stroke const& stroke_, Rasterizer & ras)
{
line_join_e join=stroke_.get_line_join();
switch (join)
{
case MITER_JOIN:
ras.line_join(agg::outline_miter_accurate_join);
break;
case MITER_REVERT_JOIN:
ras.line_join(agg::outline_no_join);
break;
case ROUND_JOIN:
ras.line_join(agg::outline_round_join);
break;
default:
ras.line_join(agg::outline_no_join);
}
line_cap_e cap=stroke_.get_line_cap();
switch (cap)
{
case BUTT_CAP:
ras.round_cap(false);
break;
case SQUARE_CAP:
ras.round_cap(false);
break;
default:
ras.round_cap(true);
}
}
示例5: getCharacterStandardInfo
string TcharacterDrawnode::getCharacterStandardInfo(){
string ret = "";
int cout = myChar.getStrokeCount();
for (int i = 1 ; i <= cout ; i++)
{
Stroke stroke = myChar.getStroke(i);
ret += stroke.sendOutputWithStatus();
}
return ret;
}
示例6: paint
void Strokes::paint(QPainter *p, const QPoint &drift)
{
for (Stroke *stroke = strokes.first(); (stroke = strokes.current()); strokes.next())
{
stroke->paint(p, drift);
}
if (currentStroke)
currentStroke->paint(p, drift);
}
示例7: Stroke
Stroke* Scene::newStroke( const Path& p, int colour, int attribs ) {
Stroke *s = new Stroke(p);
s->setAttribute( (Attribute)attribs );
switch ( colour ) {
case 0: s->setAttribute( ATTRIB_TOKEN ); break;
case 1: s->setAttribute( ATTRIB_GOAL ); break;
default: s->setColour( brushColours[colour] ); break;
}
m_strokes.append( s );
m_recorder.newStroke( p, colour, attribs );
return s;
}
示例8: serialize
QString Strokes::serialize()
{
QString r;
uint i = 0;
for (Stroke *stroke = strokes.first(); (stroke = strokes.current()); strokes.next(), i++)
{
QString p;
r += p.sprintf("stroke%d=\"", i) + stroke->serialize() + "\"\n";
}
return r;
}
示例9: XOJ_CHECK_TYPE
void PageView::selectObjectAt(double x, double y) {
XOJ_CHECK_TYPE(PageView);
int selected = this->page.getSelectedLayerId();
GdkRectangle matchRect = { x - 10, y - 10, 20, 20 };
Stroke * strokeMatch = NULL;
double gap = 1000000000;
Element * elementMatch = NULL;
// clear old selection anyway
this->xournal->getControl()->clearSelection();
ListIterator<Layer*> it = this->page.layerIterator();
while (it.hasNext() && selected) {
Layer * l = it.next();
ListIterator<Element *> eit = l->elementIterator();
while (eit.hasNext()) {
Element * e = eit.next();
if (e->intersectsArea(&matchRect)) {
if (e->getType() == ELEMENT_STROKE) {
Stroke * s = (Stroke *) e;
double tmpGap = 0;
if (s->intersects(x, y, 5, &tmpGap)) {
if (gap > tmpGap) {
gap = tmpGap;
strokeMatch = s;
}
}
} else {
elementMatch = e;
}
}
}
selected--;
}
if (strokeMatch) {
elementMatch = strokeMatch;
}
if (elementMatch) {
xournal->setSelection(new EditSelection(xournal->getControl()->getUndoRedoHandler(), elementMatch, this, page));
repaintPage();
}
}
示例10: addStroke
Strokes::Strokes(Strokes &strks)
{
strokes.clear();
for (Stroke *stroke = strks.first(); (stroke = strks.current()); strks.next())
{
QString d = stroke->serialize();
addStroke(stroke->serialize());
}
maxX = strks.getMaxX();
maxY = strks.getMaxY();
currentStroke = 0;
}
示例11: vertexOri
int CalligraphicShader::shade(Stroke &ioStroke) const
{
Interface0DIterator v;
Functions0D::VertexOrientation2DF0D fun;
StrokeVertex *sv;
for (v = ioStroke.verticesBegin(); !v.isEnd(); ++v) {
real thickness;
if (fun(v) < 0)
return -1;
Vec2f vertexOri(fun.result);
Vec2r ori2d(-vertexOri[1], vertexOri[0]);
ori2d.normalizeSafe();
real scal = ori2d * _orientation;
sv = dynamic_cast<StrokeVertex *>(&(*v));
if (_clamp && (scal < 0)) {
scal = 0.0;
sv->attribute().setColor(1, 1, 1);
}
else {
scal = fabs(scal);
sv->attribute().setColor(0, 0, 0);
}
thickness = _minThickness + scal * (_maxThickness - _minThickness);
if (thickness < 0.0)
thickness = 0.0;
sv->attribute().setThickness(thickness / 2.0, thickness / 2.0);
}
return 0;
}
示例12: int
void
ServerConnection::send_stroke(const Stroke& stroke, DrawingParameter* param)
{
const Stroke::Dabs& dabs = stroke.get_dabs();
std::stringstream str;
if (param->get_brush().empty())
str << "set_generic_brush "
<< param->generic_brush.shape << " "
<< param->generic_brush.radius << " "
<< param->generic_brush.spikes << " "
<< param->generic_brush.hardness << " "
<< param->generic_brush.aspect_ratio << " "
<< param->generic_brush.angle << " "
<< std::endl;
else
str << "set_brush " << param->get_brush() << std::endl;
str << "set_tool " << param->tool << std::endl;
str << "set_opacity " << int(param->opacity) << std::endl;
str << "set_color "
<< int(param->color.r) << " "
<< int(param->color.g) << " "
<< int(param->color.b) << std::endl;
str << "stroke_begin" << std::endl;
for(Stroke::Dabs::const_iterator i = dabs.begin(); i != dabs.end(); ++i)
{
str << "dab " << i->time << " " << i->pos.x << " " << i->pos.y << " " << i->pressure << std::endl;
}
str << "stroke_end" << std::endl;
send(str.str());
}
示例13: p
int SpatialNoiseShader::shade(Stroke &ioStroke) const
{
Interface0DIterator v, v2;
v = ioStroke.verticesBegin();
Vec2r p(v->getProjectedX(), v->getProjectedY());
v2 = v;
++v2;
Vec2r p0(v2->getProjectedX(), v2->getProjectedY());
p0 = p + 2 * (p - p0);
StrokeVertex *sv;
sv = dynamic_cast<StrokeVertex *>(&(*v));
real initU = sv->strokeLength() * real(NB_VALUE_NOISE);
if (_pureRandom)
initU += RandGen::drand48() * real(NB_VALUE_NOISE);
Functions0D::VertexOrientation2DF0D fun;
while (!v.isEnd()) {
sv = dynamic_cast<StrokeVertex *>(&(*v));
Vec2r p(sv->getPoint());
if (fun(v) < 0)
return -1;
Vec2r vertexOri(fun.result);
Vec2r ori2d(vertexOri[0], vertexOri[1]);
ori2d = Vec2r(p - p0);
ori2d.normalizeSafe();
PseudoNoise mynoise;
real bruit;
if (_smooth)
bruit = mynoise.turbulenceSmooth(_xScale * sv->curvilinearAbscissa() + initU, _nbOctave);
else
bruit = mynoise.turbulenceLinear(_xScale * sv->curvilinearAbscissa() + initU, _nbOctave);
Vec2r noise(-ori2d[1] * _amount * bruit, ori2d[0] * _amount * bruit);
sv->setPoint(p[0] + noise[0], p[1] + noise[1]);
p0 = p;
++v;
}
ioStroke.UpdateLength();
return 0;
}
示例14: QColor
void QSketch::setStrokes(Strokes *strokes1)
{
if (strokes && !externalStrokes)
delete strokes;
// colors used in the strokes put into choosedColors dialog
for (Stroke *stroke = strokes1->first(); (stroke = strokes1->current()); strokes1->next())
{
QColor strokeColor = stroke->getColor();
bool colorIn = false;
for(QColor *color = choosedColors.first(); (color = choosedColors.current()); choosedColors.next())
{
if (*color == strokeColor)
{
colorIn = true;
break;
}
}
if (!colorIn)
{
choosedColors.append(new QColor(strokeColor));
}
}
strokes = strokes1;
externalStrokes = true;
viewP = QPoint(0, 0);
// rebuild cache
if (moveMode)
{
if (viewCache)
delete viewCache;
if(sketchCache)
delete sketchCache;
viewCache = sketchCache = 0;
updateViewCache();
update();
}
modified = true;
}
示例15: RenderStrokeRepBasic
void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const{
Stroke *stroke = iStrokeRep->getStroke();
if(!stroke){
cerr << "no stroke associated with Rep" << endl;
return;
}
StrokeInternal::StrokeVertexIterator v = stroke->strokeVerticesBegin();
StrokeAttribute att;
while(!v.isEnd()){
att = v->attribute();
_ofstream << v->u() << " " << (double) v->getProjectedX() << " " << (double) v->getProjectedY() << " " << (double) v->getProjectedZ() << " " \
<< att.getThicknessL() << " " << att.getThicknessR() << " " \
<< att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " ";
++v;
}
_ofstream << endl;
}