[X9D] Simu now displays greyscales
This commit is contained in:
+45
-27
@@ -122,13 +122,11 @@ public:
|
|||||||
void makeSnapshot(const FXDrawable* drawable);
|
void makeSnapshot(const FXDrawable* drawable);
|
||||||
void doEvents();
|
void doEvents();
|
||||||
void refreshDiplay();
|
void refreshDiplay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
FXImage *bmp;
|
||||||
|
FXImageFrame *bmf;
|
||||||
FX::FXuchar buf2[W2*H2/8];
|
bool firstTime;
|
||||||
FXBitmap *bmp;
|
|
||||||
FXBitmapFrame *bmf;
|
|
||||||
bool firstTime;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FXSlider *sliders[8];
|
FXSlider *sliders[8];
|
||||||
@@ -149,15 +147,13 @@ FXDEFMAP(Open9xSim) Open9xSimMap[]={
|
|||||||
|
|
||||||
FXIMPLEMENT(Open9xSim,FXMainWindow,Open9xSimMap,ARRAYNUMBER(Open9xSimMap))
|
FXIMPLEMENT(Open9xSim,FXMainWindow,Open9xSimMap,ARRAYNUMBER(Open9xSimMap))
|
||||||
|
|
||||||
|
|
||||||
Open9xSim::Open9xSim(FXApp* a)
|
Open9xSim::Open9xSim(FXApp* a)
|
||||||
:FXMainWindow(a,"Open9xSim",NULL,NULL,DECOR_ALL,20,90,0,0)
|
:FXMainWindow(a,"Open9xSim",NULL,NULL,DECOR_ALL,20,90,0,0)
|
||||||
{
|
{
|
||||||
|
|
||||||
firstTime=true;
|
firstTime=true;
|
||||||
for(int i=0; i<(W*H/8); i++) displayBuf[i]=0;//rand();
|
for(int i=0; i<(W*H/8); i++) displayBuf[i]=0;//rand();
|
||||||
for(int i=0; i<(W2*H2/8); i++) buf2[i]=0;//rand();
|
bmp = new FXPPMImage(getApp(),NULL,IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
|
||||||
bmp = new FXBitmap(a,&buf2,BITMAP_KEEP,W2,H2);
|
|
||||||
|
|
||||||
FXHorizontalFrame *hf00=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
FXHorizontalFrame *hf00=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||||
FXHorizontalFrame *hf01=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
FXHorizontalFrame *hf01=new FXHorizontalFrame(this,LAYOUT_CENTER_X);
|
||||||
@@ -213,8 +209,7 @@ Open9xSim::Open9xSim(FXApp* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bmf = new FXBitmapFrame(this,bmp,0,0,0,0,0,0,0,0,0);
|
bmf = new FXImageFrame(this,bmp);
|
||||||
bmf->setOnColor(FXRGB(0,0,0));
|
|
||||||
|
|
||||||
getApp()->addTimeout(this,2,100);
|
getApp()->addTimeout(this,2,100);
|
||||||
}
|
}
|
||||||
@@ -484,30 +479,53 @@ void Open9xSim::refreshDiplay()
|
|||||||
{
|
{
|
||||||
if (lcd_refresh) {
|
if (lcd_refresh) {
|
||||||
lcd_refresh = false;
|
lcd_refresh = false;
|
||||||
if (IS_BACKLIGHT_ON())
|
FXColor offColor = IS_BACKLIGHT_ON() ? BL_COLOR : FXRGB(200,200,200);
|
||||||
bmf->setOffColor(BL_COLOR);
|
FXColor onColor = FXRGB(0,0,0);
|
||||||
else
|
#if defined(PCBX9D)
|
||||||
bmf->setOffColor(FXRGB(200,200,200));
|
FXColor grey1Color = FXRGB(0xC0,0xC0,0xC0);
|
||||||
|
FXColor grey2Color = FXRGB(0xA0,0xA0,0xA0);
|
||||||
|
#endif
|
||||||
|
|
||||||
for(int x=0;x<W;x++){
|
for (int x=0;x<W;x++) {
|
||||||
for(int y=0;y<H;y++)
|
for (int y=0; y<H; y++) {
|
||||||
{
|
#if defined(PCBX9D)
|
||||||
int o2 = x/4 + y*W*2*2/8;
|
if ((lcd_buf[x+(y/8)*W] & (1<<(y%8))) && (lcd_buf[DISPLAY_PLAN_SIZE+x+(y/8)*W] & (1<<(y%8)))) {
|
||||||
if( lcd_buf[x+(y/8)*W] & (1<<(y%8))) {
|
bmp->setPixel(2*x, 2*y, onColor);
|
||||||
buf2[o2] |= 3<<(x%4*2);
|
bmp->setPixel(2*x+1, 2*y, onColor);
|
||||||
buf2[o2+W2/8] |= 3<<(x%4*2);
|
bmp->setPixel(2*x, 2*y+1, onColor);
|
||||||
|
bmp->setPixel(2*x+1, 2*y+1, onColor);
|
||||||
}
|
}
|
||||||
|
else if (lcd_buf[DISPLAY_PLAN_SIZE+x+(y/8)*W] & (1<<(y%8))) {
|
||||||
|
bmp->setPixel(2*x, 2*y, grey1Color);
|
||||||
|
bmp->setPixel(2*x+1, 2*y, grey1Color);
|
||||||
|
bmp->setPixel(2*x, 2*y+1, grey1Color);
|
||||||
|
bmp->setPixel(2*x+1, 2*y+1, grey1Color);
|
||||||
|
}
|
||||||
|
else if (lcd_buf[x+(y/8)*W] & (1<<(y%8))) {
|
||||||
|
bmp->setPixel(2*x, 2*y, grey2Color);
|
||||||
|
bmp->setPixel(2*x+1, 2*y, grey2Color);
|
||||||
|
bmp->setPixel(2*x, 2*y+1, grey2Color);
|
||||||
|
bmp->setPixel(2*x+1, 2*y+1, grey2Color);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (lcd_buf[x+(y/8)*W] & (1<<(y%8))) {
|
||||||
|
bmp->setPixel(2*x, 2*y, onColor);
|
||||||
|
bmp->setPixel(2*x+1, 2*y, onColor);
|
||||||
|
bmp->setPixel(2*x, 2*y+1, onColor);
|
||||||
|
bmp->setPixel(2*x+1, 2*y+1, onColor);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
buf2[o2] &= ~(3<<(x%4*2));
|
bmp->setPixel(2*x, 2*y, offColor);
|
||||||
buf2[o2+W2/8] &= ~(3<<(x%4*2));
|
bmp->setPixel(2*x+1, 2*y, offColor);
|
||||||
//buf2[x2/8+y2*W2/8] &= ~(3<<(x%8));
|
bmp->setPixel(2*x, 2*y+1, offColor);
|
||||||
|
bmp->setPixel(2*x+1, 2*y+1, offColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bmp->setData(buf2,0);
|
|
||||||
bmp->render();
|
bmp->render();
|
||||||
bmf->setBitmap(bmp);
|
bmf->setImage(bmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user