mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-13 14:17:01 -06:00
39 lines
821 B
C++
39 lines
821 B
C++
#include "glyph.h"
|
|
|
|
struct sMakeGlyph : public ImageMaker
|
|
{
|
|
int chr;
|
|
Font font;
|
|
int angle;
|
|
Color color;
|
|
|
|
virtual String Key() const {
|
|
StringBuffer h;
|
|
RawCat(h, chr);
|
|
RawCat(h, font);
|
|
RawCat(h, angle);
|
|
RawCat(h, color);
|
|
return h;
|
|
}
|
|
|
|
virtual Image Make() const {
|
|
RTIMING("Render glyph");
|
|
return RenderGlyph(font, chr, color, angle);
|
|
}
|
|
};
|
|
|
|
void FDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
|
|
{
|
|
sMakeGlyph g;
|
|
g.font = font;
|
|
g.color = ink;
|
|
g.angle = angle; // TODO!
|
|
for(int i = 0; i < n; i++) {
|
|
g.chr = text[i];
|
|
RTIMING("Paint glyph");
|
|
Image m = MakeImage(g);
|
|
Point h = m.GetHotSpot();
|
|
SysDrawImageOp(x - h.x, y - h.y, m, m.GetSize(), Null);
|
|
x += dx ? *dx++ : font[g.chr];
|
|
}
|
|
}
|