forked from raspberrypi/pico-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprite.h
53 lines (42 loc) · 1.9 KB
/
sprite.h
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
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _SPRITE_H
#define _SPRITE_H
#include "pico.h"
#include "affine_transform.h"
typedef struct sprite {
int16_t x;
int16_t y;
const void *img;
uint8_t log_size; // always square
bool has_opacity_metadata;
} sprite_t;
// ----------------------------------------------------------------------------
// Functions from sprite.S
// Constant-colour span
void sprite_fill8(uint8_t *dst, uint8_t colour, uint len);
void sprite_fill16(uint16_t *dst, uint16_t colour, uint len);
// Block image transfers
void sprite_blit8(uint8_t *dst, const uint8_t *src, uint len);
void sprite_blit8_alpha(uint8_t *dst, const uint8_t *src, uint len);
void sprite_blit16(uint16_t *dst, const uint16_t *src, uint len);
void sprite_blit16_alpha(uint16_t *dst, const uint16_t *src, uint len);
// These are just inner loops, and require INTERP0 to be configured before calling:
void sprite_ablit8_loop(uint8_t *dst, uint len);
void sprite_ablit8_alpha_loop(uint8_t *dst, uint len);
void sprite_ablit16_loop(uint16_t *dst, uint len);
void sprite_ablit16_alpha_loop(uint16_t *dst, uint len);
// ----------------------------------------------------------------------------
// Functions from sprite.c
// Render the intersection of a sprite with the current scanline:
void sprite_sprite8(uint8_t *scanbuf, const sprite_t *sp, uint raster_y, uint raster_w);
void sprite_sprite16(uint16_t *scanbuf, const sprite_t *sp, uint raster_y, uint raster_w);
// As above, but apply an affine transform on sprite texture lookups (SLOW, even with interpolator)
void sprite_asprite8(uint8_t *scanbuf, const sprite_t *sp, const affine_transform_t atrans, uint raster_y,
uint raster_w);
void sprite_asprite16(uint16_t *scanbuf, const sprite_t *sp, const affine_transform_t atrans, uint raster_y,
uint raster_w);
#endif