PicoVGA  1.0-cmake
VGA/TV display on Raspberry Pico
vga_screen.h
Go to the documentation of this file.
1 
8 #ifndef _VGA_SCREEN_H
9 #define _VGA_SCREEN_H
10 
24 typedef struct {
26  u16 width;
27  u16 wb;
28  s16 offx;
29  s16 offy;
30  u16 wrapx;
31  u16 wrapy;
33  const void* data;
34  u8 form;
35  bool dbly;
36  u16 par3;
37  u32 par;
38  u32 par2;
39 } sSegm;
40 
42 typedef struct {
43  u16 height;
44  u16 num;
45  sSegm seg[SEGMAX];
46 } sStrip;
47 
49 typedef struct {
50  u16 num;
51  u16 backup;
52  sStrip strip[STRIPMAX];
53 } sScreen;
54 
55 extern sScreen Screen;
56 extern sScreen* pScreen;
57 
66 void ScreenClear(sScreen* s);
67 
77 sStrip* ScreenAddStrip(sScreen* s, int height);
78 
87 sSegm* ScreenAddSegm(sStrip* strip, int width);
88 
95 void ScreenSegmColor(sSegm* segm, u32 col1, u32 col2);
96 
105 void ScreenSegmGrad1(sSegm* segm, const void* data, int wb);
106 
115 void ScreenSegmGrad2(sSegm* segm, const void* data, int wb);
116 
127 void ScreenSegmGraph8(sSegm* segm, const void* data, int wb);
128 
138 void GenPal16Trans(u16* trans, const u8* pal);
139 
150 void ScreenSegmGraph4(sSegm* segm, const void* data, const void* trans, int wb);
151 
161 void GenPal4Trans(u32* trans, const u8* pal);
162 
172 void ScreenSegmGraph2(sSegm* segm, const void* data, const void* trans, int wb);
173 
185 void ScreenSegmGraph1(sSegm* segm, const void* data, u8 bg, u8 fg, int wb);
186 
199 void ScreenSegmMText(sSegm* segm, const void* data, const void* font, u16 fontheight, u8 bg, u8 fg, int wb);
200 
214 void ScreenSegmAText(sSegm* segm, const void* data, const void* font, u16 fontheight, const void* pal, int wb);
215 
230 void ScreenSegmFText(sSegm* segm, const void* data, const void* font, u16 fontheight, u8 bg, int wb);
231 
242 void ScreenSegmCText(sSegm* segm, const void* data, const void* font, u16 fontheight, int wb);
243 
258 void ScreenSegmGText(sSegm* segm, const void* data, const void* font, u8 fontheight, u8 bg, const void* grad, int wb);
259 
275 void ScreenSegmDText(sSegm* segm, const void* data, const void* font, u8 fontheight, u8 bg, const void* grad, int wb);
276 
293 void ScreenSegmTile(sSegm* segm, const void* data, const void* tiles, int w, int h, int wb);
294 
309 void ScreenSegmTile2(sSegm* segm, const void* data, const void* tiles, int w, int h, int tilewb, int wb);
310 
326 void ScreenSegmLevel(sSegm* segm, const void* data, u8 zero, u8 bg, u8 fg);
327 
339 void ScreenSegmLevelGrad(sSegm* segm, const void* data, const void* sample1, const void* sample2);
340 
352 void ScreenSegmOscil(sSegm* segm, const void* data, u8 bg, u8 fg, int pixh);
353 
364 void ScreenSegmOscLine(sSegm* segm, const void* data, u8 bg, u8 fg);
365 
377 void GenPal4Plane(u32* trans, const u8* pal);
378 
394 void ScreenSegmPlane2(sSegm* segm, const void* data, int plane, const void* trans, int wb);
395 
417 void ScreenSegmAttrib8(sSegm* segm, const void* data, const void* attr, const u8* pal, int wb);
418 
430 void ScreenSegmProgress(sSegm* segm, const void* data, const void* sample1, const void* sample2);
431 
447 void ScreenSegmGraph8Mat(sSegm* segm, const void* data, const int* mat, u16 xbits, u16 ybits);
448 
459 void ScreenSegmGraph8Persp(sSegm* segm, const void* data, const int* mat, u16 xbits, u16 ybits, u16 horiz);
460 
482 void ScreenSegmTilePersp(sSegm* segm, const u8* map, const u8* tiles, const int* mat,
483  u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon);
484 
499 void ScreenSegmTilePersp15(sSegm* segm, const u8* map, const u8* tiles, const int* mat,
500  u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon);
501 
516 void ScreenSegmTilePersp2(sSegm* segm, const u8* map, const u8* tiles, const int* mat,
517  u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon);
518 
533 void ScreenSegmTilePersp3(sSegm* segm, const u8* map, const u8* tiles, const int* mat,
534  u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon);
535 
550 void ScreenSegmTilePersp4(sSegm* segm, const u8* map, const u8* tiles, const int* mat,
551  u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon);
552 
554 
555 #endif // _VGA_SCREEN_H
sSegm::dbly
bool dbly
SSEGM_DBLY double Y (2 scanlines per 1 image line)
Definition: vga_screen.h:35
sScreen::backup
u16 backup
SSCREEN_BACKUP backup number of video strips during display OFF.
Definition: vga_screen.h:51
ScreenSegmTile
void ScreenSegmTile(sSegm *segm, const void *data, const void *tiles, int w, int h, int wb)
Set video segment to tiles.
Definition: vga_screen.cpp:339
sSegm::wb
u16 wb
SSEGM_WB pitch - number of bytes between lines.
Definition: vga_screen.h:27
sSegm::par2
u32 par2
SSEGM_PAR2 parameter 2.
Definition: vga_screen.h:38
ScreenSegmTilePersp15
void ScreenSegmTilePersp15(sSegm *segm, const u8 *map, const u8 *tiles, const int *mat, u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon)
Set video segment to tiles with perspective, 1.5 pixels.
Definition: vga_screen.cpp:612
ScreenSegmGraph8Mat
void ScreenSegmGraph8Mat(sSegm *segm, const void *data, const int *mat, u16 xbits, u16 ybits)
Set video segment to 8-bit graphics with 2D matrix transformation.
Definition: vga_screen.cpp:536
ScreenSegmOscil
void ScreenSegmOscil(sSegm *segm, const void *data, u8 bg, u8 fg, int pixh)
Set video segment to oscilloscope 1-pixel graph GF_OSCIL.
Definition: vga_screen.cpp:416
ScreenSegmGraph8Persp
void ScreenSegmGraph8Persp(sSegm *segm, const void *data, const int *mat, u16 xbits, u16 ybits, u16 horiz)
Set video segment to 8-bit graphics with perspective projection.
Definition: vga_screen.cpp:559
ScreenSegmProgress
void ScreenSegmProgress(sSegm *segm, const void *data, const void *sample1, const void *sample2)
Set video segment to horizontal progress indicator GF_PROGRESS.
Definition: vga_screen.cpp:518
sStrip::num
u16 num
SSTRIP_NUM number of video segments.
Definition: vga_screen.h:44
sScreen::num
u16 num
SSCREEN_NUM number of video strips.
Definition: vga_screen.h:50
ScreenSegmLevel
void ScreenSegmLevel(sSegm *segm, const void *data, u8 zero, u8 bg, u8 fg)
Set video segment to level graph GF_LEVEL.
Definition: vga_screen.cpp:383
ScreenSegmColor
void ScreenSegmColor(sSegm *segm, u32 col1, u32 col2)
Set video segment to simple color format GF_COLOR.
Definition: vga_screen.cpp:62
ScreenSegmTilePersp
void ScreenSegmTilePersp(sSegm *segm, const u8 *map, const u8 *tiles, const int *mat, u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon)
Set video segment to tiles with perspective.
Definition: vga_screen.cpp:585
sStrip::height
u16 height
SSTRIP_HEIGHT height of this strip in number of scanlines.
Definition: vga_screen.h:43
ScreenSegmGraph1
void ScreenSegmGraph1(sSegm *segm, const void *data, u8 bg, u8 fg, int wb)
Set video segment to 1-bit palette graphics.
Definition: vga_screen.cpp:200
sSegm::width
u16 width
SSEGM_WIDTH width of this video segment in pixels (must be multiple of 4, 0=inactive segment)
Definition: vga_screen.h:26
ScreenSegmAText
void ScreenSegmAText(sSegm *segm, const void *data, const void *font, u16 fontheight, const void *pal, int wb)
Set video segment to 8-pixel attribute text.
Definition: vga_screen.cpp:239
ScreenSegmFText
void ScreenSegmFText(sSegm *segm, const void *data, const void *font, u16 fontheight, u8 bg, int wb)
Set video segment to 8-pixel foreground color text.
Definition: vga_screen.cpp:259
ScreenSegmGrad1
void ScreenSegmGrad1(sSegm *segm, const void *data, int wb)
Set video segment to gradient with 1 line.
Definition: vga_screen.cpp:75
sSegm::offx
s16 offx
SSEGM_OFFX display offset at X direction (must be multiple of 4)
Definition: vga_screen.h:28
ScreenSegmCText
void ScreenSegmCText(sSegm *segm, const void *data, const void *font, u16 fontheight, int wb)
Set video segment to 8-pixel color text.
Definition: vga_screen.cpp:278
ScreenSegmMText
void ScreenSegmMText(sSegm *segm, const void *data, const void *font, u16 fontheight, u8 bg, u8 fg, int wb)
Set video segment to 8-pixel mono text.
Definition: vga_screen.cpp:219
sSegm
Video segment (on change update SSEGM_* in define.h)
Definition: vga_screen.h:25
sSegm::offy
s16 offy
SSEGM_OFFY display offset at Y direction.
Definition: vga_screen.h:29
ScreenSegmGrad2
void ScreenSegmGrad2(sSegm *segm, const void *data, int wb)
Set video segment to gradient with 2 lines.
Definition: vga_screen.cpp:90
ScreenSegmDText
void ScreenSegmDText(sSegm *segm, const void *data, const void *font, u8 fontheight, u8 bg, const void *grad, int wb)
Set video segment to 8-pixel double gradient color text.
Definition: vga_screen.cpp:319
sScreen
Video screen (on change update SSCREEN_* in define.h)
Definition: vga_screen.h:49
ScreenSegmOscLine
void ScreenSegmOscLine(sSegm *segm, const void *data, u8 bg, u8 fg)
Set video segment to oscilloscope line graph GF_OSCLIN.
Definition: vga_screen.cpp:432
ScreenAddStrip
sStrip * ScreenAddStrip(sScreen *s, int height)
Add empty strip to the screen.
Definition: vga_screen.cpp:25
pScreen
sScreen * pScreen
Pointer to current video screen.
Definition: vga_screen.cpp:14
GenPal16Trans
void GenPal16Trans(u16 *trans, const u8 *pal)
Generate 16-color palette translation table.
Definition: vga_screen.cpp:119
ScreenSegmTilePersp4
void ScreenSegmTilePersp4(sSegm *segm, const u8 *map, const u8 *tiles, const int *mat, u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon)
Set video segment to tiles with perspective, quadruple pixels.
Definition: vga_screen.cpp:693
GenPal4Trans
void GenPal4Trans(u32 *trans, const u8 *pal)
Generate palette 4 translation table for function.
Definition: vga_screen.cpp:155
ScreenSegmLevelGrad
void ScreenSegmLevelGrad(sSegm *segm, const void *data, const void *sample1, const void *sample2)
Set video segment to leve gradient graph GF_LEVELGRAD.
Definition: vga_screen.cpp:399
ScreenSegmTile2
void ScreenSegmTile2(sSegm *segm, const void *data, const void *tiles, int w, int h, int tilewb, int wb)
Set video segment to alternate tiles.
Definition: vga_screen.cpp:362
ScreenSegmGraph4
void ScreenSegmGraph4(sSegm *segm, const void *data, const void *trans, int wb)
Set video segment to 4-bit palette graphics.
Definition: vga_screen.cpp:140
GenPal4Plane
void GenPal4Plane(u32 *trans, const u8 *pal)
Generate palette 4-color translation table for function ScreenSegmPlane2()
Definition: vga_screen.cpp:446
sSegm::data
const void * data
SSEGM_DATA pointer to video buffer with image data.
Definition: vga_screen.h:33
ScreenSegmGText
void ScreenSegmGText(sSegm *segm, const void *data, const void *font, u8 fontheight, u8 bg, const void *grad, int wb)
Set video segment to 8-pixel gradient color text.
Definition: vga_screen.cpp:298
ScreenSegmGraph8
void ScreenSegmGraph8(sSegm *segm, const void *data, int wb)
Set video segment to native 8-bit graphics (R3G3B2)
Definition: vga_screen.cpp:105
sSegm::form
u8 form
SSEGM_FORM graphics format GF_*.
Definition: vga_screen.h:34
sSegm::par
u32 par
SSEGM_PAR parameter 1.
Definition: vga_screen.h:37
ScreenSegmAttrib8
void ScreenSegmAttrib8(sSegm *segm, const void *data, const void *attr, const u8 *pal, int wb)
Set video segment to 2x4 bit color attribute per 8x8 pixel sample graphics.
Definition: vga_screen.cpp:501
ScreenSegmTilePersp2
void ScreenSegmTilePersp2(sSegm *segm, const u8 *map, const u8 *tiles, const int *mat, u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon)
Set video segment to tiles with perspective, double pixels.
Definition: vga_screen.cpp:639
ScreenSegmGraph2
void ScreenSegmGraph2(sSegm *segm, const void *data, const void *trans, int wb)
Set video segment to 2-bit palette graphics.
Definition: vga_screen.cpp:182
sSegm::wrapx
u16 wrapx
Definition: vga_screen.h:30
ScreenAddSegm
sSegm * ScreenAddSegm(sStrip *strip, int width)
Add empty segment to video strip; returns pointer to the segment and initialises it to defaults.
Definition: vga_screen.cpp:38
ScreenSegmPlane2
void ScreenSegmPlane2(sSegm *segm, const void *data, int plane, const void *trans, int wb)
Set video segment to 4-color on 2-planes graphics.
Definition: vga_screen.cpp:482
ScreenClear
void ScreenClear(sScreen *s)
Clear screen (set 0 strips, does not modify sprites)
Definition: vga_screen.cpp:17
sStrip
Video strip (on change update SSTRIP_* in define.h)
Definition: vga_screen.h:42
sSegm::par3
u16 par3
SSEGM_PAR3 parameter 3.
Definition: vga_screen.h:36
Screen
sScreen Screen
Default video screen.
Definition: vga_screen.cpp:13
ScreenSegmTilePersp3
void ScreenSegmTilePersp3(sSegm *segm, const u8 *map, const u8 *tiles, const int *mat, u8 mapwbits, u8 maphbits, u8 tilebits, s8 horizon)
Set video segment to tiles with perspective, triple pixels.
Definition: vga_screen.cpp:666