Learn R Programming

wal (version 0.1.0)

plotwal.rawdata: Plot raw pixel index data as image.

Description

Plot raw pixel index data as image.

Usage

plotwal.rawdata(raw_data, width, height, apply_palette = wal::pal_q2())

Arguments

raw_data

integer vector in containing width * height values in range 0..255, and optionally additional mipmap data at the end (which will be ignored). The raw image data. Can be a Q2 WAL data, Q1 miptex data, or anything else.

width

positive integer, the image width.

height

positive integer, the image height.

apply_palette

optional 256 x 3 integer matrix, the palette. Must contain values in range 0..255. Pass NULL if you do not want to apply any palette. The resulting wal object will not have an 'image' entry then.

Examples

Run this code
if (FALSE) {
# Plot the Q1 shambler skin:
mdl = read.quake.mdl("~/data/q1_pak/progs/shambler.mdl");
plotwal.rawdata(mdl$skins$skin_pic, mdl$header$skin_width,
 mdl$header$skin_height, apply_palette = pal_q1());
}

Run the code above in your browser using DataLab