[go: up one dir, main page]

CN118470152A - Method and device for drawing color curve, storage medium and terminal equipment - Google Patents

Method and device for drawing color curve, storage medium and terminal equipment Download PDF

Info

Publication number
CN118470152A
CN118470152A CN202410771262.1A CN202410771262A CN118470152A CN 118470152 A CN118470152 A CN 118470152A CN 202410771262 A CN202410771262 A CN 202410771262A CN 118470152 A CN118470152 A CN 118470152A
Authority
CN
China
Prior art keywords
color
curve
alpha
value
gray
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410771262.1A
Other languages
Chinese (zh)
Inventor
植永耀
张程
张胜德
何东泽
梁坤伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongguan Levetop Technology Co ltd
Original Assignee
Dongguan Levetop Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongguan Levetop Technology Co ltd filed Critical Dongguan Levetop Technology Co ltd
Priority to CN202410771262.1A priority Critical patent/CN118470152A/en
Publication of CN118470152A publication Critical patent/CN118470152A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application discloses a method and a device for drawing a color curve, a storage medium and terminal equipment, and relates to the field of image processing. The drawing method of the application comprises the following steps: generating a black canvas and a color background diagram; wherein, the black canvas and the color background picture have the same size; drawing a white curve in a black canvas based on an editing instruction of a user, and obtaining a curve gray map after editing is completed; calculating a color value of the color curve graph; wherein ,alpha(x,y)=Gray(x,y)/255;R1(x,y)=int[R0(x,y)*alpha(x,y)+0.5];G1(x,y)=int[G0(x,y)*alpha(x,y)+0.5];B1(x,y)=int(B0(x,y)*alpha(x,y)+0.5]; displays a color profile on the TFT display screen. According to the application, the gray value is directly used as the alpha value, and simple multiplication operation and rounding are carried out on the gray value and the RGB value of the color background image, so that efficient color mixing calculation is realized, complex table lookup operation is avoided, and calculation efficiency is improved.

Description

Method and device for drawing color curve, storage medium and terminal equipment
Technical Field
The present application relates to the field of image processing, and in particular, to a method and apparatus for drawing a color curve, a storage medium, and a terminal device.
Background
A statistical curve is a curve that shows the distribution, trend, or relationship of data by curve. The statistical curve is mainly used for presenting continuous changes of a group of data, so that the characteristics, modes or trends of the data are more visual and easy to understand. When the color of the statistical curve is colored, it is often used to represent the severity of the data in different areas, helping the user to more intuitively understand patterns, trends, or anomalies in the data by visual differences. When a processor (for example, a microcontroller in an embedded system processes an MCU) draws a color curve, the MCU needs to query the coordinates and color values of each pixel in the statistical curve in a display screen in a table look-up mode, and if the volume of a table is large, a large amount of time is consumed by the MCU.
Disclosure of Invention
The embodiment of the application provides a method and a device for drawing a color curve, a storage medium and terminal equipment, which can solve the problem of high calculation cost for drawing the color curve in the prior art. The technical scheme is as follows:
In a first aspect, an embodiment of the present application provides a method for drawing a color curve, where the method includes:
generating a black canvas and a color background diagram; wherein the black canvas and the color background map are the same size;
Drawing a white curve in the black canvas based on an editing instruction of a user, and obtaining a curve gray scale map after editing is completed;
calculating a color value of the color curve graph; wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
B1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ]; (x, y) represents coordinates of the pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red value, green value and blue value of the pixel point in the color background image respectively, and R1, G1 and B1 represent red value, green value and blue value of the pixel point in the color graph respectively;
The color profile is displayed on a TFT display screen.
In a second aspect, an embodiment of the present application provides a device for drawing a color curve, where the device includes:
The generating unit is used for generating a black canvas and a color background image; wherein the black canvas and the color background map are the same size;
The conversion unit is used for drawing a white curve in the black canvas based on an editing instruction of a user, and obtaining a curve gray level diagram after editing is completed;
A calculation unit for calculating a color value of the color chart; wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
B1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ]; (x, y) represents coordinates of the pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red value, green value and blue value of the pixel point in the color background image respectively, and R1, G1 and B1 represent red value, green value and blue value of the pixel point in the color graph respectively;
and the pushing unit is used for displaying the color curve graph on the TFT display screen.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-described method steps.
In a fourth aspect, an embodiment of the present application provides a terminal device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The technical scheme provided by the embodiments of the application has the beneficial effects that at least:
By directly taking the gray value as the alpha value and carrying out simple multiplication operation and rounding with the RGB value of the color background image, the efficient color mixing calculation is realized, the complex table look-up operation is avoided, and the calculation efficiency is improved. Due to the high efficiency of the calculation process, the scheme can quickly respond to the editing instruction of the user, generate and display the color curve graph in real time, and provide smooth user experience. Because a large number of data tables are not required to be prestored, the scheme reduces memory occupation, optimizes resource use efficiency and is particularly important for terminal equipment with limited memory. The application allows the user to customize the curve and the background color according to the requirements, generates the color curve graph with personalized effect, and enhances the flexibility of application.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for drawing a color curve according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a drawing device for color curves provided by the application;
fig. 3 is a schematic structural diagram of a terminal device provided by the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings.
It should be noted that, the method for drawing a color curve provided by the present application is generally executed by a terminal device, and correspondingly, the device for drawing a color curve is generally disposed in the terminal device.
The method for drawing the color curve according to the embodiment of the present application will be described in detail with reference to fig. 1.
Referring to fig. 1, a flow chart of a method for drawing a color curve is provided in an embodiment of the application. As shown in fig. 2, the method according to the embodiment of the present application may include the following steps:
s101, generating a black canvas and a color background image.
Wherein the terminal device first determines the size (e.g., width, height) of the canvas and the background diagram to be generated, ensuring that the two are of identical size. The specific color value of the color background image is set, and the specific color value can be in a color coding format such as RGB, HSV or Hex. The terminal device creates a new image object with the size consistent with the size set in step 1 using an image processing library (e.g., PIL, openCV, etc.). Each pixel point of the newly created image object is set to black (RGB values are (0, 0, 0)). The black canvas is saved or displayed for subsequent use or viewing. The image processing library is also used to create a new image object of the same size as the black canvas. Each pixel point of the new image object is set to the color value set in step 1. The color background diagram is saved or displayed, ensuring that it is stored and displayed separately from the black canvas. The terminal device may save the generated black canvas and color background map as image files (e.g., PNG, JPEG, etc. formats) to a local storage device or a designated network location, respectively.
In some embodiments of the application, the generating a black canvas and a color background map comprises:
Displaying a drawing interface;
generating a black canvas and a white canvas in the drawing interface;
and generating a color background picture after performing color filling operation in the white canvas.
The terminal equipment starts a graphic interface library (such as Qt, swing and the like) and initializes a drawing interface. The drawing interface is sized and laid out to accommodate two canvases. A new image control (e.g., canvas, panel, etc.) is created in the drawing interface as a container for the black Canvas. A full black rectangle is drawn on the image control using a graphics processing library (e.g., PIL, openCV, etc.) or drawing functions built into the graphics library to simulate a black canvas. And displaying the black canvas at a designated position of the drawing interface.
Another new image control is created in the drawing interface as a container for the white canvas. And drawing a full-white rectangle on the image control by using an image processing library or a drawing function built in the image library so as to simulate a white canvas. An interactive function is provided that allows a user to perform color fill operations on a white canvas. For example, color selectors, brush tools, etc. may be added. The white canvas is displayed at the designated location of the drawing interface, ensuring separate display from the black canvas. The user selects a color through the interactive interface and fills in on the white canvas using the brush tool. The terminal device processes the user input in real time and draws colors on the white canvas according to the selected colors and the drawing paths. The user may repeat the color selection and filling operations until a satisfactory color background map is generated. In the whole drawing process, the terminal equipment should contain a proper error processing mechanism to cope with possible abnormal situations such as insufficient memory, file writing failure and the like. The rendering interface and canvas may be performance optimized as desired, such as to reduce unnecessary redrawing, use hardware acceleration, etc.
Further, the generating the color background map after performing the color filling operation in the white canvas includes:
dividing the white canvas into a plurality of rectangular areas in the horizontal direction according to preset intervals;
And filling corresponding colors for each rectangular area to obtain a color background image.
The terminal device determines the interval of rectangular areas (i.e. the width of each rectangle) divided in the horizontal direction on the white canvas according to the user requirement or preset parameters, and the width of each rectangular area may be equal or unequal, specifically according to the actual requirement. Meanwhile, the number of rectangular areas to be divided is calculated according to the width of the white canvas and a preset interval. The terminal equipment divides a plurality of rectangular areas in the horizontal direction of the white canvas according to preset intervals. The width of each rectangular area is determined by the preset interval, and the height is the same as the height of the white canvas.
And the terminal equipment defines the color to be filled in each rectangular area according to the user requirement or preset parameters. The color scheme may be a fixed sequence of colors or may be randomly generated colors. The terminal device traverses each rectangular area and fills them with the corresponding colors according to the color scheme. A corresponding color block is drawn within each rectangular region using a drawing function built into the graphic library. After the steps, a plurality of rectangular areas with different colors are filled on the white canvas to form a color background diagram.
S102, drawing a white curve in the black canvas based on an editing instruction of a user, and obtaining a curve gray level diagram after editing is completed.
Wherein the terminal device receives user editing instructions via a Graphical User Interface (GUI), which typically include a start point, an end point, a path point, and possibly curve shape parameters (e.g., curve radius, angle, etc.) of the curve. The receipt of the instruction may be accomplished by mouse input, touch screen input, or a specialized graphical editing tool. And according to the received editing instruction, the terminal equipment draws a white curve on the black canvas by using a drawing function in the graphic library. In the drawing process, the terminal equipment calculates the path of the curve according to the starting point, the end point and the path point of the curve and the curve shape parameter. Then, using white as a drawing color, a curve is drawn on a black canvas in accordance with the calculated path. When the user completes drawing the curve and confirms that editing is finished, the terminal device checks whether all editing instructions have been correctly executed. If there is an unprocessed instruction or error, the terminal device prompts the user to make a correction or re-edit. If all instructions have executed correctly, then go to the next step. The terminal device converts a black canvas containing a white curve into a gray map. In the conversion process, the terminal device converts each pixel point in the canvas from the RGB color space to the gray space. For a white curve on a black canvas, its gray value will be near 255 (white represented in the gray scale), while the rest of the black canvas remains at 0 (black represented in the gray scale).
Further, the white curve is subjected to antialiasing treatment.
Wherein the terminal device first reads image data containing a white curve. This may be an image acquired through file loading, network transmission, or other means. The terminal device uses an image processing algorithm to analyze the edge information in the image, in particular the edges of the white curve. Since white curves may appear as areas of higher brightness in an image, it is necessary to identify edges of these areas. And selecting a proper antialiasing processing method according to the characteristics of the image and the capability of the terminal equipment. Common antialiasing methods include supersampling antialiasing (SSAA), multisampling antialiasing (MSAA), and the like. For white curves, a suitable method may be selected for processing. And processing the image by the terminal equipment according to the selected antialiasing method. For SSAA methods, the image may be mapped to a buffer and amplified, then sampled and mixed, and finally restored to the original image size. For the MSAA method, antialiasing may be performed only on the edges of the polygon. In the processing process, the terminal equipment can sample pixels near the image for multiple times so as to achieve anti-aliasing effects of different levels. For a white curve, this means that the pixels around the curve will be sampled and mixed to make the curve edges appear smoother. The terminal device may adjust parameters of the antialiasing process, such as sampling rate, mixing weights, etc., as needed. These parameters affect the anti-aliasing effect and the computational cost, and need to be weighed according to the actual situation.
S103, calculating the color value of the color curve graph.
Wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
b1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ], (x, y) represents coordinates of a pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red values, green values and blue values of the pixel point in the color background image respectively, and R1, G1 and B1 represent red values, green values and blue values of the pixel point in the color graph respectively.
The terminal device first reads the image data of the curve gray-scale map (denoted as GRAYIMAGE) and the color background map (denoted as ColorBackground). The Gray value Gray (x, y) of each pixel (x, y) is read from GRAYIMAGE. RGB color values, i.e., R0 (x, y), G0 (x, y), and B0 (x, y), for each pixel point (x, y) are read from ColorBackground.
Calculating a mixing coefficient alpha:
For each pixel point (x, y) in GRAYIMAGE, its Gray value Gray (x, y) is normalized as a coefficient alpha (x, y) of color mixing. alpha (x, y) =gray (x, y)/255, further, in order to reduce the data length and the occupation of the storage space, alpha (x, y) is a single precision floating point number.
Color mixing calculation:
for each pixel (x, y), multiplying the RGB values of the corresponding pixel in alpha (x, y) and ColorBackground, and performing rounding operation to obtain the RGB values of the corresponding pixel in the color graph ColorCurve.
R1(x, y) = int[R0(x, y) * alpha(x, y) + 0.5];G1(x, y) = int[G0(x, y) * alpha(x, y) + 0.5];
B1 (x, y) =int [ B0 (x, y) ×alpha (x, y) +0.5 ]. In some embodiments of the application, the rounding operation may be: the rounding operation includes: any one of rounding, rounding up, and rounding down.
Generating a color curve graph:
a new image (denoted ColorCurve) is created, the same size as GRAYIMAGE and ColorBackground.
Each pixel point (x, y) in GRAYIMAGE is traversed and the R1 (x, y), G1 (x, y) and B1 (x, y) values calculated in step 3 are used to set the color of the corresponding pixel point in ColorCurve. The generated color map ColorCurve is saved as an image file, such as PNG, JPEG, or the like. Meanwhile, the generated color curve graph can be directly displayed on the drawing interface.
In one or more possible embodiments, when a drag operation on a curved gray scale map is detected, the curved gray scale map is displayed in a floating manner;
and when the superposition area between the floating curve gray-scale image and the color background image is larger than the preset area, executing the step of calculating the color value of the color curve graph.
When the terminal equipment displays the curve gray level diagram and the color background diagram, a touch event monitor is started to monitor the dragging operation of a user on the curve gray level diagram. When the user starts dragging the curved gray-scale image, the terminal device responds to the dragging event and floats the curved gray-scale image from the home position (e.g., moves it to a new position using an animation effect). The terminal device continuously monitors the overlapping area between the floating curve gray-scale image and the color background image. This typically involves calculating the intersection area of two graphic areas. The terminal equipment judges whether the calculated overlapping area is larger than a preset threshold area. This threshold can be set according to the actual application scenario to ensure enough overlap to accurately calculate the color profile. If the overlapping area is larger than the preset value, the terminal device will execute the color value calculation process. If the user stops the drag operation, the terminal device responds to the drag end event and may perform subsequent operations such as saving a color graph, resetting a view, and the like.
S104, displaying a color curve graph on the TFT display screen.
The terminal equipment generates a color curve graph according to the calculated R1, G1 and B1 values. And displaying the generated color curve graph on a TFT display screen, and covering or replacing the original curve gray scale graph (or displaying the original curve gray scale graph in a superposition way, depending on application requirements).
The embodiment of the application has the following beneficial effects:
Simplifying the color mixing calculation: the technical scheme simplifies the calculation process of the color values of the color graph by directly using the Gray value (Gray (x, y)) as the alpha transparency value (alpha (x, y)) and dividing the alpha transparency value by 255 for normalization processing. The method avoids complex table look-up operation, improves the calculation efficiency, and particularly can remarkably reduce the calculation resource and time consumption when processing high-resolution images or drawing scenes in real time.
Real-time enhancement: because no table lookup operation is needed, the technical scheme can more quickly respond to the editing instruction of the user, draw a white curve on the black canvas and calculate the color value of the color curve graph in real time. Such real-time enhancement is critical to the user experience, especially in graphic editing or painting applications that require immediate feedback.
Flexibility is improved: by directly calculating the color value of the color curve graph according to the gray value and the RGB value of the color background graph, the technical scheme can flexibly process background images with different colors and brightness. This provides a larger authoring space for users, allowing them to customize the appearance and effect of the color profile as desired.
Optimizing the resource efficiency: the look-up operation typically requires a large number of pre-stored data tables, which may occupy a large amount of memory space. The technical scheme generates the color graph through direct calculation, reduces memory occupation and improves resource utilization efficiency. This is particularly important for internally limited terminal devices, where stability and performance of the application can be ensured.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Referring to fig. 2, a schematic structural diagram of a device for drawing a color curve according to an exemplary embodiment of the present application is shown, which is hereinafter referred to as device 2. The apparatus 2 may be implemented as all or part of a terminal device by software, hardware or a combination of both. The device 2 comprises: a generating unit 201, a converting unit 202, a calculating unit 203, and a pushing unit 204.
A generating unit 201 for generating a black canvas and a color background map; wherein the black canvas and the color background map are the same size;
the conversion unit 202 is configured to draw a white curve in the black canvas based on an editing instruction of a user, and obtain a curve gray scale map after editing is completed;
A calculation unit 203 for calculating a color value of the color chart; wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
B1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ]; (x, y) represents coordinates of the pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red value, green value and blue value of the pixel point in the color background image respectively, and R1, G1 and B1 represent red value, green value and blue value of the pixel point in the color graph respectively;
and a pushing unit 204, configured to display the color graph on a TFT display screen.
In one or more possible embodiments, the generating a black canvas and a color background map includes:
Displaying a drawing interface;
generating a black canvas and a white canvas in the drawing interface;
and generating a color background picture after performing color filling operation in the white canvas.
In one or more possible embodiments, the generating the color background map after performing the color filling operation in the white canvas includes:
dividing the white canvas into a plurality of rectangular areas in the horizontal direction according to preset intervals;
And filling corresponding colors for each rectangular area to obtain a color background image.
In one or more possible embodiments, before calculating the color value of the color profile, the method further includes:
when the dragging operation of the curve gray level diagram is detected, floating and displaying the curve gray level diagram;
and when the superposition area between the floating curve gray-scale image and the color background image is larger than the preset area, executing the step of calculating the color value of the color curve graph.
In one or more possible embodiments, the rounding operation includes: rounding, rounding up, and rounding down.
In one or more possible embodiments, a white curve is drawn in the black canvas based on an editing instruction of a user, and after editing is completed, a curve canvas is obtained, which further includes:
And (5) carrying out antialiasing treatment on the white curve.
In one or more possible embodiments, alpha (x, y) is a single precision floating point number.
It should be noted that, when the apparatus 2 provided in the foregoing embodiment performs the method for drawing a color curve, only the division of the foregoing functional modules is used as an example, and in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the foregoing functions. In addition, the device for drawing a color curve provided in the above embodiment and the method embodiment for drawing a color curve belong to the same concept, which embody the detailed implementation process in the method embodiment, and are not described herein again.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are adapted to be loaded by a processor and execute the steps of the method shown in the embodiment of fig. 2, and the specific execution process may refer to the specific description of the embodiment shown in fig. 2, which is not repeated herein.
The present application also provides a computer program product storing at least one instruction that is loaded and executed by the processor to implement the method of color curve rendering as described in the various embodiments above.
Referring to fig. 3, a schematic structural diagram of a terminal device is provided in an embodiment of the present application. As shown in fig. 3, the terminal device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, at least one communication bus 302.
Wherein the communication bus 302 is used to enable connected communication between these components.
The user interface 303 may include a Display screen (Display), a Camera (Camera), and the optional user interface 303 may further include a standard wired interface, and a wireless interface.
The network interface 304 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Wherein the processor 301 may include one or more processing cores. The processor 301 connects the various parts within the overall terminal device 300 using various interfaces and lines, performs various functions of the terminal device 300 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and invoking data stored in the memory 305. Alternatively, the processor 301 may be implemented in at least one hardware form of digital signal Processing (DIGITAL SIGNAL Processing, DSP), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 301 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 301 and may be implemented by a single chip.
The Memory 305 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). Memory 305 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 305 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-described respective method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. Memory 305 may also optionally be at least one storage device located remotely from the aforementioned processor 301. As shown in fig. 3, an operating system, a network communication module, a user interface module, and application programs may be included in the memory 305, which is a type of computer storage medium.
In the terminal device 300 shown in fig. 3, the user interface 303 is mainly used for providing an input interface for a user, and acquiring data input by the user; the processor 301 may be configured to invoke an application program stored in the memory 305 and specifically execute the method shown in fig. 2, and the specific process may be shown in fig. 2, which is not repeated herein.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, or the like.
The foregoing disclosure is illustrative of the present application and is not to be construed as limiting the scope of the application, which is defined by the appended claims.

Claims (10)

1. A method for drawing a color curve, comprising:
generating a black canvas and a color background diagram; wherein the black canvas and the color background map are the same size;
Drawing a white curve in the black canvas based on an editing instruction of a user, and obtaining a curve gray scale map after editing is completed;
calculating a color value of the color curve graph; wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
B1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ]; (x, y) represents coordinates of the pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red value, green value and blue value of the pixel point in the color background image respectively, and R1, G1 and B1 represent red value, green value and blue value of the pixel point in the color graph respectively;
The color profile is displayed on a TFT display screen.
2. The method of claim 1, wherein the generating a black canvas and a color background map comprises:
Displaying a drawing interface;
generating a black canvas and a white canvas in the drawing interface;
and generating a color background picture after performing color filling operation in the white canvas.
3. The method of claim 2, wherein generating a color background map after performing a color fill operation in the white canvas comprises:
dividing the white canvas into a plurality of rectangular areas in the horizontal direction according to preset intervals;
And filling corresponding colors for each rectangular area to obtain a color background image.
4. A method according to claim 1, 2 or 3, characterized in that before calculating the color values of the color profile, further comprises:
when the dragging operation of the curve gray level diagram is detected, floating and displaying the curve gray level diagram;
and when the superposition area between the floating curve gray-scale image and the color background image is larger than the preset area, executing the step of calculating the color value of the color curve graph.
5. The method of claim 4, wherein the rounding operation comprises: rounding, rounding up, and rounding down.
6. The method of claim 1 or 2 or 3 or 5, wherein white curves are drawn in the black canvas based on editing instructions of a user, and the curve canvas is obtained after editing is completed, further comprising:
And (5) carrying out antialiasing treatment on the white curve.
7. The method of claim 6, wherein alpha (x, y) is a single precision floating point number.
8. A color curve drawing apparatus, comprising:
The generating unit is used for generating a black canvas and a color background image; wherein the black canvas and the color background map are the same size;
The conversion unit is used for drawing a white curve in the black canvas based on an editing instruction of a user, and obtaining a curve gray level diagram after editing is completed;
A calculation unit for calculating a color value of the color chart; wherein alpha (x, y) =gray (x, y)/255;
R1(x,y) = int[R0(x,y)* alpha(x,y) + 0.5];
G1(x,y) = int[G0(x,y) * alpha(x,y)+ 0.5];
B1 (x, y) =int (B0 (x, y) ×alpha (x, y) +0.5 ]; (x, y) represents coordinates of the pixel point, gray (x, y) represents Gray values of the pixel point in the curve Gray scale image, int represents rounding operation, R0, G0 and B0 represent red value, green value and blue value of the pixel point in the color background image respectively, and R1, G1 and B1 represent red value, green value and blue value of the pixel point in the color graph respectively;
and the pushing unit is used for displaying the color curve graph on the TFT display screen.
9. A computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method steps of any one of claims 1 to 7.
10. A terminal device, comprising: the device comprises a processor, a memory and a TFT display screen; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1-7.
CN202410771262.1A 2024-06-14 2024-06-14 Method and device for drawing color curve, storage medium and terminal equipment Pending CN118470152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410771262.1A CN118470152A (en) 2024-06-14 2024-06-14 Method and device for drawing color curve, storage medium and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410771262.1A CN118470152A (en) 2024-06-14 2024-06-14 Method and device for drawing color curve, storage medium and terminal equipment

Publications (1)

Publication Number Publication Date
CN118470152A true CN118470152A (en) 2024-08-09

Family

ID=92169799

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410771262.1A Pending CN118470152A (en) 2024-06-14 2024-06-14 Method and device for drawing color curve, storage medium and terminal equipment

Country Status (1)

Country Link
CN (1) CN118470152A (en)

Similar Documents

Publication Publication Date Title
TWI602148B (en) Gradient adjustment for texture mapping to non-orthonormal grid
EP3259753B1 (en) Systems and methods for reducing memory bandwidth using low quality tiles
US20240394954A1 (en) Terrain image rendering methods and systems
CN112231020B (en) Model switching method and device, electronic equipment and storage medium
CN111476851A (en) Image processing method, image processing device, electronic equipment and storage medium
US10783696B2 (en) Gradient adjustment for texture mapping to non-orthonormal grid
CN111784814B (en) Virtual character skin adjustment method and device
US11069020B2 (en) Graphics processing using multiple primitives
US9111328B2 (en) Texture compression and decompression
EP3563352B1 (en) Indexed value blending for use in image rendering
KR20040011525A (en) Drawing method
CN111314770B (en) In-game list display method and device and terminal equipment
CN117611703A (en) Barrage character rendering method, barrage character rendering device, barrage character rendering equipment, storage medium and program product
CN118470152A (en) Method and device for drawing color curve, storage medium and terminal equipment
CN110502305B (en) Method and device for realizing dynamic interface and related equipment
EP2992512B1 (en) Anti-aliasing for geometries
CN117115299A (en) Display information processing method and device, storage medium and electronic device
US6731297B1 (en) Multiple texture compositing
CN115131481B (en) GPU rendering efficiency determination method, model building method, device, medium and equipment
CN115035231A (en) Shadow baking method, shadow baking device, electronic apparatus, and storage medium
JP3701627B2 (en) Drawing processing program, recording medium storing drawing processing program, drawing processing apparatus and method
CN114582301B (en) Information display method and device, electronic equipment and storage medium
JP2023045392A (en) Image data generation apparatus, image data generation method, and image data generation program
CN117197327A (en) Scene resource loading method, device, equipment and medium
KR100927131B1 (en) Anti-aliasing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination