本文整理汇总了C++中LcdPanel::fillRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ LcdPanel::fillRectangle方法的具体用法?C++ LcdPanel::fillRectangle怎么用?C++ LcdPanel::fillRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LcdPanel
的用法示例。
在下文中一共展示了LcdPanel::fillRectangle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rectTest
void rectTest() {
uint32_t i,start;
Rectangle rc;
prompt("Rectangle test");
for(i=0,start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;i++) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getYmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
_gl->setForeground(rand());
_gl->fillRectangle(rc);
}
_gl->clearScreen();
for(i=0,start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;i++) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getYmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
_gl->setForeground(rand());
_gl->drawRectangle(rc);
if(i % 1000 ==0)
_gl->clearScreen();
}
}
示例2: rectTest
void rectTest() {
Rectangle rc;
uint32_t start;
prompt("Rectangle test");
for(start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getXmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
if(rc.Width>0 && rc.Height>0) {
_gl->setForeground(rand());
_gl->fillRectangle(rc);
}
}
_gl->clearScreen();
for(start=MillisecondTimer::millis();MillisecondTimer::millis()-start<5000;) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getXmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
_gl->setForeground(rand());
_gl->drawRectangle(rc);
}
}
示例3: rectTest
void rectTest() {
int i;
Rectangle rc;
prompt("Rectangle test");
for(i=0;i<1500;i++) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getXmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
_gl->setForeground(rand());
_gl->fillRectangle(rc);
}
_gl->clearScreen();
for(i=0;i<10000;i++) {
rc.X=(rand() % _gl->getXmax()/2);
rc.Y=(rand() % _gl->getXmax()/2);
rc.Width=rand() % (_gl->getXmax()-rc.X);
rc.Height=rand() % (_gl->getYmax()-rc.Y);
_gl->setForeground(rand());
_gl->drawRectangle(rc);
if(i % 1000 ==0)
_gl->clearScreen();
}
}
示例4: run
void run() {
// reset is on PE1 and RS (D/CX) is on PE3
GpioE<DefaultDigitalOutputFeature<1>,
DefaultFsmcAlternateFunctionFeature<3> > pe;
// set up the FSMC timing. these numbers (particularly the data setup time) are dependent on
// both the FSMC bus speed and the panel timing parameters.
Fsmc8080LcdTiming fsmcTiming(2,4);
// set up the FSMC with RS=A19 (PE3)
_accessMode=new LcdAccessMode(fsmcTiming,19,pe[1]);
_gl=new LcdPanel(*_accessMode);
// apply gamma settings
ST7783Gamma gamma(0,0x0107,0,0x0203,0x0402,0,0x0207,0,0x0203,0x0403);
_gl->applyGamma(gamma);
// clear to black while the lights are out
_gl->setBackground(0);
_gl->clearScreen();
// create the backlight on timer4, channel2 (PD13)
DefaultBacklight backlight;
// fade up to 100% in 4ms steps
backlight.fadeTo(100,4);
// Create a font. A wide range of sample fonts are available. See the
// "lib/include/display/graphic/fonts" directory for a full list and
// you can always download and convert your own using the FontConv utility.
_font=new Font_VOLTER__28GOLDFISH_299;
*_gl << *_font;
_gl->setForeground(ColourNames::RED);
_gl->fillRectangle(Rectangle(10,20,30,40));
for(;;) {
jpegTest();
lzgTest();
basicColoursTest();
textTest();
ellipseTest();
gradientTest();
rectTest();
lineTest();
clearTest();
sleepTest();
}
}
示例5: run
void run() {
// reset is on PE1 and RS (D/CX) is on PD11
GpioE<DefaultDigitalOutputFeature<1> > pe;
GpioD<DefaultFsmcAlternateFunctionFeature<11> > pd;
// set up the FSMC timing. these numbers (particularly the data setup time) are dependent on
// both the FSMC bus speed and the panel timing parameters.
Fsmc8080LcdTiming fsmcTiming(0,3);
// set up the FSMC with RS=A16 (PD11)
_accessMode=new LcdAccessMode(fsmcTiming,16,pe[1]);
_gl=new LcdPanel(*_accessMode);
// clear to black while the lights are out
_gl->setBackground(0);
_gl->clearScreen();
// create the backlight on timer4, channel2 (PD13)
DefaultBacklight backlight;
// fade up to 100% in 4ms steps
backlight.fadeTo(100,4);
// create a font
_font=new Font_VOLTER__28GOLDFISH_299;
*_gl << *_font;
_gl->setForeground(ColourNames::RED);
_gl->fillRectangle(Rectangle(10,20,5,10));
for(;;) {
jpegTest();
lzgTest();
basicColoursTest();
textTest();
scrollTest();
ellipseTest();
gradientTest();
rectTest();
lineTest();
clearTest();
sleepTest();
}
}
示例6: 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);
}