mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-19 04:45:19 +02:00
6558f56de6
- ubb-vga.h (ccube_init, ccube_map), ccube.c: color mapper based on proximity in color cube - grabfb.c (pattern, grabfb), ppmimg.c (pattern, convert): use the color cube mapper instead of inferios threshold-based mapping - ubb-vga2.c (session): initialize the color cube - ubb-vga.h (thres), grabfb.c (thres), ubb-vga2.c (usage, main): removed the threshold along with the option (-l) to set it - Makefile (OBJS): added ccube.o
42 lines
843 B
C
42 lines
843 B
C
/*
|
|
* grabfb.c - Grab the Ben's main frame buffer
|
|
*
|
|
* Written 2011 by Werner Almesberger
|
|
* Copyright 2011 Werner Almesberger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
|
|
#include <stdint.h>
|
|
#include <assert.h>
|
|
|
|
#include "ubb-vga.h"
|
|
|
|
|
|
void grabfb(void *f, int xres, int yres)
|
|
{
|
|
uint32_t *fb = map(0x01d00000, 4*320*240);
|
|
uint8_t *p = f;
|
|
int x, y;
|
|
uint32_t pix;
|
|
uint8_t r, g, b;
|
|
|
|
assert(xres == 640);
|
|
assert(yres == 480);
|
|
for (y = 0; y != 240; y++) {
|
|
for (x = 0; x != 320; x++) {
|
|
pix = *fb++;
|
|
r = pix >> 16;
|
|
g = pix >> 8;
|
|
b = pix;
|
|
p[0] = p[320] = ccube_map(r, g, b)*0x11;
|
|
p++;
|
|
}
|
|
p += 320;
|
|
}
|
|
}
|