static void draw_screen(void) { GR_POINT tri[4] = { {5, 115}, {105, 115}, {55, 200}, {5, 115} }; GR_WINDOW_INFO winfo; GR_GC_ID gc; char dash1[2] = { 10, 5 }; char dash2[4] = { 5, 2, 1, 2 }; char dash3[4] = { 5, 2, 5, 5 }; char dash4[2] = { 2, 2 }; GrGetWindowInfo(g_main, &winfo); /* Draw several lines and a few boxes */ gc = GrNewGC(); GrSetGCLineAttributes(gc, GR_LINE_ONOFF_DASH); /* Draw a dashed box */ GrSetGCDash(gc, dash1, 2); GrRect(g_main, gc, 5, 5, 100, 100); GrSetGCDash(gc, dash2, 4); GrLine(g_main, gc, 10, 10, 95, 95); GrSetGCDash(gc, dash3, 4); GrEllipse(g_main, gc, 160, 55, 50, 50); GrSetGCDash(gc, dash4, 2); GrPoly(g_main, gc, 4, tri); GrDestroyGC(gc); }
static void GrSetGCLineAttributesWrapper(void *r) { nxSetGCLineAttributesReq *req = r; GrSetGCLineAttributes(req->gcid, req->linestyle); }
// width=x2, height=y2 void CObjectLine::Draw() { if(m_wid && m_gc) { GrSetGCForeground(m_gc, m_Color); if(m_isDash) { GrSetGCLineAttributes(m_gc, GR_LINE_ONOFF_DASH); GrSetGCDash(m_gc, g_dash_patern, 2); GrLine(m_wid, m_gc, m_rect.x, m_rect.y, m_rect.w, m_rect.h); GrSetGCLineAttributes(m_gc, GR_LINE_SOLID); } else { GrLine(m_wid, m_gc, m_rect.x, m_rect.y, m_rect.w, m_rect.h); } } }