aboutsummaryrefslogtreecommitdiffstats
path: root/framebuffer.c
blob: 94b9b121d6001811c70c508d717b6880fd111a2a (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright (C) 2014  Tomasz Kramkowski <tk@the-tk.com>
 *
 * This program is free software. It is licensed under version 3 of the
 * GNU General Public License.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [http://www.gnu.org/licenses/].
 */

#include<stdio.h>
#include<stdlib.h>

#define SSIZE 3145728
#define INFILE "/home/main/c-stuff/fbshot"

int main( void ) {
    FILE *fbp = fopen( "/dev/fb0", "w" );
    if (!fbp) {
        puts("Failed to open /dev/fb0");
        exit(1);
    }

    FILE *infile = fopen( INFILE, "r" );
    if (!infile) {
        printf("Failed to open %s\n", INFILE);
        exit(1);
    }

    int i, ii, iii;
    for ( iii = 0; iii < 768 / 3; iii++ ) {
        for ( i = 0; i < 1024; i++ ) {
            fputc(255, fbp);
            fputc(0, fbp);
            fputc(0, fbp);
            fputc(255, fbp);
        }
        for ( i = 0; i < 1024; i++ ) {
            fputc(0, fbp);
            fputc(255, fbp);
            fputc(0, fbp);
            fputc(255, fbp);
        }
        for ( i = 0; i < 1024; i++ ) {
            fputc(0, fbp);
            fputc(0, fbp);
            fputc(255, fbp);
            fputc(255, fbp);
        }
    }

    /*
    char c;
    while((c = fgetc(infile)) != EOF)
        fputc(c, fbp);
    */
    fclose( fbp );
    fclose( infile );
}