Drawcircle added (emulator)
This commit is contained in:
@@ -17,6 +17,7 @@ void app_init() {
|
|||||||
tft_draw_rectangle(40,210,60,235,BLUE);
|
tft_draw_rectangle(40,210,60,235,BLUE);
|
||||||
tft_fill_rectangle(100,215,200,225,GREEN);
|
tft_fill_rectangle(100,215,200,225,GREEN);
|
||||||
tft_draw_line(10,215,310,225,RGB(0xFF,0,0xFF));
|
tft_draw_line(10,215,310,225,RGB(0xFF,0,0xFF));
|
||||||
|
tft_draw_circle(10,10,100, RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ void ll_tft_draw_pixel(uint16_t x,uint16_t y,uint16_t color);
|
|||||||
void ll_tft_draw_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
void ll_tft_draw_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
||||||
void ll_tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
void ll_tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
||||||
void ll_tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *dat);
|
void ll_tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *dat);
|
||||||
|
void ll_tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color);
|
||||||
|
|||||||
@@ -33,3 +33,7 @@ void tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_
|
|||||||
void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* dat) {
|
void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* dat) {
|
||||||
ll_tft_draw_bitmap_unscaled(x,y,width,height,dat);
|
ll_tft_draw_bitmap_unscaled(x,y,width,height,dat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color) {
|
||||||
|
ll_tft_draw_circle(x, y, r, color);
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,3 +18,4 @@ void tft_draw_pixel(uint16_t x,uint16_t y,uint16_t color);
|
|||||||
void tft_draw_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
void tft_draw_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
||||||
void tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
void tft_fill_rectangle(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, uint16_t color);
|
||||||
void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* dat);
|
void tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t* dat);
|
||||||
|
void tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color);
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ void ll_tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ll_tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ extern "C" {
|
|||||||
#include "ll_tft.h"
|
#include "ll_tft.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindow* mainwindow;
|
MainWindow* mainwindow;
|
||||||
|
|
||||||
bool ll_tft_init() {
|
bool ll_tft_init() {
|
||||||
@@ -20,7 +19,6 @@ void ll_tft_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16
|
|||||||
mainwindow->draw_line(x1,y1,x2,y2,color);
|
mainwindow->draw_line(x1,y1,x2,y2,color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ll_tft_clear(uint16_t color) {
|
void ll_tft_clear(uint16_t color) {
|
||||||
mainwindow->clear(color);
|
mainwindow->clear(color);
|
||||||
}
|
}
|
||||||
@@ -41,4 +39,8 @@ void ll_tft_draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_
|
|||||||
mainwindow->draw_bitmap_unscaled(x,y,width,height,dat);
|
mainwindow->draw_bitmap_unscaled(x,y,width,height,dat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ll_tft_draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color) {
|
||||||
|
mainwindow->draw_circle(x,y,r,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,7 @@ QRgb QRgbFromRGB565(uint16_t color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), image(DISPLAY_WIDTH,DISPLAY_HEIGHT, QImage::Format_RGB16), ui(new Ui::MainWindow){
|
||||||
QMainWindow(parent),
|
|
||||||
image(DISPLAY_WIDTH,DISPLAY_HEIGHT,QImage::Format_RGB16),
|
|
||||||
ui(new Ui::MainWindow)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
image.fill(Qt::black);
|
image.fill(Qt::black);
|
||||||
}
|
}
|
||||||
@@ -99,6 +95,16 @@ void MainWindow::draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, ui
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color)
|
||||||
|
{
|
||||||
|
//render_mutex.lock();
|
||||||
|
QPainter painter(&(image));
|
||||||
|
painter.setPen(QColorFromRGB565(color));
|
||||||
|
painter.drawEllipse(QPoint(x,y), r, r);
|
||||||
|
//render_mutex.unlock();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::paintEvent(QPaintEvent *)
|
void MainWindow::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
//render_mutex.lock();
|
//render_mutex.lock();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public:
|
|||||||
void draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
|
void draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
|
||||||
void fill_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
|
void fill_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
|
||||||
void draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *dat);
|
void draw_bitmap_unscaled(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint16_t *dat);
|
||||||
|
void draw_circle(uint16_t x, uint16_t y, uint16_t r, uint16_t color);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user