当前位置: 首页>>代码示例>>C++>>正文


C++ Adafruit_ST7735::drawLine方法代码示例

本文整理汇总了C++中Adafruit_ST7735::drawLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ST7735::drawLine方法的具体用法?C++ Adafruit_ST7735::drawLine怎么用?C++ Adafruit_ST7735::drawLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Adafruit_ST7735的用法示例。


在下文中一共展示了Adafruit_ST7735::drawLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testlines

void testlines(uint16_t color) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(0, 0, x, tft.height()-1, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(0, 0, tft.width()-1, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(tft.width()-1, 0, 0, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(0, tft.height()-1, x, 0, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
    }

    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=0; x < tft.width(); x+=6) {
        tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
    }
    for (int16_t y=0; y < tft.height(); y+=6) {
        tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
    }
}
开发者ID:ubirch,项目名称:ubirch-thgs,代码行数:33,代码来源:tft.cpp

示例2: draw_path

void draw_path(uint16_t length, coord_t path[]) {
    for (int i = 0; i < length-1; ++i) {
        //get coords
        int x1 = longitude_to_x(current_map_num, path[ i ].lon) - screen_map_x;
        int y1 = latitude_to_y( current_map_num, path[ i ].lat) - screen_map_y;
        int x2 = longitude_to_x(current_map_num, path[i+1].lon) - screen_map_x;
        int y2 = latitude_to_y( current_map_num, path[i+1].lat) - screen_map_y;

        //clipping

        //draw
        tft.drawLine(x1, y1, x2, y2, tft.Color565(255,0,0));
        }
    }
开发者ID:stravant,项目名称:CMPUT296_Assignment3,代码行数:14,代码来源:path.cpp

示例3: draw_path

// Takes in coordinates of path vertices and length and draws path on lcd screen
void draw_path(uint16_t length, coord_t path[]) {

  int32_t prev_x, prev_y, cur_x, cur_y;

  for(int i = 1; i < length ; i++){
    // grab the previous coordinates
    prev_x = longitude_to_x(current_map_num, path[i-1].lon)-screen_map_x;
    prev_y = latitude_to_y(current_map_num, path[i-1].lat)-screen_map_y;
    
    // grab the current coordinates
    cur_x = longitude_to_x(current_map_num, path[i].lon)-screen_map_x;
    cur_y = latitude_to_y(current_map_num, path[i].lat)-screen_map_y;
    // Draw the segments on the map
    tft.drawLine(prev_x, prev_y, cur_x, cur_y, BLUE);
  
  }
}
开发者ID:idaohang,项目名称:Edmonton_GPS,代码行数:18,代码来源:path.cpp

示例4: draw_path

void draw_path() {
    uint16_t x1, y1, x2, y2; //initialize vars to hold path coordinates

    int path_len = *path_lenptr; //get path length from global pointer

    //for every waypoint, draw a line from the waypoint to the next waypoint
    //until the second last waypoint is reached
    for (int i = 0; i < path_len - 1; i++) {
        x1 = longitude_to_x(current_map_num, waypointsptr[i].lon);
        x2 = longitude_to_x(current_map_num, waypointsptr[i+1].lon);
        y1 = latitude_to_y(current_map_num, waypointsptr[i].lat);
        y2 = latitude_to_y(current_map_num, waypointsptr[i+1].lat);

        //convert map coordinates to screen coordinates
        x1 = x1 - screen_map_x;
        x2 = x2 - screen_map_x;
        y1 = y1 - screen_map_y;
        y2 = y2 - screen_map_y;

        //Draw tha line
        tft.drawLine(x1,y1,x2,y2, BLUE);
    }
}
开发者ID:hammadj,项目名称:Edmonton-Navigation,代码行数:23,代码来源:map.cpp


注:本文中的Adafruit_ST7735::drawLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。