|
发表于 2016-8-12 11:29:41
|
显示全部楼层
核心的显示部分,我贴一点头文件:
#ifdef __BORLANDC__
#include <Graphics.hpp>
#include "uSimEL.H"
extern TColor* g_bmline[];
extern TColor ColorTab[16];//单片机的颜色是4位的索引色,这是电脑的调色板
inline void setPT(UI x,UI y,UI col)
{
g_bmline[y][x]=ColorTab[col];
}
inline UI getPT(UI x,UI y,UI col)
{
int x32,x4;
x32=g_bmline[y][x];
for(int x=0;x<16;x++)
if(x32==ColorTab[x])return x;
return 0;
}
void InitSimEL(){//仿真的显存,是个内存bmp对象,数据每一行都用ScanLine取出来,方便单独访问每一行。
g_bmp=new(Graphics::TBitmap);
g_bmp->Width=640;
g_bmp->Height=480;
g_bmp->PixelFormat=pf32bit;
g_bmp->Canvas->Brush->Color=clBlue;
g_bmp->Canvas->FillRect(Rect(0,0,640,480));
g_cva=Form1->pbx1->Canvas;
for(int i=0;i<480;i++)
{
g_bmline[i]=(TColor*)g_bmp->ScanLine[i];
}
}
#define BEGIN_PAINT()
inline void END_PAINT()
{
Form1->pbx1->Refresh();
}
#endif
#ifdef __TMS320C28XX__
void filldata(UI *p,unsigned int len,UI data);
extern UI* framebuffer;
inline void setPT(UI x,UI y,UI col)
{
framebuffer[((UL)y)*640L+x]=col;
}
inline UI getPT(UI x,UI y,UI col)
{
return framebuffer[((UL)y)*640L+x];
}
extern void FillScr(UI col);
extern void BEGIN_PAINT();
#endif
|
|