本文整理汇总了C++中LcdPanel::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ LcdPanel::getWidth方法的具体用法?C++ LcdPanel::getWidth怎么用?C++ LcdPanel::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LcdPanel
的用法示例。
在下文中一共展示了LcdPanel::getWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCompressedBitmap
void drawCompressedBitmap(uint8_t *pixels,uint32_t size,uint16_t width,uint16_t height,bool useDma,DmaFsmcLcdMemoryCopyFeature<LcdAccessMode>& dma) {
_gl->setBackground(ColourNames::WHITE);
_gl->clearScreen();
LinearBufferInputOutputStream compressedData(pixels,size);
LzgDecompressionStream decompressor(compressedData,size);
if(useDma) {
_gl->drawBitmap(
Rectangle((_gl->getWidth()-width)/2,
(_gl->getHeight()-height)/2,
width,height),
decompressor,
dma);
}
else {
_gl->drawBitmap(
Rectangle((_gl->getWidth()-width)/2,
(_gl->getHeight()-height)/2,
width,height),
decompressor);
}
MillisecondTimer::delay(3000);
}
示例2: jpegTest
void jpegTest() {
// only draw in portrait mode and if it can fit on screen
if(_gl->getHeight()>_gl->getWidth() && _gl->getHeight()>=320 && _gl->getWidth()>=240) {
prompt("JPEG bitmap test");
// draw it centered
LinearBufferInputOutputStream compressedData((uint8_t *)&JpegTest0Pixels,(uint32_t)&JpegTest0PixelsSize);
_gl->drawJpeg(Rectangle((_gl->getWidth()-240)/2,(_gl->getHeight()-320)/2,240,320),compressedData);
MillisecondTimer::delay(3000);
}
}
示例3: onError
void onError(NetEventDescriptor& ned) {
NetworkErrorEvent& errorEvent(static_cast<NetworkErrorEvent&>(ned));
std::string str("Network error: ");
char buf[20];
StringUtil::modp_uitoa10(errorEvent.provider,buf);
strcat(buf,"/");
str+=buf;
StringUtil::modp_uitoa10(errorEvent.code,buf);
strcat(buf,"/");
str+=buf;
StringUtil::modp_uitoa10(errorEvent.cause,buf);
str+=buf;
_tft->setBackground(ColourNames::BLACK);
_tft->setForeground(ColourNames::WHITE);
_tft->clearRectangle(
Rectangle(0,
_tft->getHeight()-_font->getHeight(),
_tft->getWidth(),
_font->getHeight()));
*_tft << Point(0,_tft->getHeight()-_font->getHeight()) << str.c_str();
}
示例4: jpegTest
void jpegTest() {
prompt("JPEG bitmap test");
// draw it centered
LinearBufferInputOutputStream compressedData((uint8_t *)&JpegTest0Pixels,(uint32_t)&JpegTest0PixelsSize);
_gl->drawJpeg(Rectangle((_gl->getWidth()-240)/2,(_gl->getHeight()-320)/2,240,320),compressedData);
MillisecondTimer::delay(3000);
}
示例5: jpegTest
void jpegTest() {
if(_gl->getHeight()==320 && _gl->getWidth()==240) {
prompt("JPEG bitmap test");
LinearBufferInputOutputStream compressedData((uint8_t *)&JpegTest0Pixels,(uint32_t)&JpegTest0PixelsSize);
_gl->drawJpeg(Rectangle(0,0,240,320),compressedData);
MillisecondTimer::delay(3000);
}
}
示例6: drawCompressedBitmap
void drawCompressedBitmap(uint8_t *pixels,uint32_t size,uint16_t width,uint16_t height) {
_gl->setBackground(ColourNames::WHITE);
_gl->clearScreen();
LinearBufferInputOutputStream compressedData(pixels,size);
LzgDecompressionStream decompressor(compressedData,size);
_gl->drawBitmap(
Rectangle((_gl->getWidth()-width)/2,
(_gl->getHeight()-height)/2,
width,height),
decompressor);
MillisecondTimer::delay(3000);
}
示例7: 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);
}
示例8: showPicture
void showPicture(const std::string& uri) {
// fade down the backlight to 10%, 4ms per step
_backlight->fadeTo(10,4);
// clear the screen
_tft->setBackground(ColourNames::BLACK);
_tft->clearScreen();
// we're using a custom TCP client connection that processes incoming data on the receive IRQ
// so that we avoid advertising a zero receive window back to the server with the performance
// hit that we would take
MyTcpClientConnection *conn;
if(!_net->tcpConnect<MyTcpClientConnection>(_serverAddress,WEB_SERVER_PORT,conn))
error("Failed to connect to web server");
// manage the connection pointer in a scoped_ptr so it's automatically deleted (and closed)
// when it goes out of scope
HttpClient httpClient(*conn);
// set the parameters for the HTTP GET
httpClient.setUri(uri);
httpClient.setHost(WEB_SERVER);
httpClient.setVersion(HttpVersion::HTTP_1_0); // connection to close after we get the image
if(!httpClient.sendRequest()) {
delete conn;
error("Failed to send the request to the server");
}
// use a read-ahead input stream wrapped around a TCP input stream
// with a read-ahead buffer of 256 bytes
TcpInputStream tcis(*conn);
// if the JPEG will fit then display it centered on screen, otherwise ignore it
Size size;
JpegDecoder<LcdPanel> jpeg;
if(!jpeg.beginDecode(tcis,size)) {
delete conn;
error("Failed to decode JPEG image");
}
if(size.Height<=_tft->getHeight() && size.Width<=_tft->getWidth()) {
// it fits, stream it in
Point pt;
pt.X=(_tft->getWidth()-size.Width)/2;
pt.Y=(_tft->getHeight()-size.Height)/2;
jpeg.endDecode(pt,*_tft);
}
delete conn;
// fade up the backklight to 100%, 4ms per step
_backlight->fadeTo(100,4);
}