convert color
This commit is contained in:
@@ -789,6 +789,10 @@ class Graphic2 : Graphic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int convertColor(int color)
|
||||||
|
{
|
||||||
|
return color & 0xFFF8F8F8;
|
||||||
|
}
|
||||||
int* buffer;
|
int* buffer;
|
||||||
override @property void useGRP(int page)
|
override @property void useGRP(int page)
|
||||||
{
|
{
|
||||||
@@ -803,6 +807,7 @@ class Graphic2 : Graphic
|
|||||||
|
|
||||||
override void gpset(int page, int x, int y, uint color)
|
override void gpset(int page, int x, int y, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
auto wa = writeArea[petitcom.displaynum];
|
auto wa = writeArea[petitcom.displaynum];
|
||||||
int cx2 = wa.x + wa.w;
|
int cx2 = wa.x + wa.w;
|
||||||
int cy2 = wa.y + wa.h;
|
int cy2 = wa.y + wa.h;
|
||||||
@@ -816,6 +821,7 @@ class Graphic2 : Graphic
|
|||||||
import std.math;
|
import std.math;
|
||||||
override void gline(int page, int x, int y, int x2, int y2, uint color)
|
override void gline(int page, int x, int y, int x2, int y2, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
int dx = abs(x2 - x);
|
int dx = abs(x2 - x);
|
||||||
int dy = abs(y2 - y);
|
int dy = abs(y2 - y);
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
@@ -854,6 +860,7 @@ class Graphic2 : Graphic
|
|||||||
|
|
||||||
override void gbox(int page, int x, int y, int x2, int y2, uint color)
|
override void gbox(int page, int x, int y, int x2, int y2, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
int sx, sy, ex, ey;
|
int sx, sy, ex, ey;
|
||||||
if (x > x2)
|
if (x > x2)
|
||||||
{
|
{
|
||||||
@@ -903,6 +910,7 @@ class Graphic2 : Graphic
|
|||||||
|
|
||||||
override void gfill(int page, int x, int y, int x2, int y2, uint color)
|
override void gfill(int page, int x, int y, int x2, int y2, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
int sx, sy, ex, ey;
|
int sx, sy, ex, ey;
|
||||||
if (x > x2)
|
if (x > x2)
|
||||||
{
|
{
|
||||||
@@ -969,23 +977,28 @@ class Graphic2 : Graphic
|
|||||||
|
|
||||||
override void gcls(int page, uint color)
|
override void gcls(int page, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
gfill(page, 0, 0, width - 1, height - 1, color);
|
gfill(page, 0, 0, width - 1, height - 1, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
override void gpaint(int page, int x, int y, uint color)
|
override void gpaint(int page, int x, int y, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
override void gcircle(int page, int x, int y, int r, uint color)
|
override void gcircle(int page, int x, int y, int r, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
override void gcircle(int page, int x, int y, int r, int startr, int endr, int flag, uint color)
|
override void gcircle(int page, int x, int y, int r, int startr, int endr, int flag, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
override void gputchr(int page, int x, int y, int text, int scalex, int scaley, uint color)
|
override void gputchr(int page, int x, int y, int text, int scalex, int scaley, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
drawCharacter(x, y, scalex, scaley, color, cast(wchar)text);
|
drawCharacter(x, y, scalex, scaley, color, cast(wchar)text);
|
||||||
df = true;
|
df = true;
|
||||||
}
|
}
|
||||||
@@ -1133,6 +1146,7 @@ class Graphic2 : Graphic
|
|||||||
}
|
}
|
||||||
override void gputchr(int page, int x, int y, wstring text, int scalex, int scaley, uint color)
|
override void gputchr(int page, int x, int y, wstring text, int scalex, int scaley, uint color)
|
||||||
{
|
{
|
||||||
|
color = convertColor(color);
|
||||||
foreach (i, c; text)
|
foreach (i, c; text)
|
||||||
{
|
{
|
||||||
drawCharacter(x + scalex * cast(int)i * 8, y, scalex, scaley, color, c);
|
drawCharacter(x + scalex * cast(int)i * 8, y, scalex, scaley, color, c);
|
||||||
@@ -1188,6 +1202,7 @@ class Graphic2 : Graphic
|
|||||||
auto c = cast(int)array[iy * arrayW + ix];
|
auto c = cast(int)array[iy * arrayW + ix];
|
||||||
if (flag)
|
if (flag)
|
||||||
c = RGBA16ToARGB32Color(c);
|
c = RGBA16ToARGB32Color(c);
|
||||||
|
c = convertColor(c);
|
||||||
if (copymode || c >> 24)
|
if (copymode || c >> 24)
|
||||||
*(buffer + (iy + y) * width + (x + ix)) = c;
|
*(buffer + (iy + y) * width + (x + ix)) = c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user