本文整理汇总了C++中Flag::GetStemDownNW方法的典型用法代码示例。如果您正苦于以下问题:C++ Flag::GetStemDownNW方法的具体用法?C++ Flag::GetStemDownNW怎么用?C++ Flag::GetStemDownNW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flag
的用法示例。
在下文中一共展示了Flag::GetStemDownNW方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcStem
int Stem::CalcStem(FunctorParams *functorParams)
{
CalcStemParams *params = dynamic_cast<CalcStemParams *>(functorParams);
assert(params);
assert(params->m_staff);
assert(params->m_layer);
assert(params->m_interface);
int staffSize = params->m_staff->m_drawingStaffSize;
bool drawingCueSize = this->IsCueSize();
/************ Set the position, the length and adjust to the note head ************/
int baseStem = 0;
// Use the given one if any
if (this->HasStemLen()) {
baseStem = this->GetStemLen() * -params->m_doc->GetDrawingUnit(staffSize);
}
else {
baseStem = -params->m_doc->GetDrawingUnit(staffSize) * STANDARD_STEMLENGTH;
if (drawingCueSize) baseStem = params->m_doc->GetCueSize(baseStem);
}
// Even if a stem length is given we add the length of the chord content (however only if not 0)
// Also, the given stem length is understood as being mesured from the center of the note.
// This means that it will be adjusted according to the note head (see below
if (!this->HasStemLen() || (this->GetStemLen() != 0)) {
baseStem += params->m_chordStemLength;
if (this->GetDrawingStemDir() == STEMDIRECTION_up) {
Point p = params->m_interface->GetStemUpSE(params->m_doc, staffSize, drawingCueSize);
baseStem += p.y;
this->SetDrawingYRel(this->GetDrawingYRel() + p.y);
this->SetDrawingXRel(p.x);
this->SetDrawingStemLen(baseStem);
}
else {
Point p = params->m_interface->GetStemDownNW(params->m_doc, staffSize, drawingCueSize);
baseStem -= p.y;
this->SetDrawingYRel(this->GetDrawingYRel() + p.y);
this->SetDrawingXRel(p.x);
this->SetDrawingStemLen(-baseStem);
}
}
/************ Set the flag (if necessary) and adjust the length ************/
Flag *flag = NULL;
// SMUFL flags cover some additional stem length from the 32th only
if (params->m_dur > DUR_4) {
flag = dynamic_cast<Flag *>(this->FindChildByType(FLAG));
assert(flag);
flag->m_drawingNbFlags = params->m_dur - DUR_4;
flag->SetDrawingYRel(-this->GetDrawingStemLen());
}
// Do not adjust the length if given in the encoding - however, the stem will be extend with the SMuFL
// extension from 32th - this can be improved
if (this->HasStemLen()) {
if ((this->GetStemLen() == 0) && flag) flag->m_drawingNbFlags = 0;
return FUNCTOR_CONTINUE;
}
// Do not adjust the length of grace notes - this is debatable and should probably become as styling option
if (params->m_isGraceNote) return FUNCTOR_CONTINUE;
int flagHeight = 0;
// SMUFL flags cover some additional stem length from the 32th only
if (params->m_dur > DUR_16) {
assert(flag);
Point stemEnd;
wchar_t flagCode = 0;
if (this->GetDrawingStemDir() == STEMDIRECTION_up)
stemEnd = flag->GetStemUpSE(params->m_doc, staffSize, drawingCueSize, flagCode);
else
stemEnd = flag->GetStemDownNW(params->m_doc, staffSize, drawingCueSize, flagCode);
// Trick for shortening the stem with DUR_8
flagHeight = stemEnd.y;
}
int endY = this->GetDrawingY() - this->GetDrawingStemLen() + flagHeight;
bool adjust = false;
if ((this->GetDrawingStemDir() == STEMDIRECTION_up) && (endY < params->m_verticalCenter))
adjust = true;
else if ((this->GetDrawingStemDir() == STEMDIRECTION_down) && (endY > params->m_verticalCenter))
adjust = true;
if (adjust) {
this->SetDrawingStemLen(this->GetDrawingStemLen() + (endY - params->m_verticalCenter));
if (flag) flag->SetDrawingYRel(-this->GetDrawingStemLen());
}
return FUNCTOR_CONTINUE;
}