float inc = 1.0f/(numColors-1);
float percent = 0;
int start;
- ColorAlpha color;
+ ColorAlpha color = 0;
int c;
for(c = start = 0; c<numColors; c++)
{
float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
smoothness, smoothness);
+ int ca = key->color.a;
int cr = key->color.color.r;
int cg = key->color.color.g;
int cb = key->color.color.b;
+ int na = nextKey->color.color.r;
int nr = nextKey->color.color.r;
int ng = nextKey->color.color.g;
int nb = nextKey->color.color.b;
+ int a = (int)(ca + (na - ca) * scale);
int r = (int)(cr + (nr - cr) * scale);
int g = (int)(cg + (ng - cg) * scale);
int b = (int)(cb + (nb - cb) * scale);
+ a = Max(Min(r, 255),0);
r = Max(Min(r, 255),0);
g = Max(Min(g, 255),0);
b = Max(Min(b, 255),0);
- newColor = Color { (byte)r, (byte)g, (byte)b };
+ newColor = ColorAlpha { (byte)a, { (byte)r, (byte)g, (byte)b } };
}
else if(key)
newColor = key ? key->color : 0;
bool blend;
bool writeColor;
ColorAlpha blitTint;
+ ColorAlpha outlineColor;
blitTint = white;
blend = true;
writeColor = true;
alphaWrite = blend;
+ outlineColor = black;
~Surface()
{
return ((LFBSurface)driverData).bitmap;
}
}
+ property ColorAlpha outlineColor
+ {
+ set { outlineColor = value; }
+ get { return outlineColor; }
+ }
ColorAlpha GetPixel(int x, int y)
{
}
}
- void WriteText(int x, int y, char * text, int len)
+ void WriteText(int x, int y, const char * text, int len)
+ {
+ if(text)
+ driver.WriteText(display, this, x,y, text, len, 0, null); //, null);
+ }
+
+ void WriteText2(int x, int y, const char * text, int len, int prevGlyph, int * rPrevGlyph)
{
if(text)
- driver.WriteText(display, this, x,y, text, len);
+ driver.WriteText(display, this, x,y, text, len, prevGlyph, rPrevGlyph);
+ }
+
+ void TextExtent(const char * text, int len, int * width, int * height)
+ {
+ int advance = 0;
+ driver.TextExtent(display, this, text, len, width, height, 0, null, &advance);
+ if(width)
+ *width += advance;
}
- void TextExtent(char * text, int len, int * width, int * height)
+ void TextExtent2(const char * text, int len, int * width, int * height, int prevGlyph, int * rPrevGlyph, int * overHang)
{
- driver.TextExtent(display, this, text, len, width, height);
+ driver.TextExtent(display, this, text, len, width, height, prevGlyph, rPrevGlyph, overHang);
}
- void WriteTextf(int x, int y, char * format, ...)
+ void WriteTextf(int x, int y, const char * format, ...)
{
if(format)
{
va_start(args, format);
vsnprintf(text, sizeof(text), format, args);
text[sizeof(text)-1] = 0;
- driver.WriteText(display, this, x,y, text, strlen(text));
+ if(driver)
+ driver.WriteText(display, this, x,y, text, strlen(text), 0, null);
va_end(args);
}
}
- void CenterTextf(int x, int y, char * format, ...)
+ void CenterTextf(int x, int y, const char * format, ...)
{
if(format)
{
char text[MAX_F_STRING];
va_list args;
int len;
- int w, h;
+ int w, h, oh;
va_start(args, format);
vsnprintf(text, sizeof(text), format, args);
text[sizeof(text)-1] = 0;
len = strlen(text);
- driver.TextExtent(display, this, text, len, &w, &h);
- driver.WriteText(display, this, x - w/2, y, text, len);
+ driver.TextExtent(display, this, text, len, &w, &h, 0, null, &oh);
+ w += oh;
+ driver.WriteText(display, this, x - w/2, y, text, len, 0, null);
va_end(args);
}
}
- void WriteTextDots(Alignment alignment, int x, int y, int width, char * text, int len)
+ void WriteTextDots(Alignment alignment, int x, int y, int width, const char * text, int len)
{
int w, h;
}
}
- void WriteTextDotsf(Alignment alignment, int x, int y, int width, char * format, ...)
+ void WriteTextDotsf(Alignment alignment, int x, int y, int width, const char * format, ...)
{
if(format)
{