ultimatepp/uppdev/SDraw/SDraw.cpp
cxl f4fdf98ecd syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@701 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-12-09 21:44:02 +00:00

51 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "SDraw.h"
NAMESPACE_UPP
void SDraw::DrawLine(int x1, int y1, int x2, int y2, int width)
{
// m_renb.clip_box( m_clipboxdev.x, m_clipboxdev.y, m_clipboxdev.x + m_clipboxdev.width, m_clipboxdev.y + m_clipboxdev.height);
agg::path_storage path;
path.move_to(x1, y1);
path.line_to(x2, y2);
agg::conv_stroke<agg::path_storage> stroke(path);
// stroke.line_join();
// stroke.line_cap();
stroke.line_cap(agg::round_cap);
// stroke.miter_limit();
stroke.width(width);
m_ras.add_path(stroke);
}
void SDraw::DrawEllipse(int x1, int y1, int cx, int cy, int width)
{
agg::ellipse el;
// el.init(double x¸ double y¸ double rx¸ double ry¸ unsigned num_steps=0¸ bool cw=false);
el.init(x1, y1, cx, cy);
agg::conv_stroke<agg::ellipse> stroke(el);
stroke.width(width);
m_ras.add_path(stroke);
}
Image SDraw::Render()
{
// m_ras.filling_rule(filling_rule_e filling_rule);
agg::render_scanlines(m_ras, m_sl, m_ren);
// agg::render_scanlines_aa_solid(m_ras, m_sl, m_ren, agg::rgba(1,1,0.5) );
return buffer;
}
SDraw::SDraw(int cx, int cy)
{
buffer.Create(cx, cy);
m_rbuf.attach((agg::int8u *)~buffer, cx, cy, cx * 4);
m_pixf.attach(m_rbuf);
m_renb.attach(m_pixf); //ren_base
m_ren.attach(m_renb);
}
END_UPP_NAMESPACE