# cxi **Repository Path**: nekocode/cxi ## Basic Information - **Project Name**: cxi - **Description**: 带遮罩图像批处理转换为带透明通道 PNG 格式图像 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2015-08-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # README 批处理当前目录下所有 `带遮罩图的 24bit 图片` *(常见于比较旧的游戏资源图片)* 转换为 `带 alpha 通道的 32bit png 格式图片` ### kernel algorithm ```c++ CxImage mask(CxImage input_Image, BOOL Negative) { if(!input_Image.IsValid()) return 0; CxImage basic,alpha; RECT rect; long width=input_Image.GetWidth()/2, height=input_Image.GetHeight(); rect.top = 0;rect.left = 0; rect.right = width; rect.bottom = height; input_Image.Crop(rect,&basic); rect.top = 0;rect.left = width; rect.right = width*2; rect.bottom = height; input_Image.Crop(rect,&alpha); //在这里创建遮罩层 if(!basic.AlphaIsValid()) basic.AlphaCreate(); //创建透明通道 if(Negative) alpha.Negative(); //遮罩层反色处理 RGBQUAD rgb; for(int y=0;y