菜单

代码示例

下载

1.直线

language 复制代码
//在指定的画布上绘制直线,并指定其粗细、颜色、虚线
void drawline(STTCanvas* canvas,int X1,int Y1,int X2,int Y2,int width,int color,int dash,int gap) {
    LvDrawLineDsc linedsc;
    linedsc.color.full = color;
    linedsc.width = width;
    if(dash>0 && gap>0) {
        linedsc.dash_width = dash;
        linedsc.dash_gap = gap;
    }
    int pt[] = {X1,Y1,X2,Y2};
    canvas->drawLine(pt, 2, &linedsc);
}

2.文字

language 复制代码
void drawtext(STTCanvas* canvas,int X1,int Y1, int size,int color,string txt) {
    LvDrawLabelDsc dsc(fm->getFont("文泉驿微米黑", size));
    dsc.color.full = color;
    dsc.opa = 255;
    canvas->drawText(X1, Y1, 1200, &dsc, txt.c_str());
}
最近修改: 2025-02-07Powered by