std.image.core
Der Kern der Bildbibliothek: das GrfImage-Struct, seine Allokation, der Pixelzugriff und die Formaterkennung. Alle Format-Units (BMP, PNG, JPEG, GIF, TIFF, WebP, AVIF) dekodieren in genau dieses Layout.
Ein Bild ist immer 4 Kanäle, 8 Bit je Kanal, RGBA, zeilenweise von oben nach unten — unabhängig davon, was in der Datei stand. Ein Pixel ist ein int64 der Form 0xRRGGBBAA.
Das Struct ist 56 Byte groß; die GRF_OFF_*-Konstanten benennen die Felder (Breite, Höhe, Kanäle, Tiefe, Format, Pixelzeiger, Pixellänge). Wer ImageGetWidth aus std.image.image nicht nutzen will, liest sie mit peek64(img + GRF_OFF_WIDTH).
GrfDetectFormat erkennt das Format an den ersten Bytes — nicht an der Dateiendung.
std.image — Übersicht · Bildverarbeitung · Standard Library
Schnittstelle
| Signatur |
|---|
GrfImageAlloc(w: int64, h: int64): int64 |
GrfImageFree(img: int64): void |
GrfImageGetPixel(img: int64, x: int64, y: int64): int64 |
GrfImageSetPixel(img: int64, x: int64, y: int64, rgba: int64): void |
GrfImageClear(img: int64, rgba: int64): void |
GrfFileRead(path: int64, plen: int64, outBuf: int64, maxLen: int64): int64 |
GrfDetectFormat(buf: int64, len: int64): int64 |
| Konstante | Wert | Bedeutung |
|---|---|---|
GRF_OFF_WIDTH | 0 | – |
GRF_OFF_HEIGHT | 8 | – |
GRF_OFF_CHANNELS | 16 | – |
GRF_OFF_DEPTH | 24 | – |
GRF_OFF_FORMAT | 32 | – |
GRF_OFF_PIXELS | 40 | – |
GRF_OFF_PIXLEN | 48 | – |
GRF_SIZE | 56 | – |
GRF_FMT_UNKNOWN | 0 | – |
GRF_FMT_BMP | 1 | – |
GRF_FMT_PNG | 2 | – |
GRF_FMT_JPEG | 3 | – |
GRF_FMT_GIF | 4 | – |
GRF_FMT_TIFF | 5 | – |
…sowie 2 weitere Konstanten in der Quelldatei std/image/core.lyx.
Quelle: std/image/core.lyx · geprüft mit lyxc 1.0.21A · Stand 2026-08-12
