summaryrefslogtreecommitdiff
path: root/fbops.h
blob: 3c24ebde50bd6024d5b754cd8744895455e58beb (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
60
61
62
63
64

/*
 * secde -- experimental lightweight Wayland/X11 server
 * Copyright (C) 2019  Samuel Lidén Borell
 *
 * 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef FBOPS_H
#define FBOPS_H

struct FbPixelFormat {
    short bytes_per_pixel;
    /* TODO planar formats etc. */
};

struct FbSurf {
    short w, h, line_length;
    unsigned char *pixels;
};

struct FbDestSurf {
    struct FbSurf *surf;
    const struct FbPixelFormat *format;
};

struct FbRect {
    short x, y, w, h;
};

typedef unsigned FbColor;

int fbops_cliprect(struct FbRect *rect,
                   const struct FbRect *clip);
int fbops_cliprect1(struct FbRect *destrect,
                    struct FbRect *srcrect,
                    const struct FbRect *destclip);

void fbops_fillrect(struct FbDestSurf *destsurf,
                    const struct FbRect *rect,
                    const FbColor color);
void fbops_copysurf(struct FbDestSurf *destsurf,
                    short x, short y,
                    const struct FbSurf *srcsurf);
void fbops_copysurf1(struct FbDestSurf *destsurf,
                     short x, short y,
                     const struct FbSurf *srcsurf,
                     const struct FbRect *srcrect);

void fbops_moverect(struct FbDestSurf *destsurf,
                    short destx, short desty,
                    const struct FbRect *srcrect);

#endif