Display screen image drawing method and device, storage medium and image display equipment
By selecting appropriate preset drawing processes and processing methods according to image types, the problem of poor transparency and color mixing in TFT-LCD image drawing is solved, achieving more natural color transitions and image fineness, and providing diverse display effects. .
Patent Information
- Application Number
- CN202410548997.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-09-20
AI Technical Summary
Existing TFT-LCD image drawing methods are not effective in transparency processing and color mixing, resulting in abrupt and unnatural color transitions and affecting the delicacy and realism of the image.
Provide a display screen image drawing method that selects a suitable preset drawing process according to the image type, including preset processes for non-transparent images, transparent images, dynamic images, and multi-region images. By acquiring image data, analyzing pixel positions, and calculating graphics Display the buffer address and perform image drawing, combining transparency and color information processing to optimize the image drawing process.
It achieves a more natural color transition, improves the delicacy and realism of images, provides a diverse selection of image drawing methods, and adapts to the display effects of different image types.
Smart Images

Figure CN118674833A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of control, and in particular to a display screen image drawing method, device, storage medium and image display equipment. Background Art
[0002] Compared with traditional digital tube display and black and white image display, color screen display can present richer and more vivid visual effects. As one of the representatives of color screen display technology, TFT-LCD is widely used in embedded fields such as home appliances and car dashboards due to its advantages such as high response speed, high contrast and high brightness. However, due to the poor processing effect of existing TFT-LCD image drawing methods in terms of transparency processing and color mixing, the color transition is stiff and unnatural, affecting the delicacy and realism of the image. Summary of the invention
[0003] The main purpose of the present invention is to overcome the defects of the above-mentioned related technologies and to provide a display screen image method, device, storage medium and image display device to solve the problem that the image drawing of the display screen in the related technology is not good in transparency processing and / or color mixing, resulting in abrupt and unnatural color transitions, affecting the delicacy and realism of the image.
[0004] On one hand, the present invention provides a method for drawing an image on a display screen, comprising: acquiring image data of an image to be drawn; determining a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn; wherein different image types correspond to different preset drawing processes; and drawing the image to be drawn according to the determined preset drawing process based on the acquired image data of the image to be drawn.
[0005] Optionally, the method further includes: performing a preset process on the original data of the image to be drawn in advance to obtain processed image data of the image to be drawn, and storing the processed image data of the image to be drawn in a preset format.
[0006] Optionally, it also includes: communicating with the display screen through an IO port simulating an SPI communication protocol, sending a screen parameter configuration instruction to the display screen to configure the screen parameters of the display screen, and / or sending a color correction instruction to the display screen to correct the color parameters of the display screen.
[0007] Optionally, the image type includes: at least one of: a non-transparent image, a transparent image, a dynamic image and a multi-region image; the preset drawing process includes: at least one of: a preset drawing process for a non-transparent image, a preset drawing process for a transparent image, a preset drawing process for a dynamic image and a preset drawing process for a multi-region image; the preset drawing process for a non-transparent image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn; obtaining the position of each pixel in the image to be drawn according to the position of the current pixel in the image to be drawn, and combining the relative position of the image to be drawn in the display screen and the number of pixels occupied by each row of pixels; The number of nodes is used to calculate the address of the current pixel in the graphics display buffer; according to the resolved width and height of the image to be drawn and the calculated address of each pixel of the image to be drawn in the graphics display buffer, the image drawing of the image to be drawn is performed; and / or, the preset drawing process of the transparent image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; looping through each pixel of the image to be drawn to obtain the position of each pixel in the image to be drawn; according to the position of the current pixel in the image to be drawn, combined with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels, calculating the address of the current pixel in the graphics display buffer the address in the graphics display buffer; according to the resolved width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and the transparency of the pixel, the image drawing of the image to be drawn is performed; wherein, it is determined whether the transparency of the current pixel is greater than a set threshold value, and if it is determined that the transparency of the current pixel is greater than the set threshold value, it is determined to write the color information of the current pixel into the buffer; and / or, the preset drawing process of the dynamic image includes: setting the number of frames of the dynamic image; setting a loop function and configuring a timer; updating the state of each frame of the image by setting an index variable; drawing the image, and determining whether the animation has reached the end of the frame, so as to determine whether the animation can be played to the end in the expected manner Complete; and / or, the preset drawing process of the multi-region image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; looping through each pixel of the image to be drawn to obtain the position of each pixel in the image to be drawn; calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, and combining the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels; performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and whether the color information of the pixel is non-zero;If the color information of the current pixel is determined to be non-zero, it is determined that the color information of the current pixel is superimposed on the graphics display buffer. ;
[0008] Optionally, the display screen is any one of TFT-LCD, IPS-LCD, PVA-LCD and MVA-LCD.
[0009] On the other hand, the present invention provides a display screen image drawing device, comprising: an acquisition unit, used to acquire image data of an image to be drawn; a determination unit, used to determine a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn; wherein different image types correspond to different preset drawing processes; and a drawing unit, used to draw the image of the image to be drawn according to the determined preset drawing process based on the acquired image data of the image to be drawn.
[0010] Optionally, it further includes: a processing unit, used to pre-process the original data of the image to be drawn to obtain processed image data of the image to be drawn; and a storage unit, used to store the image data of the image to be drawn obtained by the processing unit in a preset format.
[0011] Optionally, it also includes: a sending unit, used to communicate with the display screen through an IO port simulating an SPI communication protocol, sending screen parameter configuration instructions to the display screen to configure the screen parameters of the display screen, and / or sending color correction instructions to the display screen to correct the color parameters of the display screen.
[0012] Optionally, the image type includes: at least one of: a non-transparent image, a transparent image, a dynamic image and a multi-region image; the preset drawing process includes: at least one of: a preset drawing process for a non-transparent image, a preset drawing process for a transparent image, a preset drawing process for a dynamic image and a preset drawing process for a multi-region image; the preset drawing process for a non-transparent image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn; obtaining the position of each pixel in the image to be drawn according to the position of the current pixel in the image to be drawn, and combining the relative position of the image to be drawn in the display screen and the number of pixels occupied by each row of pixels; The number of nodes is used to calculate the address of the current pixel in the graphics display buffer; according to the resolved width and height of the image to be drawn and the calculated address of each pixel of the image to be drawn in the graphics display buffer, the image drawing of the image to be drawn is performed; and / or, the preset drawing process of the transparent image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; looping through each pixel of the image to be drawn to obtain the position of each pixel in the image to be drawn; according to the position of the current pixel in the image to be drawn, combined with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels, calculating the address of the current pixel in the graphics display buffer the address in the graphics display buffer; according to the resolved width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and the transparency of the pixel, the image drawing of the image to be drawn is performed; wherein, it is determined whether the transparency of the current pixel is greater than a set threshold value, and if it is determined that the transparency of the current pixel is greater than the set threshold value, it is determined to write the color information of the current pixel into the buffer; and / or, the preset drawing process of the dynamic image includes: setting the number of frames of the dynamic image; setting a loop function and configuring a timer; updating the state of each frame of the image by setting an index variable; drawing the image, and determining whether the animation has reached the end of the frame, so as to determine whether the animation can be played to the end in the expected manner Complete; and / or, the preset drawing process of the multi-region image includes: parsing the width and height of the image to be drawn from the image data of the image to be drawn; looping through each pixel of the image to be drawn to obtain the position of each pixel in the image to be drawn; calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, and combining the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels; performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and whether the color information of the pixel is non-zero;If the color information of the current pixel is determined to be non-zero, it is determined that the color information of the current pixel is superimposed on the graphics display buffer. ;
[0013] Optionally, the display screen is any one of TFT-LCD, IPS-LCD, PVA-LCD and MVA-LCD.
[0014] Another aspect of the present invention provides a storage medium having a computer program stored thereon, wherein the program implements the steps of any of the aforementioned methods when executed by a processor.
[0015] In another aspect, the present invention provides an image display device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the aforementioned methods when executing the program.
[0016] Another aspect of the present invention provides an image display device, comprising any of the above-mentioned display screen image drawing devices.
[0017] According to the technical solution of the present invention, a suitable image drawing method can be selected according to the image type, and a variety of image drawing method options can be provided to achieve a variety of display effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0019] Figure 1 is a method schematic diagram of an embodiment of a display screen image drawing method provided by the present invention;
[0020] Figure 2 A schematic diagram showing the steps of a preset drawing process for a non-transparent image is shown;
[0021] Figure 3 A schematic diagram showing the steps of a preset drawing process of a transparent image is shown;
[0022] Figure 4 Schematic diagram showing the steps of the preset drawing process of dynamic images
[0023] Figure 5 A schematic diagram showing the steps of a preset drawing process for a multi-region image is shown;
[0024] Figure 6 is a method schematic diagram of a specific embodiment of the display screen image drawing method provided by the present invention;
[0025] Figure 7A non-transparent image drawing flow chart according to a specific embodiment of the present invention is shown;
[0026] Figure 8 A transparent image drawing flow chart according to a specific embodiment of the present invention is shown;
[0027] Fig. 9 A flow chart of dynamic image drawing according to a specific embodiment of the present invention is shown;
[0028] Fig.10 A multi-region image drawing flow chart according to a specific embodiment of the present invention is shown;
[0029] Fig.11 It is a structural block diagram of an embodiment of the display screen image drawing device provided by the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] The present invention provides a method for drawing an image on a display screen. The method of the present invention can be used in image display devices. For example, devices such as electrical appliances and car dashboards that have a display screen for displaying images. The method can be implemented in a controller of the image display device. The display screen can be any one of TFT-LCD, IPS-LCD, PVA-LCD and MVA-LCD, for example.
[0033] Figure 1 It is a method schematic diagram of an embodiment of a display screen image drawing method provided by the present invention.
[0034] like Figure 1 As shown, according to an embodiment of the present invention, the display screen image drawing method at least includes step S110, step S120 and step S130.
[0035] Step S110, obtaining image data of the image to be drawn.
[0036] Specifically, the original data of the image to be drawn is pre-processed to obtain processed image data of the image to be drawn, and the processed image data of the image to be drawn is stored in a preset format, which not only facilitates data standardization processing but also improves the calculation speed, laying a foundation for subsequent image drawing.
[0037] In a specific implementation, the original data of the image to be drawn can be processed by a specific tool, such as the Image2Lcd tool and the FontCvtST tool, to process and convert the original image, numbers, Chinese characters and other information, convert them into hexadecimal data, and store the conversion results in the form of an array. For example, it can be stored in the storage space of the controller, and the image data of the image to be drawn is obtained from the storage space of the controller before the image is drawn. The storage space can be flash, for example.
[0038] Preferably, before drawing an image, the SPI communication protocol is simulated through the IO port to communicate with the display screen, and parameter configuration instructions are sent to the display screen to configure the screen parameters of the display screen, and / or color correction instructions are sent to the display screen to correct the color parameters of the display screen.
[0039] Specifically, by operating the IO port to configure the input and output status, polarity, phase, etc., the SPI communication protocol is simulated to communicate with the display screen, which not only can accurately send screen parameter configuration instructions to the display screen, but also has the advantages of strong flexibility and good compatibility.
[0040] The screen parameter configuration instruction is used to configure the screen parameters of the display screen; the screen parameters may include at least one of display mode, pixel format, and scanning direction. The color correction instruction is used to adjust the color parameters of the display screen; the color parameters may include at least one of brightness, contrast, and chromaticity.
[0041] For example, the SPI protocol is simulated through the IO port to communicate with the display screen, and parameter configuration instructions are sent to the display screen to configure screen parameters such as display mode, pixel format and scanning direction to ensure that it can meet specific needs in different application scenarios. Color correction instructions and data are sent to the display screen to adjust color parameters, which may specifically include color correction parameters such as brightness, contrast, chromaticity, etc., thereby optimizing display quality and improving image clarity and color reproduction.
[0042] Step S120: determining a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn.
[0043] Step S130 , based on the acquired image data of the image to be drawn, image drawing is performed on the image to be drawn according to the determined preset drawing process.
[0044] Specifically, different image types correspond to different preset drawing processes. Therefore, according to the image type of the image to be drawn, the preset drawing process for drawing the image to be drawn can be determined. The image type can specifically include: at least one of: a non-transparent image, a transparent image, a dynamic image, and a multi-region image. Based on the image data of the image to be drawn, the image can be drawn according to the corresponding preset drawing process.
[0045] Figure 2 A schematic diagram of the steps of a preset drawing process of a non-transparent image is shown. In a specific embodiment, the preset drawing process of a non-transparent image includes:
[0046] S11, parse the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0047] S12, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0048] S13, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0049] S14, performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn and the calculated address of each pixel of the image to be drawn in the graphic display buffer.
[0050] Specifically, the width and height of the image to be drawn are parsed from the incoming image data, and then each pixel of the image to be drawn is traversed through two layers of nested loops to process each pixel in the image in turn. The traversal process is to obtain the position and coordinates of the pixel so that the pixel data can be correctly written into the graphics display buffer. According to the position of the current pixel in the image to be drawn, combined with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels, the address of the current pixel in the graphics display buffer is calculated, and finally the image is drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and the color information of each pixel.
[0051] Figure 3 A schematic diagram of the steps of a preset drawing process of a transparent image is shown. In a specific implementation, the preset drawing process of a transparent image includes:
[0052] S21, parse the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0053] S22, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0054] S23, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0055] S24, performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and the transparency of the pixel.
[0056] Specifically, it is determined whether the transparency of the current pixel is greater than a set threshold to determine whether to write the color information of the current pixel into the graphics display buffer; wherein, if it is determined that the transparency of the current pixel is greater than the set threshold, it is determined to write the color information of the current pixel into the buffer.
[0057] The image to be drawn is drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and whether the color information of the pixel is written into the graphic display buffer.
[0058] Specifically, the width and height of the image are first parsed from the incoming image data, starting from the input parameter parsing, by looping through each pixel, calculating the corresponding address in the buffer, and then determining whether to write the color information into the buffer based on whether the transparency of the pixel is greater than the set threshold. This logic ensures that when drawing a transparent image, only pixels with sufficient transparency will be drawn, while pixels with lower transparency will be ignored, avoiding unnecessary calculation processes and improving the execution efficiency of the code.
[0059] Figure 4 A schematic diagram of the steps of a preset drawing process of a dynamic image is shown. In a specific implementation, the preset drawing process of the dynamic image includes:
[0060] S31, setting the frame number of the dynamic image;
[0061] S32, set the loop function and configure the timer. Perform frame looping by combining the timer with the loop function. For example, configure the timer by configuring parameters such as the counting mode and the pre-scaling value, and perform frame looping by combining the loop function.
[0062] S33, updating the state of each frame of the image by setting an index variable; the state includes: at least one of the position, size, and transparency of the image;
[0063] S34, draw an image and determine whether the animation has reached the end of the frame, so as to determine whether the animation can be played in the expected manner; thus, after the playback is completed, the preset subsequent operations can be executed to ensure the logic and coherence of the system.
[0064] Figure 5 A schematic diagram of the steps of a preset drawing process for a multi-region image is shown. In a specific embodiment, the preset drawing process for a multi-region image includes:
[0065] S41, parsing the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0066] S42, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0067] S43, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0068] S44, drawing the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and whether the color information of the pixel is non-zero.
[0069] Among them, it is determined whether the color information of the current pixel is non-zero. If the color information of the current pixel is non-zero, it means that the current pixel contains valid color data. If the color information of the current pixel is non-zero, it is determined to superimpose the color information of the current pixel into the graphics display buffer.
[0070] A multi-region image refers to an image that displays multiple regions on the display screen at the same time, which may have different features, colors, shapes or contents, and may be superimposed. Specifically, the width and height of the image are first parsed from the incoming image data, and then each pixel of the image is traversed through a nested loop, and the address in the graphics display buffer is calculated based on the position of the current pixel in the image and the starting coordinates. Then, it is determined whether the color information of the current pixel is non-zero to determine whether it contains valid color data, thereby avoiding drawing invalid or transparent pixels on the screen and improving the accuracy of image drawing. If the color information of the current pixel is non-zero, it means that the pixel contains valid color data, and the color information is superimposed on the graphics display buffer to draw the image.
[0071] In order to clearly illustrate the technical solution of the present invention, the execution process of the display screen image drawing method provided by the present invention is described below with reference to a specific embodiment.
[0072] Figure 6 It is a method schematic diagram of a specific embodiment of the display screen image drawing method provided by the present invention. Figure 6 The overall flow chart is shown. Figure 6 As shown, the following steps are included:
[0073] 1. Raw image processing:
[0074] Through specific tools (such as Image2Lcd and FontCvtST tools), the images to be processed (such as at least one of original pictures, numbers, and Chinese characters) are processed and stored. For example, they are converted into hexadecimal data, and the conversion results are stored in the form of an array, which not only facilitates data standardization processing but also improves the calculation speed, laying the foundation for subsequent image drawing.
[0075] 2. TFT-LCD bottom layer initialization:
[0076] By operating the IO port to simulate the SPI communication protocol to communicate with the display screen, send specific instructions and data to the display screen to configure the screen parameters of the display screen (for example, including at least one of the display mode, pixel format, and scanning direction) to ensure that it can meet specific needs in different application scenarios; send specific color correction instructions and data to the display screen to adjust the color parameters, so as to optimize the display quality and improve the image clarity and color reproduction. The color correction parameters include, for example, at least one of brightness, contrast, and chroma. In addition, the frame rate is controlled by a timer.
[0077] First, list the initialization operations related to the underlying hardware and abstract them into a series of functions or interfaces; next, write the underlying driver code, which contains the logic for direct interaction with the display hardware; then, integrate the underlying driver code into a unified underlying driver framework.
[0078] 3. Image drawing selection:
[0079] Through the above-mentioned underlying configuration optimization, the color transmission and filling process is accelerated, the efficiency and accuracy of image drawing are improved, and different images can be drawn according to different needs and application scenarios. Specifically, it includes non-transparent image drawing, transparent image drawing, dynamic image drawing and multi-area image drawing:
[0080] Figure 7 FIG. 2 shows a flowchart of non-transparent image drawing according to a specific embodiment of the present invention. Figure 7 As shown:
[0081] First, the input parameters are parsed to parse the image width and height from the incoming image data. Then, the pixels are traversed, and each pixel of the image is traversed through two nested loops to process each pixel in the image in turn. Then, the address of each pixel in the graphics display buffer is calculated based on the position and starting coordinates of the current pixel in the image combined with the number of bytes occupied by each row of pixels. Then, data is copied and finally the image is drawn.
[0082] Figure 8 FIG. 1 shows a transparent image drawing process flow chart according to a specific embodiment of the present invention. Figure 8 As shown:
[0083] First, parse the width and height of the image from the incoming image data, starting with the parsing of the input parameters, and loop through each pixel (process each pixel in the image in turn by looping through the image to get the position and coordinates of the pixel, so that the pixel data can be correctly written into the display buffer), calculate the address of each pixel in the buffer (the address in the graphics display buffer is calculated by combining the position and starting coordinates of the current pixel in the image with the number of bytes occupied by each row of pixels), and then parse the color information to determine whether the transparency of the pixel is greater than the set threshold, so as to decide whether to write the color information into the buffer. If so, the color information is written into the buffer when the image is drawn. Such logic ensures that when drawing a transparent image, only pixels with sufficient transparency will be drawn, while pixels with lower transparency will be ignored, avoiding unnecessary calculation processes and improving the execution efficiency of the code.
[0084] Fig. 9 FIG. 1 shows a flow chart of dynamic image drawing according to a specific embodiment of the present invention. Fig. 9 As shown:
[0085] First, set the number of frames of the dynamic image, then set the loop function and cooperate with the timer to perform frame loop, and update the status of each frame of the image (including at least one of the image's position, size, and transparency) by setting the index variable. After that, draw the image and determine whether the animation has reached the end of the frame, so as to ensure that the animation can be played as expected, and after the playback is completed, it can follow the preset subsequent operations to ensure the logic and consistency of the system.
[0086] Fig.10 FIG. 2 shows a flowchart of multi-region image drawing according to a specific embodiment of the present invention. Fig.10 As shown:
[0087] First, parse the width and height of the image from the incoming image data, then traverse each pixel of the image through a nested loop, and calculate the address in the graphics display buffer based on the current pixel's position in the image and the starting coordinates, and then determine whether the color information of the current pixel is non-zero to determine whether it contains valid color data, avoid drawing invalid or transparent pixels on the screen, and improve the accuracy of image drawing. If the color information of the current pixel is non-zero, it means that the pixel contains valid color data, then the color information is superimposed on the graphics display buffer to draw the image.
[0088] The present invention provides a display screen image drawing device. The device of the present invention can be used in image display equipment. For example, electrical appliances, car dashboards and other equipment with a display screen for image display. Specifically, it can be implemented in a controller of the image display device. The display screen can be any one of TFT-LCD, IPS-LCD, PVA-LCD and MVA-LCD.
[0089] Fig.11 FIG. 1 is a structural block diagram of an embodiment of a display screen image drawing device provided by the present invention. Fig.11 As shown, the display screen image drawing device 100 includes: an acquisition unit 110 , a determination unit 120 and a drawing unit 130 .
[0090] The acquisition unit 110 is used to acquire image data of the image to be drawn.
[0091] Specifically, the display screen image drawing device 100 further includes a processing unit and a storage unit (not shown). The processing unit is used to pre-process the original data of the image to be drawn to obtain the processed image data of the image to be drawn. The storage unit is used to store the image data of the image to be drawn obtained by the processing unit in a preset format. Pre-processing the original data of the image to be drawn to obtain the processed image data of the image to be drawn, and storing the processed image data of the image to be drawn in a preset format, not only facilitates data standardization processing but also improves the operation speed, laying a foundation for subsequent image drawing.
[0092] In a specific implementation, the original data of the image to be drawn can be processed by a specific tool, such as the Image2Lcd tool and the FontCvtST tool, to process and convert the original image, numbers, Chinese characters and other information, convert them into hexadecimal data, and store the conversion results in the form of an array. For example, it can be stored in the storage space of the controller, and the image data of the image to be drawn is obtained from the storage space of the controller before the image is drawn. The storage space can be flash, for example.
[0093] Preferably, the device 100 also includes a sending unit (not shown) for communicating with the display screen through an IO port simulating an SPI communication protocol before drawing an image, sending parameter configuration instructions to the display screen to configure the screen parameters of the display screen, and / or sending color correction instructions to the display screen to correct the color parameters of the display screen.
[0094] Specifically, the IO port is operated to simulate the SPI communication protocol to communicate with the display screen, so as to send a screen parameter configuration instruction and corresponding screen parameter configuration data to the display screen, and / or send a color correction instruction and corresponding color correction parameters to the display screen.
[0095] The screen parameter configuration instruction is used to configure the screen parameters of the display screen; the screen parameters may include at least one of display mode, pixel format, and scanning direction. The color correction instruction is used to adjust the color parameters of the display screen; the color parameters may include at least one of brightness, contrast, and chromaticity.
[0096] For example, the SPI protocol is simulated through the IO port to communicate with the display screen, and parameter configuration instructions are sent to the display screen to configure screen parameters such as display mode, pixel format and scanning direction to ensure that it can meet specific needs in different application scenarios. Color correction instructions and data are sent to the display screen to adjust color parameters, which may specifically include color correction parameters such as brightness, contrast, chromaticity, etc., thereby optimizing display quality and improving image clarity and color reproduction.
[0097] The determination unit 120 is used to determine a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn; the drawing unit 130 is used to draw the image to be drawn according to the determined preset drawing process based on the acquired image data of the image to be drawn.
[0098] Specifically, different image types correspond to different preset drawing processes. Therefore, the determination unit 120 can determine the preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn. Then, the drawing unit 130 draws the image to be drawn according to the determined preset drawing process based on the acquired image data of the image to be drawn. The image type can specifically include: at least one of a non-transparent image, a transparent image, a dynamic image, and a multi-region image. Based on the image data of the image to be drawn, the image drawing can be performed according to the corresponding preset drawing process.
[0099] Figure 2 A schematic diagram of the steps of a preset drawing process of a non-transparent image is shown. In a specific embodiment, the preset drawing process of a non-transparent image includes:
[0100] S11, parse the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0101] S12, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0102] S13, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0103] S14, performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn and the calculated address of each pixel of the image to be drawn in the graphic display buffer.
[0104] Specifically, the width and height of the image to be drawn are parsed from the incoming image data, and then each pixel of the image to be drawn is traversed through two layers of nested loops to process each pixel in the image in turn. The traversal process is to obtain the position and coordinates of the pixel so that the pixel data can be correctly written into the graphics display buffer. According to the position of the current pixel in the image to be drawn, combined with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels, the address of the current pixel in the graphics display buffer is calculated, and finally the image is drawn. According to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphics display buffer and the color information of each pixel, the IO port is configured to simulate the drawing signal, and the data in the image display buffer is traversed by setting a loop, and each pixel is written to the screen to achieve image drawing.
[0105] Figure 3 A schematic diagram of the steps of a preset drawing process of a transparent image is shown. In a specific implementation, the preset drawing process of a transparent image includes:
[0106] S21, parse the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0107] S22, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0108] S23, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0109] S24, performing image drawing of the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and the transparency of the pixel.
[0110] Specifically, it is determined whether the transparency of the current pixel is greater than a set threshold to determine whether to write the color information of the current pixel into the graphics display buffer; wherein, if it is determined that the transparency of the current pixel is greater than the set threshold, it is determined to write the color information of the current pixel into the buffer.
[0111] The image to be drawn is drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and whether the color information of the pixel is written into the graphic display buffer.
[0112] Specifically, the width and height of the image are first parsed from the incoming image data, starting from the input parameter parsing, by looping through each pixel, calculating the corresponding address in the buffer, and then determining whether to write the color information into the buffer based on whether the transparency of the pixel is greater than the set threshold. This logic ensures that when drawing a transparent image, only pixels with sufficient transparency will be drawn, while pixels with lower transparency will be ignored, avoiding unnecessary calculation processes and improving the execution efficiency of the code.
[0113] Figure 4 A schematic diagram of the steps of a preset drawing process of a dynamic image is shown. In a specific implementation, the preset drawing process of the dynamic image includes:
[0114] S31, setting the frame number of the dynamic image;
[0115] S32, set the loop function and configure the timer, for example, by configuring the counting mode, pre-scaling value and other parameters to configure the timer, and perform frame loop in combination with the loop function.
[0116] S33, updating the state of each frame of the image by setting an index variable; the state includes: at least one of the position, size, and transparency of the image;
[0117] S34, image drawing is performed, and it is determined whether the animation has reached the end of the frame, so as to determine whether the animation can be played to completion in the expected manner; thus, after the playback is completed, the preset subsequent operations can be performed to ensure the logic and coherence of the system.
[0118] Figure 5 A schematic diagram of the steps of a preset drawing process for a multi-region image is shown. In a specific embodiment, the preset drawing process for a multi-region image includes:
[0119] S41, parsing the image data of the image to be drawn to obtain the width and height of the image to be drawn.
[0120] S42, obtaining the position of each pixel in the image to be drawn by looping through each pixel of the image to be drawn.
[0121] S43, calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels.
[0122] S44, drawing the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and whether the color information of the pixel is non-zero.
[0123] Among them, it is determined whether the color information of the current pixel is non-zero. If the color information of the current pixel is non-zero, it means that the current pixel contains valid color data. If the color information of the current pixel is non-zero, it is determined to superimpose the color information of the current pixel into the graphics display buffer.
[0124] A multi-region image refers to an image that displays multiple regions on the display screen at the same time, which may have different features, colors, shapes or contents, and may be superimposed. Specifically, the width and height of the image are first parsed from the incoming image data, and then each pixel of the image is traversed through a nested loop, and the address in the graphics display buffer is calculated based on the position of the current pixel in the image and the starting coordinates. Then, it is determined whether the color information of the current pixel is non-zero to determine whether it contains valid color data, thereby avoiding drawing invalid or transparent pixels on the screen and improving the accuracy of image drawing. If the color information of the current pixel is non-zero, it means that the pixel contains valid color data, and the color information is superimposed on the graphics display buffer to draw the image.
[0125] The present invention also provides a storage medium corresponding to the display screen image drawing method, on which a computer program is stored, and when the program is executed by a processor, the steps of any of the above methods are implemented.
[0126] The present invention also provides an image display device corresponding to the display screen image drawing method, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the aforementioned methods when executing the program.
[0127] The present invention also provides an image display device corresponding to the display screen image drawing device, comprising any of the above-mentioned display screen image drawing devices.
[0128] Therefore, the solution provided by the present invention can select a suitable image drawing method according to the image type, can provide a variety of image drawing method options, and achieve a variety of display effects.
[0129] The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored as one or more instructions or codes on a computer-readable medium or transmitted via a computer-readable medium. Other examples and implementations are within the scope and spirit of the present invention and the appended claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hard wiring, or a combination of any of these. In addition, each functional unit may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit.
[0130] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components of the control device may or may not be physical units, that is, they may be located in one place or distributed in multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0132] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0133] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.
Claims
1. A display screen image drawing method, characterized in that: include: Get image data of the image to be drawn; Determining a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn; wherein different image types correspond to different preset drawing processes; Based on the acquired image data of the image to be drawn, image drawing is performed on the image to be drawn according to the determined preset drawing process.
2. The method according to claim 1, characterized in that Also includes: The original data of the image to be drawn is processed in advance to obtain processed image data of the image to be drawn, and the processed image data of the image to be drawn is stored in a preset form.
3. The method according to claim 1 or 2, characterized in that: Also includes: Communicate with the display screen by simulating the SPI communication protocol through the IO port, send screen parameter configuration instructions to the display screen to configure the screen parameters of the display screen, and / or send color correction instructions to the display screen to correct the color parameters of the display screen.
4. The method according to claim 1 or 2, characterized in that: The image type includes: at least one of: a non-transparent image, a transparent image, a dynamic image, and a multi-region image; the preset drawing process includes: at least one of: a preset drawing process for a non-transparent image, a preset drawing process for a transparent image, a preset drawing process for a dynamic image, and a preset drawing process for a multi-region image; The preset drawing process of the non-transparent image includes: Parsing the width and height of the image to be drawn from the image data of the image to be drawn; By looping through each pixel of the image to be drawn, obtaining the position of each pixel in the image to be drawn; Calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels; Perform image drawing of the image to be drawn according to the parsed width and height of the image to be drawn and the calculated address of each pixel of the image to be drawn in the graphic display buffer; and / or, The preset drawing process of the transparent image includes: Parsing the width and height of the image to be drawn from the image data of the image to be drawn; By looping through each pixel of the image to be drawn, a position of each pixel in the image to be drawn is obtained; Calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels; According to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and the transparency of the pixel, the image to be drawn is drawn; Wherein, determining whether the transparency of the current pixel is greater than a set threshold, if it is determined that the transparency of the current pixel is greater than the set threshold, determining to write the color information of the current pixel into the buffer; and / or, The preset drawing process of the dynamic image includes: Set the number of frames of dynamic images; Set the loop function and configure the timer; Update the state of each frame image by setting the index variable; Draw the image and determine whether the animation has reached the end of the frame to ensure that the animation can be played as expected; and / or, The preset drawing process of the multi-region image includes: Parsing the width and height of the image to be drawn from the image data of the image to be drawn; By looping through each pixel of the image to be drawn, a position of each pixel in the image to be drawn is obtained; Calculating the address of the current pixel in the graphics display buffer according to the position of the current pixel in the image to be drawn, in combination with the relative position of the image to be drawn in the display screen and the number of bytes occupied by each row of pixels; Perform image drawing of the image to be drawn according to the parsed width and height of the image to be drawn, and the calculated address of each pixel of the image to be drawn in the graphic display buffer and whether the color information of the pixel is non-zero; If it is determined that the color information of the current pixel is non-zero, it is determined that the color information of the current pixel is superimposed on the graphic display buffer.
5. The method according to claim 1 or 2, characterized in that: The display screen is any one of TFT-LCD, IPS-LCD, PVA-LCD and MVA-LCD.
6. A display screen image drawing device, characterized in that: include: An acquisition unit, used for acquiring image data of an image to be drawn; A determination unit, configured to determine a preset drawing process for drawing the image to be drawn according to the image type of the image to be drawn; wherein different image types correspond to different preset drawing processes; A drawing unit is used to draw the image to be drawn based on the acquired image data of the image to be drawn and according to the determined preset drawing process.
7. The device according to claim 6, characterized in that Also includes: A processing unit, used for pre-processing the original data of the image to be drawn to obtain processed image data of the image to be drawn; The storage unit is used to store the image data of the image to be drawn obtained by the processing unit in a preset format.
8. The device according to claim 6 or 7, characterized in that Also includes: The sending unit is used to communicate with the display screen through an IO port simulating an SPI communication protocol, send a screen parameter configuration instruction to the display screen to configure the screen parameters of the display screen, and / or send a color correction instruction to the display screen to correct the color parameters of the display screen.
9. A storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the steps of any method described in claims 1-5 are implemented.
10. An image display device, characterized in that: It comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any method described in claims 1-5 when executing the program, or comprises a display screen image drawing device described in any one of claims 6-8.
