Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PixelBuffer.h
- Revision:
- 28:b452e097da53
- Parent:
- 27:bc79f444883b
- Child:
- 29:a362df191524
--- a/PixelBuffer.h Tue Sep 06 22:12:59 2016 +0000 +++ b/PixelBuffer.h Wed Sep 07 21:07:17 2016 +0000 @@ -4,6 +4,7 @@ * Allrights reserved. * * Rev 0.97 2016-09-07 + * Rev 0.98 2016-09-08 */ #pragma once @@ -11,7 +12,12 @@ #ifndef PIXELBUFFER_H #define PIXELBUFFER_H +#ifdef _WIN32 +#include <stdint.h> +#include <string.h> +#else #include "mbed.h" +#endif #include "ColorLib.h" //---------------------------------------------------------------------------- @@ -48,19 +54,28 @@ void setPixels(int index, HSVColor *color, int len); void setPixels(RGBColor *color, int len) { setPixels(0, color, len); } void setPixels(HSVColor *color, int len) { setPixels(0, color, len); } - void fillPixels(const RGBColor color, int index, int len); - void fillPixels(const HSVColor color, int index, int len); - void fillPixels(const int color, int index, int len) { fillPixels((RGBColor)color, index, len); } - void fillPixels(const RGBColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } - void fillPixels(const HSVColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } - void fillPixels(const int color, int len = MAX_PIXELS) { fillPixels((RGBColor)color, 0, len); } + + void fillPixels(int index, const RGBColor color, int len = MAX_PIXELS); + void fillPixels(int index, const HSVColor color, int len = MAX_PIXELS); + void fillPixels(int index, const int color, int len) { fillPixels(index, (RGBColor)color, len); } + void fillPixels(const RGBColor color, int len = MAX_PIXELS) { fillPixels(0, color, len); } + void fillPixels(const HSVColor color, int len = MAX_PIXELS) { fillPixels(0, color, len); } + void fillPixels(const int color, int len = MAX_PIXELS) { fillPixels(0, (RGBColor)color, len); } + void clear(const RGBColor color) { fillPixels(color); } void clear(const HSVColor color) { fillPixels(color); } void clear(const int color = 0) { fillPixels((RGBColor)color); } + void repeatPixels(int block_size); void repeatPixels(RGBColor *source, int size); void repeatPixels(HSVColor *source, int size); + void makeGradation(int index, RGBColor from, RGBColor to, int len); + void makeGradation(RGBColor from, RGBColor to, int len = MAX_PIXELS) { makeGradation(0, from, to, len); } + + void makeRainbow(int index, HSVColor color, int len, int direction); + void makeRainbow(HSVColor color, int len = MAX_PIXELS, int direction = 1) { makeRainbow(0, color, len, direction); } + RGBColor operator[](int index) const { if ((uint16_t)index < _numPixels) @@ -115,19 +130,28 @@ void setPixels(int index, RGBColor *color, int len); void setPixels(HSVColor *color, int len) { setPixels(0, color, len); } void setPixels(RGBColor *color, int len) { setPixels(0, color, len); } + void fillPixels(const HSVColor color, int index, int len); void fillPixels(const RGBColor color, int index, int len); void fillPixels(const int color, int index, int len) { fillPixels((RGBColor)color, index, len); } void fillPixels(const HSVColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } void fillPixels(const RGBColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } void fillPixels(const int color, int len = MAX_PIXELS) { fillPixels((RGBColor)color, 0, len); } + void clear(const HSVColor color) { fillPixels(color); } void clear(const RGBColor color) { fillPixels(color); } - void clear(const int color = 0) { fillPixels((RGBColor)color); } + void clear(const int color = 0) { fillPixels((RGBColor)color); } + void repeatPixels(int block_size); void repeatPixels(HSVColor *source, int size); void repeatPixels(RGBColor *source, int size); + void makeGradation(int index, HSVColor from, HSVColor to, int len); + void makeGradation(HSVColor from, HSVColor to, int len = MAX_PIXELS) { makeGradation(0, from, to, len); } + + void makeRainbow(int index, HSVColor color, int len, int direction); + void makeRainbow(HSVColor color, int len = MAX_PIXELS, int direction = 1) { makeRainbow(0, color, len, direction); } + HSVColor operator[](int index) const { if ((uint16_t)index < _numPixels)