static int Clear(Engine *engine, int always) { XEngine *xeng = (XEngine *)engine; if (!xeng->w) return 1; if ((always || xeng->e.marked) && xeng->w==xeng->win) { int tm = xeng->topMargin; int lm = xeng->leftMargin; if (tm || lm) { int xmax = (int)xeng->swapped.window.xmax; int ymax = (int)xeng->swapped.window.ymin; if (xmax > lm+xeng->wtop) xmax = lm+xeng->wtop; if (ymax > tm+xeng->htop) ymax = tm+xeng->htop; if (xeng->clipping) { p_clip(xeng->w, 0,0,0,0); xeng->clipping = 0; } p_color(xeng->w, P_BG); p_rect(xeng->w, lm, tm, xmax, ymax, 0); } else { p_clear(xeng->w); } } if (xeng->e.colorChange) ChangePalette(engine); xeng->e.marked = 0; return 0; }
static int BeginPage(PSEngine *psEngine) { int currentPage= psEngine->currentPage; psEngine->e.marked= 1; /* A change in color table can take place only at the beginning of a page. ChangePalette strobes the palette in the Engine base class part into the PSEngine palette. */ psEngine->nColors= 0; /* reset to mono mode */ ChangePalette((Engine *)psEngine); if (psEngine->nchars && PutLine(psEngine)) return 1; if (PutLine(psEngine)) return 1; sprintf(line, "%%%%Page: %d %d", currentPage, currentPage); if (Append(psEngine, line) || PutLine(psEngine)) return 1; if (Append(psEngine, "%%PageBoundingBox: (atend)") || PutLine(psEngine)) return 1; if (Append(psEngine, "GistPrimitives begin /PG save def GI") || PutLine(psEngine)) return 1; /* Set transform viewport to reflect current page orientation */ if (psEngine->landscape != psEngine->e.landscape) { SetPSTransform(&psEngine->e.transform, psEngine->e.landscape); psEngine->landscape= psEngine->e.landscape; } if (psEngine->landscape) { if (Append(psEngine, "LAND") || PutLine(psEngine)) return 1; } if (psEngine->e.colorMode && psEngine->e.palette && psEngine->e.nColors>0) { int i, nColors= psEngine->e.nColors; GpColorCell *palette= psEngine->e.palette; long color; sprintf(line, "%d CT", nColors); if (Append(psEngine, line) || PutLine(psEngine)) return 1; for (i=0 ; i<nColors ; i++) { color= P_R(palette[i])<<16 | P_G(palette[i])<<8 | P_B(palette[i]); sprintf(line, "%06lx", color); if (Append(psEngine, line)) return 1; } if (psEngine->nchars && PutLine(psEngine)) return 1; psEngine->colorMode= 1; /* color table has been written */ psEngine->nColors= nColors; } else { psEngine->colorMode= 0; /* NO color table exists on this page */ /* But, if there is a palette, still want to use grays */ if (psEngine->e.palette && psEngine->e.nColors>0) psEngine->nColors= psEngine->e.nColors; } if (Append(psEngine, "%%EndPageSetup") || PutLine(psEngine)) return 1; return 0; }
void RendererBase::CreateScreen() { imgBuf1 = new BYTE[GB_SCREEN_W*GB_SCREEN_H*3]; imgBuf2 = new BYTE[GB_SCREEN_W*GB_SCREEN_H*3]; backBuffer = imgBuf1; frontBuffer = imgBuf2; OnClear(); ChangePalette(SettingsGetGreenScale()); }
void DrawEntireMenuScreen(void) { /***** Frankly, I don't care which menu. *****/ int a; DrawMenuBackdrop(); a=0; while (CurrentMenuStatus[a]!=-1) { if (CurrentMenuStatus[a]!=0) { Illuminate(a); } else { DeIlluminate(a); } a++; } UpdateScreen[VideoMode](); /* KJL 15:52:41 03/20/97 - hack from intro that's ended up here */ { // fade in if (WhiteOutLevel==0) { int fadeLevel = 0; do { ResetFrameCounter(); FadePaletteToWhite(TestPalette,fadeLevel); fadeLevel+=NormalFrameTime*4; FrameCounterHandler(); } while(fadeLevel<65536); ChangePalette(TestPalette); WhiteOutLevel=65536; } } }
/* * 以240x320,8bpp的显示模式测试TFT LCD */ void Test_Lcd_Tft_8Bit_240320(void) { Lcd_Port_Init(); // 设置LCD引脚 Tft_Lcd_Init(MODE_TFT_8BIT_240320); // 初始化LCD控制器 Lcd_PowerEnable(0, 1); // 设置LCD_PWREN有效,它用于打开LCD的电源 Lcd_EnvidOnOff(1); // 使能LCD控制器输出信号 Lcd_Palette8Bit_Init(); // 初始化调色板 ClearScr(0x0); // 清屏 printf("[TFT 64K COLOR(16bpp) LCD TEST]\n"); printf("1. Press any key to draw line\n"); getc(); DrawLine(0 , 0 , 239, 0 , 0); // 颜色为DEMO256pal[0] DrawLine(0 , 0 , 0 , 319, 1); // 颜色为DEMO256pal[1] DrawLine(239, 0 , 239, 319, 2); // …… DrawLine(0 , 319, 239, 319, 4); DrawLine(0 , 0 , 239, 319, 8); DrawLine(239, 0 , 0 , 319, 16); DrawLine(120, 0 , 120, 319, 32); DrawLine(0 , 160, 239, 160, 64); printf("2. Press any key to draw circles\n"); getc(); Mire(); printf("3. Press any key to fill the screem with one color\n"); getc(); ClearScr(128); // 输出单色图像,颜色为DEMO256pal[128] printf("4. Press any key to fill the screem by temporary palette\n"); getc(); ClearScrWithTmpPlt(0x0000ff); // 输出单色图像,颜色为蓝色 printf("5. Press any key to fill the screem by palette\n"); getc(); DisableTmpPlt(); // 关闭临时调色板寄存器 ChangePalette(0xffff00); // 改变整个调色板为黄色,输出单色图像 printf("6. Press any key stop the testing\n"); getc(); Lcd_EnvidOnOff(0); }