diff --git a/pipi/stock.c b/pipi/stock.c index 2ae4863..a25ebe2 100644 --- a/pipi/stock.c +++ b/pipi/stock.c @@ -77,7 +77,7 @@ pipi_image_t *pipi_load_stock(char const *name) if(!strncmp(name, "random", 6)) { unsigned int ctx = 1; - int x, y, w, h; + int x, y, t, w, h; w = atoi(name + 6); name = strchr(name + 6, 'x'); @@ -88,21 +88,26 @@ pipi_image_t *pipi_load_stock(char const *name) return NULL; ret = pipi_new(w, h); - pix = pipi_getpixels(ret, PIPI_PIXELS_Y_F); + pix = pipi_getpixels(ret, PIPI_PIXELS_RGBA_F); data = (float *)pix->pixels; for(y = 0; y < h; y++) for(x = 0; x < w; x++) { - long hi, lo; + for(t = 0; t < 3; t++) + { + long hi, lo; - hi = ctx / 12773L; - lo = ctx % 12773L; - ctx = 16807L * lo - 2836L * hi; - if(ctx <= 0) - ctx += 0x7fffffffL; + hi = ctx / 12773L; + lo = ctx % 12773L; + ctx = 16807L * lo - 2836L * hi; + if(ctx <= 0) + ctx += 0x7fffffffL; - data[y * w + x] = (double)((ctx % 65536) / 65535.); + data[4 * (y * w + x) + t] + = (double)((ctx % 65536) / 65535.); + } + data[4 * (y * w + x) + 3] = 1.0; } return ret;