提交 b0083327 编写于 作者: W wangtiantian

IssueNo:https://gitee.com/openharmony/graphic_ui/issues/I4DCTF

Description:Add function DrawEllipsis
Sig:graphic
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: Nwangtiantian <wangtiantian19@huawei.com>
上级 95fc398e
......@@ -183,6 +183,16 @@ void Text::ReMeasureTextWidthInEllipsisMode(const Rect& textRect, const Style& s
}
}
}
void Text::DrawEllipsis(BufferInfo& gfxDstBuffer, LabelLineInfo& labelLine)
{
labelLine.offset.x = 0;
labelLine.text = TEXT_ELLIPSIS;
labelLine.lineLength = TEXT_ELLIPSIS_DOT_NUM;
labelLine.length = TEXT_ELLIPSIS_DOT_NUM;
DrawLabel::DrawTextOneLine(gfxDstBuffer, labelLine);
}
void Text::OnDraw(BufferInfo& gfxDstBuffer,
const Rect& invalidatedArea,
const Rect& viewOrigRect,
......@@ -240,11 +250,7 @@ void Text::Draw(BufferInfo& gfxDstBuffer,
nullptr, baseLine_};
DrawLabel::DrawTextOneLine(gfxDstBuffer, labelLine);
if ((i == (lineCount - 1)) && (ellipsisIndex != TEXT_ELLIPSIS_END_INV)) {
labelLine.offset.x = 0;
labelLine.text = TEXT_ELLIPSIS;
labelLine.lineLength = TEXT_ELLIPSIS_DOT_NUM;
labelLine.length = TEXT_ELLIPSIS_DOT_NUM;
DrawLabel::DrawTextOneLine(gfxDstBuffer, labelLine);
DrawEllipsis(gfxDstBuffer, labelLine);
}
}
lineBegin += textLine_[i].lineBytes;
......
......@@ -69,6 +69,8 @@ enum UITextLanguageDirect : uint8_t {
TEXT_DIRECT_MIXED,
};
struct LabelLineInfo;
/**
* @brief Represents the base class of <b>Text</b>, providing the text attribute setting and text drawing
* capabilities for components that require font display.
......@@ -359,6 +361,7 @@ protected:
uint16_t GetLine(int16_t width, uint8_t letterSpace, uint16_t ellipsisIndex, uint32_t& maxLineBytes);
int16_t TextPositionY(const Rect& textRect, int16_t textHeight);
int16_t LineStartPos(const Rect& textRect, uint16_t lineWidth);
void DrawEllipsis(BufferInfo& gfxDstBuffer, LabelLineInfo& labelLine);
char* text_;
uint8_t fontId_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册