File: backconv.c

package info (click to toggle)
bb 1.3rc1-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,728 kB
  • sloc: ansic: 36,697; sh: 329; makefile: 23
file content (44 lines) | stat: -rw-r--r-- 1,493 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * BB: The portable demo
 *
 * (C) 1997 by AA-group (e-mail: aa@horac.ta.jcu.cz)
 *
 * 3rd August 1997
 * version: 1.2 [final3]
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public Licences as by published
 * by the Free Software Foundation; either version 2; or (at your option)
 * any later version
 *
 * This program is distributed in the hope that it will entertaining,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Publis License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "bb.h"

/* An hack - but I did aalib, so I can hack :) */
struct parameters
{
  unsigned int p[AA_NPARAMS];
};


void backconvert(int x1, int y1, int x2, int y2)
{
    int x, y;
    for (y = y1; y < y2; y++)
	for (x = x1; x < x2; x++) {
	    int n = context->textbuffer[x + y * aa_scrwidth(context)] + 256 * context->attrbuffer[x + y * aa_scrwidth(context)];
	    aa_putpixel(context, x * 2, y * 2, context->parameters[n].p[1]);
	    aa_putpixel(context, x * 2 + 1, y * 2, context->parameters[n].p[0]);
	    aa_putpixel(context, x * 2, y * 2 + 1, context->parameters[n].p[3]);
	    aa_putpixel(context, x * 2 + 1, y * 2 + 1, context->parameters[n].p[2]);
	}
}