⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.c

📁 嵌入式方面的一些简单程序
💻 C
字号:
#ifndef Gui_C
#define Gui_C
#include "Gui.h"
#include "Def.h"
#include "Point.h"
#include "Lcd_Test.h"
#include "Dma.h"

U16 Pen_Color;
void Set_Pixel(int x,int y)
{
    int i,j;
    if(x<Lcd_X && y<Lcd_Y)
    {
        i=x/2;
        j=x%2;
        if(j==1)
            Buffer[y][i]=((Buffer[y][i]&0x11110000)|Pen_Color);
        else
            Buffer[y][i]=((Buffer[y][i]&0x00001111)|(Pen_Color<<16));
    }
       
}

void Draw_Line_X(int x1,int x2,int y) //横向画线
{
    int x;
    if(x1>x2) return ;
    for(x=x1;x<x2;x++)
        Set_Pixel(x,y);
}

void Draw_Line_Y(int y1,int y2,int x) //纵向画线
{
    int y;
    if(y1>y2) return ;
    for(y=y1;y<y2;y++)
        Set_Pixel(x,y);
}

void Draw_Rent(Point p1,Point p2)  //  画矩形区域
{
    int x,y;
    for(y=p1.y;y<p2.y;y++)
        for(x=p1.x;x<p2.x;x++)
            Set_Pixel(x,y);
}

void Draw_Circle(Point p,int r)    //画圆形区域
{
    int x,y;
    for(x=0;x<Lcd_X;x++)
        for(y=0;y<Lcd_Y;y++)
            if((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)<=r*r)
                Set_Pixel(x,y);
}

void Clean(void)
{
    Point p1,p2;
    Pen_Color=Color_Blue;
    p1.x=p1.y=0;
    p2.x=Lcd_X;
    p2.y=Lcd_Y;
    Draw_Rent(p1,p2);
}
#endif



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -