소스 정보
- 저장소
- fangfuzha/capture
- 최근 소스 활동
- 2026년 4월 9일 09:53
- 감지된 SKILL.md 언어
- 중국어
- 스타
- 0
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/fangfuzha/capture --skill color-format-consistency명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | color-format-consistency |
| description | 诊断并修复跨不同图形 API 的颜色格式不一致问题(sRGB 与线性颜色空间)。当跨 API 渲染出现颜色发白、太亮或不正确时调用。 |
本 skill 帮助诊断和修复多种图形 API 之间的颜色格式不匹配问题,特别是当捕获 API 与渲染框架之间传递图像数据时。
最常见的原因是 sRGB 与线性颜色空间不一致:
当这些环节不一致时,伽马校正就会被错误地应用。
ColorFormat::Bgra8 通常是线性格式)wgpu::TextureFormat 是什么?Bgra8UnormSrgb)还是线性格式(如 Bgra8Unorm)?SurfaceConfiguration.format 选用了什么格式?is_srgb() 来优先选择 sRGB 格式?Capture Output -> Texture Upload -> Shader Sampling -> Surface Presentation
| | | |
Linear? Linear/sRGB? Expected? Linear/sRGB?
问题:windows_capture::settings::ColorFormat::Bgra8 输出线性数据,但表面配置为 sRGB 格式。
解决方案:
// 优先使用非 sRGB 的表面格式
let surface_format = if surface_caps
.formats
.contains(&wgpu::TextureFormat::Bgra8Unorm)
{
wgpu::TextureFormat::Bgra8Unorm
} else {
// 退回到第一个非 sRGB 格式
*surface_caps
.formats
.iter()
.find(|f| !f.is_srgb())
.unwrap_or(&surface_caps.formats[0])
};
确保纹理格式与源数据一致:
// 对于线性源数据(如 Windows Capture BGRA8)
let texture_format = wgpu::TextureFormat::Bgra8Unorm;
// 对于 sRGB 源数据
let texture_format = wgpu::TextureFormat::Bgra8UnormSrgb;
对于像素精确的捕获,使用 Nearest 过滤:
let sampler = device.create_sampler(&wgpu::SamplerDescriptor {
label: Some("Capture Sampler"),
address_mode_u: wgpu::AddressMode::ClampToEdge,
address_mode_v: wgpu::AddressMode::ClampToEdge,
address_mode_w: wgpu::AddressMode::ClampToEdge,
mag_filter: wgpu::FilterMode::Nearest,
min_filter: wgpu::FilterMode::Nearest,
mipmap_filter: wgpu::FilterMode::Nearest,
..Default::default()
});
| 源格式 | 纹理格式 | 表面格式 |
|---|---|---|
| Linear BGRA8 | Bgra8Unorm | Bgra8Unorm |
| sRGB BGRA8 | Bgra8UnormSrgb | Bgra8UnormSrgb |
| Linear RGBA8 | Rgba8Unorm | Rgba8Unorm |
| sRGB RGBA8 | Rgba8UnormSrgb | Rgba8UnormSrgb |
println!("Available formats: {:?}", surface_caps.formats);
println!("Is sRGB: {}", format.is_srgb());
#FF0000)并与源进行对比。