本文整理汇总了C++中LcdPanel::gradientFillRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ LcdPanel::gradientFillRectangle方法的具体用法?C++ LcdPanel::gradientFillRectangle怎么用?C++ LcdPanel::gradientFillRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LcdPanel
的用法示例。
在下文中一共展示了LcdPanel::gradientFillRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doGradientFills
void doGradientFills(Direction dir) {
Rectangle rc;
uint16_t i;
static uint32_t colours[7]={
ColourNames::RED,
ColourNames::GREEN,
ColourNames::BLUE,
ColourNames::CYAN,
ColourNames::MAGENTA,
ColourNames::YELLOW,
ColourNames::WHITE,
};
rc.Width=_gl->getXmax()+1;
rc.Height=(_gl->getYmax()+1)/2;
for(i=0;i<sizeof(colours)/sizeof(colours[0]);i++) {
rc.X=0;
rc.Y=0;
_gl->gradientFillRectangle(rc,dir,ColourNames::BLACK,colours[i]);
rc.Y=rc.Height;
_gl->gradientFillRectangle(rc,dir,colours[i],ColourNames::BLACK);
MillisecondTimer::delay(1000);
}
}
示例2: backlightTest
void backlightTest() {
prompt("Backlight test");
Rectangle rc;
uint16_t i;
static uint32_t colours[8]={
ColourNames::RED,
ColourNames::GREEN,
ColourNames::BLUE,
ColourNames::CYAN,
ColourNames::MAGENTA,
ColourNames::YELLOW,
ColourNames::WHITE,
ColourNames::BLACK,
};
// draw a row of solid colours
rc.X=0;
rc.Y=0;
rc.Height=_gl->getHeight()/2;
rc.Width=_gl->getWidth()/(sizeof(colours)/sizeof(colours[0]));
for(i=0;i<sizeof(colours)/sizeof(colours[0]);i++) {
_gl->setForeground(colours[i]);
_gl->fillRectangle(rc);
rc.X+=rc.Width;
}
// draw a greyscale
rc.X=0;
rc.Y=rc.Height;
rc.Height=rc.Height/4;
rc.Width=_gl->getWidth()/256;
for(i=0;i<256;i++) {
_gl->setForeground(i | (i << 8) | (i << 16));
_gl->fillRectangle(rc);
rc.X+=rc.Width;
}
for(i=100;i>0;i-=5) {
// set the level
_backlight->setPercentage(i);
// show the indicator
rc.X=_gl->getWidth()/4;
rc.Y=(_gl->getHeight()*6)/8;
rc.Height=_gl->getHeight()/8;
// fill
rc.Width=(_gl->getWidth()/2*i)/100;
_gl->gradientFillRectangle(rc,Direction::HORIZONTAL,0x008000,0x00ff00);
// remainder
rc.X+=rc.Width;
rc.Width=_gl->getWidth()/2-rc.Width;
_gl->setForeground(ColourNames::BLACK);
_gl->fillRectangle(rc);
// show the percentage
_gl->setForeground(ColourNames::WHITE);
*_gl << Point(0,_gl->getHeight()-_font.getHeight()) << "Backlight level: " << i << "% ";
// pause
MillisecondTimer::delay(750);
}
// restore backlight
_backlight->setPercentage(100);
}