mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
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:
parent
6c84d14fae
commit
9f3f2c637e
5 changed files with 40 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ void PaintingPainter::Create(double cx, double cy)
|
|||
|
||||
void PaintingPainter::Create(Sizef sz)
|
||||
{
|
||||
Create(sz.cx, sz.cy);
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue