How to get a picture that fits your screen size?

Publisher:和谐相伴Latest update time:2015-09-21 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
How to get a picture that fits your screen size? I wasted a lot of time when I was using TFT to display pictures. Now I summarize the usage based on my experience as follows for your reference in learning TFT.

In the arm development board you are learning, I use fm3 (Fujitsu mb9b series). If the example shows a picture, use for(i=0;i

{

 Write_data(tupian[i];)

}

We all know that colors are defined in double bytes, for example, 0x0000 represents black;

If your routine is not write_data(high, low); (I remember that the stm32 series is written like this). Then the i above is required to be represented by a double-byte array such as 0xxxxx. There is no need to change the bus and shift the array. I think if the routine is not written by you, don't change it back and forth. It's unnecessary.

Let's take a look at my routine first, as follows

#define black 0x0000  

#define blue 0x001F  

#define green 0x07E0  

#define cyan 0x07FF  

#define red 0xF800  

#define yellow 0xFFE0  

#define white 0xFFFF  

                        

#define LCD_WIDTH 240

#define LCD_HEIGHT 320

*************************************************** ************************

void DrawPicture(uint xs,uint xe,uint ys,uint ye)

{

  unsigned long int i;

 

 

  SetWindow(xs, xe, ys, ye);

  SetWindow_xy(xs,ys);

 write_command(0x0022);

  for (i=0;i<(xe*ye);i++)

  {

    

      write_data(qq[i]);

    

         // ili9320_Delay(50);

     

  }

  //Set_Cs;

}

void write_command(uint16_t cmd)

{   

 

    LCD_RS = 0;

    *(LCD_BASE) = cmd;

 

}

 

//------------------------LCD write data -------------------- -----

void write_data(uint16_t data)

{

    LCD_RS = 1;

    __no_operation();

    __no_operation();

    //*(LCD_BASE) =(uint8_t)data;

      //*(LCD_BASE) =(uint8_t)data<<8;

   *(LCD_BASE) =data;

 

  

}

int32_t main(void)

{

  

 

    FM3_GPIO->PFR4 = 0x0000; // Poart4 for gpio

    FM3_GPIO->PDOR4 = 0x003C; // P42-P45 output 1

    FM3_GPIO->DDR4 = 0x003C; // P42-P45: LED1-LED4, output;

                                // P40,P41,P48:key2,key3,key4, input

    FM3_GPIO->PFR7 = 0x0000; // Poart7 for gpio

    FM3_GPIO->DDR7 = 0x0008; // P73, output;

 

    FM3_GPIO->PFR6 = 0x0000; // Poart6 for gpio

    FM3_GPIO->DDR6 = 0x0024; // P64:key1, input; P65 LCD back light, output

                                // P62, LCD RS select, output

   

 

    init_extbus(); // Initialize the external bus

    delay(10);

 

    LCD_BKLIGHT = 1;

    delay(5);

  

 

    TM280_HX8347G_Initial_code(); //Initialize LCD screen, clear to white

    delay(10); 

    clr_lcd();

   

  DrawPicture(0,239,0,319); //Start and end of x-axis: start and end of y-axis

As mentioned above, according to my routine, the problem arises when displaying the picture on the screen. If you use image2lcd directly, I regret to tell you that the picture array it generates is a single byte (0xxx), so it is impossible to display it on the screen. If you have a picture, but you find that when you use bmp2rgb software to convert it, the array is empty after the conversion, do you start to doubt that the software is really bad? Try it again and the result is still the same. If you specifically find a 24-bit bitmap (bmp) picture, you use bmp2rgb to convert it and find that it is successful, and it is all double-byte arrays, then start to study why?

Actually, in my opinion, the bmp2rgb software can only convert 24-bit BMP format arrays and is single-byte. If we need double-byte, but only have a 16-bit image (open it with bmp2rg). Well, if you have both software, first open this 16-bit image with image2lcd as shown in the figure

Then convert it into a 24-bit bmp format image, and then open the generated image with bmp2rgb software

Set the width and height to the screen size in pixels, click convert, and you're done!

Reference address:How to get a picture that fits your screen size?

Previous article:How to get a picture that fits your screen size?
Next article:Analysis of Stm32 matrix keyboard scanning program

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号