void EditorPoint::drawPoint(int p_index, bool &p_isSelected, bool &p_isLight, CL_GraphicContext &p_gc) { CL_Colorf color = (p_isSelected || p_isLight) ? m_impl->m_selectedPointColor : m_impl->m_pointColor; if (p_isSelected) { if (isFirstKey(CL_KEY_SHIFT) && m_impl->m_selectedIndex != -1) { CL_Pen pen; pen.set_line_width(PAINT_LINE_WIDTH); p_gc.set_pen(pen); int x1, y1, x2, y2; getShiftRect(p_index, &x1, &y1, &x2, &y2); CL_Draw::line(p_gc, x1, y1, x2, y2, m_impl->m_shiftLineColor); pen.set_line_width(1.0f); p_gc.set_pen(pen); CL_Draw::fill(p_gc, getPointRect(m_impl->m_minShiftPoint), m_impl->m_minAndMaxShiftRectColor); CL_Draw::fill(p_gc, getPointRect(m_impl->m_maxShiftPoint), m_impl->m_minAndMaxShiftRectColor); } } CL_Draw::fill(p_gc, getPointRect(p_index), color); if (p_isSelected) { CL_Draw::box(p_gc, getPointRect(p_index), m_impl->m_selectedPointFrameColor); } }
void Label::draw(CL_GraphicContext &p_gc) { assert(isLoaded()); float ax, ay; const CL_Size s = size(p_gc); calculateAttachPoint(s.width, s.height, ax, ay); const float x = m_pos.x - ax; const float y = m_pos.y - ay - m_fontMetrics.get_descent(); m_clFont->draw_text(p_gc, x, y, m_text, m_color); #if !defined(NDEBUG) && defined(DRAW_LABEL_BOUNDS) // draw label frame debug code CL_Pen newPen; newPen.set_line_width(1.0f); const CL_Pen oldPen = p_gc.get_pen(); p_gc.set_pen(newPen); const float y2 = y + m_fontMetrics.get_descent(); CL_Draw::box(p_gc, x, y2 - s.height, x + s.width, y2, CL_Colorf::red); p_gc.set_pen(oldPen); #endif // !NDEBUG && DRAW_LABEL_BOUNDS }
void LabelImpl::draw(CL_GraphicContext &p_gc) { G_ASSERT(m_parent->isLoaded()); float ax, ay; const CL_Size s = m_parent->size(p_gc); calculateAttachPoint(s.width, s.height, ax, ay); CL_Pointf position; position.x = m_pos.x - ax; position.y = m_pos.y - ay - m_fontMetrics.get_descent(); if (m_shadowVisible) { drawShadow(p_gc, position); } m_clFont->draw_text(p_gc, position.x, position.y, m_text, m_color); #if !defined(NDEBUG) && defined(DRAW_LABEL_BOUNDS) // draw label frame debug code CL_Pen newPen; newPen.set_line_width(1.0f); const CL_Pen oldPen = p_gc.get_pen(); p_gc.set_pen(newPen); const float y2 = y + m_fontMetrics.get_descent(); CL_Draw::box(p_gc, x, y2 - s.height, x + s.width, y2, CL_Colorf::red); p_gc.set_pen(oldPen); #endif // !NDEBUG && DRAW_LABEL_BOUNDS }
void TireTrack::draw(CL_GraphicContext &p_gc) { CL_Pen pen; pen.set_line_width(3); p_gc.set_pen(pen); // TODO: how to make blend? CL_Draw::line(p_gc, m_fromPoint, m_toPoint, CL_Colorf(0.0f, 0.0f, 0.0f, m_fromAlpha)); }