Raw pixels: a string of RGB or RGBA bytes made into a surface in one call.
surface:pixel writes one pixel a call. raw fills the whole surface in
C: the pixels a program computes, reads from a format of its own, or takes
from a terminal's guest.
| Name | Signature |
|---|---|
| raw | raw(data, w, h, layout) -> surface, err |
raw(
data,w,h,layout) ->surface,err
Make a surface from a string of raw pixels
data holds the wxh pixels row after row, top row first, in
layout: "rgba", four bytes a pixel, or "rgb", three. It is "rgba"
when left out, so raw(s:tostring(), w, h) gives back a copy of s. An
RGB pixel gets an opaque alpha. The alpha stays straight: an RGBA pixel's
colour is taken as it stands, whatever its alpha.
The surface is wxh, and canvas:blit, gfx.sprite and gfx.sheet
take it as a source.
Nil and an error for a w or h outside 1–32767, and for a data that
is not exactly w * h pixels long, shorter or longer. Both are checked
before anything is allocated. A data that is no string, a w or h
that is no integer, and a layout that is neither raise.