{"id":17982489,"url":"https://github.com/nekocode/cxi","last_synced_at":"2025-07-20T20:05:12.965Z","repository":{"id":98385355,"uuid":"42161503","full_name":"nekocode/cxi","owner":"nekocode","description":"批处理 mask 位图，转换为带 alpha 的 png 图片","archived":false,"fork":false,"pushed_at":"2015-09-09T06:56:00.000Z","size":5512,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T01:48:32.287Z","etag":null,"topics":["graphics","tool"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nekocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-09T06:54:46.000Z","updated_at":"2023-09-08T17:01:29.000Z","dependencies_parsed_at":"2023-03-08T10:30:40.545Z","dependency_job_id":null,"html_url":"https://github.com/nekocode/cxi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nekocode/cxi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekocode%2Fcxi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekocode%2Fcxi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekocode%2Fcxi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekocode%2Fcxi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nekocode","download_url":"https://codeload.github.com/nekocode/cxi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nekocode%2Fcxi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189594,"owners_count":23890062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphics","tool"],"created_at":"2024-10-29T18:14:22.462Z","updated_at":"2025-07-20T20:05:12.936Z","avatar_url":"https://github.com/nekocode.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\r\n\r\n批处理当前目录下所有 `带遮罩图的 24bit 图片` *（常见于比较旧的游戏资源图片）*  转换为 `带 alpha 通道的 32bit png 格式图片`\r\n\r\n### kernel algorithm\r\n```c++\r\nCxImage mask(CxImage input_Image, BOOL Negative)\r\n{\r\n\tif(!input_Image.IsValid())\r\n\t\treturn 0;\r\n\r\n\tCxImage basic,alpha;\r\n\tRECT rect;\r\n\tlong width=input_Image.GetWidth()/2,\r\n\t\theight=input_Image.GetHeight();\r\n\r\n\trect.top = 0;rect.left = 0;\r\n\trect.right = width;\r\n\trect.bottom = height;\r\n\tinput_Image.Crop(rect,\u0026basic);\r\n\r\n\trect.top = 0;rect.left = width;\r\n\trect.right = width*2;\r\n\trect.bottom = height;\r\n\tinput_Image.Crop(rect,\u0026alpha);\r\n\r\n\t//在这里创建遮罩层\r\n\r\n\tif(!basic.AlphaIsValid())\r\n\t\tbasic.AlphaCreate();           //创建透明通道\r\n\r\n\tif(Negative)\r\n\t\talpha.Negative();              //遮罩层反色处理\r\n\r\n\tRGBQUAD rgb;\r\n\tfor(int y=0;y\u003cheight;y++)\r\n\t{\r\n\t\tfor(int x=0;x\u003cwidth;x++)\r\n\t\t{\r\n\t\t\trgb = alpha.GetPixelColor(x,y,0);\r\n\t\t\tbasic.AlphaSet(x,y,rgb.rgbRed);\r\n\t\t}\r\n\t}\r\n\treturn basic;\r\n}\r\n```\r\n\r\n![效果图](http://git.oschina.net/uploads/images/2015/0831/171346_f470c33d_8742.png \"在这里输入图片标题\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekocode%2Fcxi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnekocode%2Fcxi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnekocode%2Fcxi/lists"}