프로젝트
GitHub에서 보기
ziglibs/painterz
소개
Low-level implementation of different painting primitives (lines, rectangles, ...) without specialization on a certain draw target
디자인 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalpainterz
The idea of this library is to provide platform-independent, embedded-feasible implementations of several drawing primitives.
The library exports a generic Canvas type which is specialized on a setPixel function that will put pixels of type Color onto a Framebuffer.
It's currently not possible or planned to do blending, but alpha test could be implemented by ignoring certain color values in the setPixel function.
Usage Example

See src/example.zig for a full usage example.
const Pixel = packed struct {
r: u8, g: u8, b: u8, a: u8
};
const Framebuffer = struct {
buffer: []Pixel,
fn setPixel(fb: @This(), x: isize, y: isize, c: Pixel) void {
if (x < 0 or y < 0) return;
if (x >= 100 or y >= 100) return;
fb.buffer[100 * std.math.absCast(y) + std.math.absCast(x)] = c;
}
};
var canvas = painterz.Canvas(Framebuffer, Pixel, Framebuffer.setPixel).init(Framebuffer{
.buffer = …,
});
canvas.drawLine(100, 120, 110, 90, Pixel{
.r = 0xFF,
.g = 0x00,
.b = 0xFF,
.a = 0xFF,
});
관련 프로젝트 살펴보기
불러오는 중…