66#include " PatchProcessor.h"
77#include " ServiceCall.h"
88
9- #include " font.c" // todo load as resource
10-
119PatchProcessor* getInitialisingPatchProcessor ();
1210
13- void onDrawCallback (uint8_t * pixels, uint16_t width, uint16_t height){
11+ static void onDrawCallback (uint8_t * pixels, uint16_t width, uint16_t height){
1412 ColourScreenPatch* patch = (ColourScreenPatch*)getInitialisingPatchProcessor ()->patch ;
1513 if (patch != NULL ){
1614 ColourScreenBuffer screen (width, height);
@@ -26,56 +24,36 @@ ColourScreenPatch::ColourScreenPatch(){
2624
2725ColourScreenPatch::~ColourScreenPatch (){}
2826
29- void drawMessage (ColourScreenBuffer& screen){
30- ProgramVector* pv = getProgramVector ();
31- if (pv->message != NULL ){
32- screen.setTextSize (1 );
33- screen.setTextWrap (true );
34- screen.print (0 , 26 , pv->message );
35- }
36- }
37- void drawTitle (const char * title, ColourScreenBuffer& screen){
38- // draw title
39- screen.setTextSize (2 );
40- screen.print (0 , 16 , title);
41- }
42-
43- void ColourScreenPatch::processScreen (ColourScreenBuffer& screen){
44- // screen.clear();
45- const char * title = getInitialisingPatchProcessor ()->getPatchName ();
46- drawTitle (title, screen);
47- drawMessage (screen);
48- // const char title[] = "KickBox";
49- // screen.setTextSize(2);
50- // screen.print(0, 16, title);
51- }
52-
53-
54- Colour ScreenBuffer::getPixel (unsigned int x, unsigned int y){
27+ template <>
28+ Colour ColourScreenBuffer::getPixel (unsigned int x, unsigned int y){
5529 if (x >= width || y >= height)
5630 return 0 ;
5731 return pixels[y*width+x];
5832}
5933
60- void ScreenBuffer::setPixel (unsigned int x, unsigned int y, Colour c){
34+ template <>
35+ void ColourScreenBuffer::setPixel (unsigned int x, unsigned int y, Colour c){
6136 if (x < width && y < height)
6237 pixels[y*width+x] = c;
6338}
6439
65- void ScreenBuffer::invertPixel (unsigned int x, unsigned int y){
40+ template <>
41+ void ColourScreenBuffer::invertPixel (unsigned int x, unsigned int y){
6642 if (x < width && y < height)
6743 pixels[y*width+x] ^= WHITE;
6844}
6945
70- void ScreenBuffer::fade (uint16_t steps){
46+ template <>
47+ void ColourScreenBuffer::fade (uint16_t steps){
7148 for (int i=0 ; i<height*width; ++i)
7249 pixels[i] =
7350 (((pixels[i] & RED) >> steps) & RED) |
7451 (((pixels[i] & GREEN) >> steps) & GREEN) |
7552 (((pixels[i] & BLUE) >> steps) & BLUE);
7653}
7754
78- void ScreenBuffer::fill (Colour c) {
55+ template <>
56+ void ColourScreenBuffer::fill (Colour c) {
7957 for (int i=0 ; i<height*width; ++i)
8058 pixels[i] = c;
8159}
0 commit comments