2D_Ati1X
来源:互联网 发布:手机运行windows系统 编辑:程序博客网 时间:2024/06/13 21:44
void Ati1X(HDC hdc,wchar_t *szFileName)
{
/*
Starting from this pattern:
A B C
D E F
G H I
The central pixel E is expanded in 4 new pixels:
E0 E1
E2 E3
*/
COLORREF A,B,C,D,E,F,G,H,I,E0,E1,E2,E3;
static CImage imgsrc,imgdes;
static HRESULT isLoad = 1;
COLORREF color;
if(isLoad)
{
isLoad = imgsrc.Load(szFileName);
if(isLoad)assert(0);
imgdes.Create(imgsrc.GetWidth(),imgsrc.GetHeight(),32);
for(int y = 0; y < imgsrc.GetHeight(); y++)
{
for(int x = 0; x < imgsrc.GetWidth(); x++)
{
A = imgsrc.GetPixel(max(0,x-1), max(0,y-1));
B = imgsrc.GetPixel(x, max(0,y-1));
C = imgsrc.GetPixel( min(x+1,imgsrc.GetWidth()-1), max(0,y-1) );
D = imgsrc.GetPixel( max(0,x-1), y );
E = imgsrc.GetPixel( x, y );
F = imgsrc.GetPixel( min(x+1,imgsrc.GetWidth()-1), y );
G = imgsrc.GetPixel( max(0,x-1), min(y+1,imgsrc.GetHeight()-1) );
H = imgsrc.GetPixel( x, min(y+1,imgsrc.GetHeight()-1) );
I = imgsrc.GetPixel( min(x+1,imgsrc.GetWidth()-1), min(y+1,imgsrc.GetHeight()-1) );
E0 = E;
//if( E == 0)
{
if(E != A)
{
if(D == A && A == B)
E0 = A;
}
if( E != C)
{
if(F == C && C == B)
E0 = C;
}
if(E != G)
{
if( D == G && G == H)
E0 = G;
}
if(E != I)
{
if(H == I && I == F)
E0 = I;
}
}
imgdes.SetPixel(x,y,E0);
}
}
wchar_t wszSaveFileName[50] = {0};
wsprintf(wszSaveFileName,L"D://ATI 1X_%ld_%ld.bmp",1,1);
imgdes.Save(wszSaveFileName);
}
imgdes.Draw(hdc,10,10,imgdes.GetWidth(),imgdes.GetHeight());
}
- 2D_Ati1X
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- 2
- >2
- 2
- 2
- sockaddr与sockaddr_in结构体
- Java 复合运算符的使用
- 股市赚钱,靠什么?(7)
- 股市赚钱,靠什么?(8)
- oracle系统表 表注释 列注释
- 2D_Ati1X
- QQ留言代码,网页QQ留言
- FOJ 1436 Renting Boats
- javascript 函数
- 一个java嵌入数据库hsql 的web自启动部署
- 使用母版页时内容页如何使用css和javascript!
- mysql c preparestatement
- PHP 题二
- PKU1061 解题报告 青蛙的约会 __用扩展欧几里得解模同余方程