Draw::DrawPainting (requires Painting package to be 'used')

git-svn-id: svn://ultimatepp.org/upp/trunk@755 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-01-15 23:11:30 +00:00
parent 6c84d14fae
commit 9f3f2c637e
5 changed files with 40 additions and 6 deletions

View file

@ -223,15 +223,20 @@ void Painter::Paint(const Painting& pic)
}
}
Image AsImage(const Painting& p, Size sz, Size isz, Point pos)
void PaintImageBuffer(ImageBuffer& ib, const Painting& p, Size sz, Point pos)
{
ImageBuffer ib(sz);
BufferPainter sw(ib);
Sizef psz = p.GetSize();
sw.Scale(psz.cx / sz.cx, psz.cy / sz.cy);
sw.Clear(White());
sw.Scale(sz.cx / psz.cx, sz.cy / psz.cy);
sw.Translate(-pos.x, -pos.y);
sw.Paint(p);
return ib;
}
void RegisterDrawPaintingFn(void (*fn)(ImageBuffer& ib, const Painting& pw, Size sz, Point pos));
INITBLOCK
{
RegisterDrawPaintingFn(PaintImageBuffer);
}
END_UPP_NAMESPACE

View file

@ -243,6 +243,7 @@ void PaintingPainter::Create(double cx, double cy)
void PaintingPainter::Create(Sizef sz)
{
Create(sz.cx, sz.cy);
}
END_UPP_NAMESPACE

View file

@ -137,4 +137,4 @@ public:
PaintingPainter(Sizef sz) { Create(sz); }
};
Image AsImage(const Painting& p, Size sz);
void PaintImageBuffer(ImageBuffer& ib, const Painting& p, Size sz, Point pos);