Painter: DrawImageOp completed to implement all original Draw modes

git-svn-id: svn://ultimatepp.org/upp/trunk@1951 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-25 19:03:05 +00:00
parent 202b0a1ccb
commit d58101e4ed
2 changed files with 671 additions and 669 deletions

File diff suppressed because it is too large Load diff

View file

@ -64,15 +64,16 @@ void Painter::DrawRectOp(int x, int y, int cx, int cy, Color color)
Fill(color);
}
void Painter::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
void Painter::DrawImageOp(int x, int y, int cx, int cy, const Image& image, const Rect& src, Color color)
{
// Color and src support!!!
Image img = IsNull(color) ? image : SetColorKeepAlpha(image, color);
RectPath(x, y, cx, cy);
Sizef sz = img.GetSize();
Fill(img, Xform2D::Scale(cx / sz.cx, cy / sz.cy) * Xform2D::Translation(x, y));
double sw = (double)cx / src.GetWidth();
double sh = (double)cy / src.GetHeight();
Fill(img, Xform2D::Scale(sw, sh) * Xform2D::Translation(x - sw * src.left, y - sh * src.top));
}
void Painter::DrawLineStroke(int width, Color color)
{
Begin();