本文整理汇总了C++中Adafruit_ILI9341::fillRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ILI9341::fillRect方法的具体用法?C++ Adafruit_ILI9341::fillRect怎么用?C++ Adafruit_ILI9341::fillRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_ILI9341
的用法示例。
在下文中一共展示了Adafruit_ILI9341::fillRect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void setup(void) {
Serial.println(F("Touch Paint!"));
tft.begin();
if (!ts.begin()) {
Serial.println("Couldn't start touchscreen controller");
while (1);
}
Serial.println("Touchscreen started");
tft.fillScreen(ILI9341_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
currentcolor = ILI9341_RED;
}
示例2: draw
void Button::draw() {
if (_touching) {
tft.fillRect(_pos.x, _pos.y, _size.w, _size.h, touchColor);
} else {
tft.fillRect(_pos.x-1, _pos.y-1, _size.w, _size.h, bgColor);
// TODO: Better drop shadow
tft.drawFastVLine(_pos.x-1+_size.w, _pos.y-1, _size.h, ILI9341_BLACK);
tft.drawFastHLine(_pos.x-1, _pos.y-1+_size.h, _size.w, ILI9341_BLACK);
}
Label::draw();
}
示例3: drawLabel
void Stat::drawLabel() {
if (!_hideLabel) {
tft.setFont(&Inconsolata_g8pt7b);
tft.setCursor(_pos.x, _pos.y+1+CURSOR_Y_LARGE);
tft.setTextColor(ILI9341_WHITE);
tft.print(_labelText);
}
tft.fillRect(_value.x, _value.y, _controlWidth, 17, tft.color565(10, 10, 10));
}
示例4: print_item
/************************************
* Name : print_item
* Purpuse :
* Inputs : None
* Outputs : None
* Returns : None
************************************/
int print_item(int line, char *iname, float value, char *unit)
{
int stPos;
if (line <= 0) return -1;
stPos = (line-1)*PERIOD;
tft.fillRect(0, stPos, 240, TEXTSIZE, ILI9341_BLACK);
tft.setCursor(2, stPos);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(FONTSIZE);
tft.print(iname);
tft.print(value, 2);
tft.print(" ");
tft.print(unit);
}
示例5: drawChart
void Stat::drawChart() {
if (_redrawChart) {
_cur = 0;
tft.fillRect(_chart.x, _chart.y - 1 /* catch the top of the unit of the axis */,
_chartWidth, 32 /* to catch the bottom of the unit on the axis */,
ILI9341_BLACK);
tft.setCursor(_chart.x + 27 - ((int16_t) strlen(_labelText) * 6), _chart.y + 12+CURSOR_Y_SMALL);
tft.setTextColor(ILI9341_WHITE);
tft.setFont(&Inconsolata_g5pt7b);
tft.print(_labelText);
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y+CURSOR_Y_SMALL);
tft.print(_max == INT_MIN ? 0 : _max);
if (_unitText) {
tft.setTextColor(_chartColor);
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y + 12+CURSOR_Y_SMALL);
tft.print(_unitText);
tft.setTextColor(ILI9341_WHITE);
}
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y + 24+CURSOR_Y_SMALL);
tft.print(_min == INT_MAX ? 0 : _min);
tft.setFont(&Inconsolata_g8pt7b);
_redrawChart = false;
tft.fillRect(_chart.x + 30, _chart.y, _chartWidth - 80, 30, tft.color565(10, 10, 10));
}
for ( ; _cur < _end; _cur++) {
if (invalidReadingi(_historical[_cur])) {
tft.drawFastVLine(_chart.x+30+_cur, _chart.y, 30, ILI9341_MAROON);
continue;
}
int norm = (int) map(_historical[_cur], _min, _max, 0, 29);
int x = _chart.x+30+_cur;
int y = _chart.y+29-norm;
tft.fillRect(x, y, 1, 1, _chartColor);
}
}
示例6: testRandomRects
unsigned long testRandomRects() {
unsigned long start;
int r, g, b, t, x, y, size = 16;
float i = 0.0f;
float pi = 3.1459; // 180 degrees
start = micros();
for (i = 0.0f; i < 2 * pi; i += (pi / 360.0)) {
r = (sin(i) * 127) + 128;
g = (sin(i + ((2 * pi) / 3.0)) * 127) + 128;
b = (sin(i + ((4 * pi) / 3.0)) * 127) + 128;
y = random(320 / size);
x = random(240 / size);
tft.fillRect(x * size, y*size, size, size, tft.Color565(r, g, b));
}
return micros() - start;
}
示例7: testFilledRects
unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
unsigned long start, t = 0;
int n, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9341_BLACK);
n = min(tft.width(), tft.height());
for (i = n; i > 0; i -= 6) {
i2 = i / 2;
start = micros();
tft.fillRect(cx - i2, cy - i2, i, i, color1);
t += micros() - start;
// Outlines are not included in timing results
tft.drawRect(cx - i2, cy - i2, i, i, color2);
}
return t;
}
示例8: loop
void loop()
{
// See if there's any touch data for us
if (ts.bufferEmpty()) {
return;
}
/*
// You can also wait for a touch
if (! ts.touched()) {
return;
}
*/
// Retrieve a point
TS_Point p = ts.getPoint();
/*
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
*/
// Scale from ~0->4000 to tft.width using the calibration #'s
p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
/*
Serial.print("("); Serial.print(p.x);
Serial.print(", "); Serial.print(p.y);
Serial.println(")");
*/
if (p.y < BOXSIZE) {
oldcolor = currentcolor;
if (p.x < BOXSIZE) {
currentcolor = ILI9341_RED;
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*2) {
currentcolor = ILI9341_YELLOW;
tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*3) {
currentcolor = ILI9341_GREEN;
tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*4) {
currentcolor = ILI9341_CYAN;
tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*5) {
currentcolor = ILI9341_BLUE;
tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*6) {
currentcolor = ILI9341_MAGENTA;
tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
}
if (oldcolor != currentcolor) {
if (oldcolor == ILI9341_RED)
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
if (oldcolor == ILI9341_YELLOW)
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
if (oldcolor == ILI9341_GREEN)
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
if (oldcolor == ILI9341_CYAN)
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
if (oldcolor == ILI9341_BLUE)
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
if (oldcolor == ILI9341_MAGENTA)
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
}
}
if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
}
}