本文整理汇总了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);
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}