求利用C/C++实现图像的几何变换的代码,转置,缩放,平移,都可以的。。 5
1个回答
2015-03-12
展开全部
* 输入参数:无
* 输出参数:无
* 返 回 值:无
*/
void COkMfcView::exDemoMask()
{
int i;
RECT rect;
BYTE lpMask[40960];
BLOCKINFO blk;
LOGFONT lfLogFont = {-20, 0, 0, 0, 400, 0, 0, 0, 0, 1, 2, 1, 26, "Arial"};
SETTEXTMODE textmode = {0x0, 0xffffff, 2, 0, 0}; //
//1. way (to set whole rect to enable/disable)
//graph 1.
rect.left = 200;
rect.top = 100;
rect.right = 280;
rect.bottom = 180;
okSetMaskRect(hBoard, &rect, (LPBYTE)0); //disable Big Rect video
InflateRect(&rect, -20, -20);
okSetMaskRect(hBoard, &rect, (LPBYTE)1); //enable Small Rect video
//graph 2.
SetRect(&rect, 0, 200, 200, 201);
okSetMaskRect(hBoard, &rect, (LPBYTE)0); //D ---
SetRect(&rect, 0, 202, 200, 203);
okSetMaskRect(hBoard, &rect, (LPBYTE)0); //D ---
SetRect(&rect, 0, 205, 200, 206);
okSetMaskRect(hBoard, &rect, (LPBYTE)0); //D ---
//2. way (to set mask rect with each pixel setting)
//graph 3.
ZeroMemory(lpMask, 20000); //clear bits
for(i=20; i<80; i++)
lpMask[100+i] = 1; //E ~~~
for(i=1; i<99; i++)
lpMask[100*50+i] = 1; //E ---
for(i=1; i<99; i++)
lpMask[i*100+50] = 1; //E |
for(i=0; i<=99; i++)
lpMask[i*100+i] = 1; //E /
SetRect(&rect, 10, 310, 110, 410); //Disable Rect with + ~
okSetMaskRect(hBoard, &rect, lpMask);
//graph 4.
FillMemory(lpMask, 40000, 1); //set bits
for(i=1; i<99; i++)
lpMask[5000+i] = 0; //D ---
for(i=1; i<99; i++)
lpMask[i*100+50] = 0; //D |
SetRect(&rect, 200, 319, 300, 419); //disable +
okSetMaskRect(hBoard, &rect, lpMask);
//example to set char
{
RECT rect = {0, 0, 0, 0};
FillMemory(lpMask, 40000, 1); //set bits to init
blk.lpBits = lpMask;
blk.iBitCount = 8;
blk.iWidth = 100;
blk.iHeight = 30;
okSetTextTo(hBoard, (TARGET)&blk, &rect, &lfLogFont, &textmode, "嘉恒中自", 8);
SetRect(&rect, 300, 200, 300+100, 200+30); //set characters
okSetMaskRect(hBoard, &rect, lpMask);
FillMemory(lpMask, 40000, 1); //set bits to init
SetRect(&rect, 0, 0, 0, 0); //set characters
okSetTextTo(hBoard, (TARGET)&blk, &rect, &lfLogFont, &textmode, "JoinHope", 8);
SetRect(&rect, 300, 240, 300+100, 240+30); //set chinese characters
okSetMaskRect(hBoard, &rect, lpMask);
}
//example to set char and graphics by way of windows hdc
{
HANDLE hDCBitmap;
HDC hdcMem;
RECT rect= {0,0,200,100};
FillMemory(lpMask,40000,1); //set bits to init
blk.lpBits=lpMask;
blk.iBitCount=8;
blk.iWidth=200;
blk.iHeight=100;
hdcMem=okCreateDCBitmap( hBoard, (TARGET)&blk, &hDCBitmap);
SetTextColor(hdcMem,0xffffff); //cf
SetBkColor(hdcMem,0); //cf
TextOut(hdcMem,100,0,"7123456",7);
MoveToEx(hdcMem,100,100,NULL);
LineTo(hdcMem,200,500);
Ellipse(hdcMem,0,0,200,100);
okMapDCBitmapTo(hDCBitmap,0);
okFreeDCBitmap(hDCBitmap);
okSetMaskRect(hBoard,&rect,lpMask);
}
//turn on mask
okEnableMask(hBoard, m_Enablemask); //1 positive mask
//okEnableMask(hBoard,2); //2 negtive mode
}
追问
这是什么代码??是转置还是平移或者什么的
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询