CN110539639A - Instrument-based gradual change circular ring display method, medium, instrument and device - Google Patents

Instrument-based gradual change circular ring display method, medium, instrument and device Download PDF

Info

Publication number
CN110539639A
CN110539639A CN201910801850.4A CN201910801850A CN110539639A CN 110539639 A CN110539639 A CN 110539639A CN 201910801850 A CN201910801850 A CN 201910801850A CN 110539639 A CN110539639 A CN 110539639A
Authority
CN
China
Prior art keywords
processed
pixel point
angle
calculating
ring
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.)
Granted
Application number
CN201910801850.4A
Other languages
Chinese (zh)
Other versions
CN110539639B (en
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.)
South Sagittarius Integration Co Ltd
Original Assignee
South Sagittarius Integration 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 South Sagittarius Integration Co Ltd filed Critical South Sagittarius Integration Co Ltd
Priority to CN201910801850.4A priority Critical patent/CN110539639B/en
Publication of CN110539639A publication Critical patent/CN110539639A/en
Application granted granted Critical
Publication of CN110539639B publication Critical patent/CN110539639B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B60VEHICLES IN GENERAL
    • B60KARRANGEMENT OR MOUNTING OF PROPULSION UNITS OR OF TRANSMISSIONS IN VEHICLES; ARRANGEMENT OR MOUNTING OF PLURAL DIVERSE PRIME-MOVERS IN VEHICLES; AUXILIARY DRIVES FOR VEHICLES; INSTRUMENTATION OR DASHBOARDS FOR VEHICLES; ARRANGEMENTS IN CONNECTION WITH COOLING, AIR INTAKE, GAS EXHAUST OR FUEL SUPPLY OF PROPULSION UNITS IN VEHICLES
    • B60K35/00Instruments specially adapted for vehicles; Arrangement of instruments in or on vehicles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/147Digital output to display device ; Cooperation and interconnection of the display device with other functional units using display panels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Chemical & Material Sciences (AREA)
  • Combustion & Propulsion (AREA)
  • Transportation (AREA)
  • Mechanical Engineering (AREA)
  • Image Generation (AREA)

Abstract

the invention relates to a gradual change circular ring display method, medium, instrument and device based on instrument, wherein the method comprises the following steps: acquiring a to-be-processed ring and a preset initial pixel point of the to-be-processed ring, and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point; calculating the target transparency of the pixel points to be processed according to the deflection angle; adjusting the transparency of the pixel points to be processed into a target transparency to obtain and display a target gradual change circular ring; a computer program stored on a medium for executing the above method steps; the meter comprises the storage medium and a processor, and the processor realizes the steps of the method when executing the computer program on the storage medium. According to the invention, through some specific algorithms, the gradual change circular ring is displayed in the instrument, so that the requirement of a user on the display effect of the liquid crystal instrument is met, and the visual experience of the user is improved. And the used resources are less, the system expense is greatly reduced, and the smooth operation of the whole software can be ensured.

Description

Instrument-based gradual change circular ring display method, medium, instrument and device
Technical Field
The invention relates to the technical field of vehicle-mounted instruments, in particular to a gradual change circular ring display method, medium, instrument and device based on an instrument.
background
At present, vehicle-mounted instruments in the automobile industry enter a full liquid crystal product state. Automobile instruments are an important part of the whole system of an automobile, and are one of important directions for improving the comprehensive performance of the automobile, and automobile manufacturers and users have higher and higher requirements on the automobile instruments. The Liquid Crystal Display (LCD) is adopted in the full Liquid Crystal instrument to replace a traditional pointer instrument panel of the stepping motor, and the full Liquid Crystal instrument has the advantages of rich Display phenomena, attractive and gorgeous interface, high Display sensitivity and high precision. The requirements of new liquid crystal instrument products on graphical interfaces become higher and higher, and users put forward more requirements on graphical effects, such as the realization of a gradual change circular ring effect.
the technical scheme adopted in the aspect of realizing the gradual change circular ring effect of the instrument at present comprises the following steps:
1. the pure-color ring is directly used without adopting a gradual change effect;
2. The method is realized by using a fan-shaped color transformation effect provided by a general graphics Software Development Kit (SDK);
3. providing a resource picture with a gradual change effect by a User Interface (UI) designer, and matching other shielded pictures with the resource picture to display the gradual change effect;
however, the above technical solution has the following drawbacks:
1. The first technical scheme is as follows: the user requirements are not met, and the implementation conditions are reduced;
2. the second technical scheme is as follows: a large amount of system resources of a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU) are consumed, so that the operation is blocked, and the display effect of other instruments is influenced;
3. The third technical scheme is as follows: in the process that the circular ring changes along with the numerical value, the effect is not real enough, the visual feeling is poor, and the circular ring needs to be matched with other picture resources for shielding, so that the consumption of system resources is increased, and the performance of the whole software is reduced.
disclosure of Invention
the invention aims to solve the technical problem of the prior art and provides a gradual change circular ring display method, medium, instrument and device based on the instrument.
The technical scheme for solving the technical problems is as follows: a gradual change circular ring display method based on an instrument comprises the following steps: acquiring a to-be-processed ring, wherein the to-be-processed ring comprises a plurality of to-be-processed pixel points;
Acquiring a preset initial pixel point of the to-be-processed circular ring, and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point;
Calculating the target transparency of the pixel points to be processed according to the deflection angle;
And adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
The effect of the method in the embodiment of the invention comprises the following steps: the development environment of the SDK of Qt is utilized, the open graphics library technology of OpenGL is combined, the gradual change circular ring effect of the liquid crystal instrument is achieved through some targeted algorithms, the used resources are few, the gradual change circular ring effect is achieved mainly by means of a software algorithm, the system expenditure is greatly reduced, and the smooth operation of the whole software can be guaranteed.
On the basis of the technical scheme, the invention can be further improved as follows:
further, the specific implementation of obtaining the preset initial pixel point of the to-be-processed ring and calculating the deflection angle of the to-be-processed pixel point relative to the preset initial pixel point is as follows:
Acquiring a preset initial pixel point of the to-be-processed ring;
Calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis, and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis;
And taking the difference value of the second angle and the first angle as the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
The effect of the method in the embodiment of the invention comprises the following steps: in this embodiment, a first angle between the radius of the preset starting pixel point and the horizontal coordinate axis and a second angle between the radius of the to-be-processed pixel point and the horizontal coordinate axis are calculated according to the coordinates of the points and an arc tangent function formula, so that a deflection angle of the to-be-processed pixel point relative to the preset starting pixel point is quickly calculated, and the display rate of the gradual change ring is improved.
further, the specific implementation of calculating the first angle between the radius of the preset starting pixel point and the horizontal coordinate axis and calculating the second angle between the radius of the pixel point to be processed and the horizontal coordinate axis is as follows:
acquiring the starting point coordinates of the preset starting pixel points, the pixel point coordinates of the pixel points to be processed and the circle center coordinates of the circular ring to be processed;
calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis according to the initial point coordinate and the circle center coordinate;
and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis according to the pixel point coordinate and the circle center coordinate.
The effect of the method in the embodiment of the invention comprises the following steps: and calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis and a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis in real time through a trigonometric function, thereby quickly calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point and improving the calculation efficiency.
Further, the specific implementation of calculating the target transparency of the pixel point to be processed according to the deflection angle is as follows:
acquiring a preset termination pixel point, and taking a to-be-processed ring between the radius of the preset initial pixel point and the radius of the preset termination pixel point as a display area;
And judging whether the pixel points to be processed are in the display area or not, and calculating the target transparency of the pixel points to be processed according to the judgment result.
the effect of the method in the embodiment of the invention comprises the following steps: the processing efficiency of the pixel points in the non-display area is improved by dividing the to-be-processed circular ring into the display area and the non-display area.
Further, the specific implementation of determining whether the pixel point to be processed is located in the display area is as follows:
Acquiring the coordinates of a termination point of the preset termination pixel point;
calculating a third angle between the radius of the preset termination pixel point and the horizontal coordinate axis according to the termination point coordinate and the circle center coordinate;
and judging whether the pixel point to be processed is in the display area according to the first angle, the second angle and the third angle.
the effect of the method in the embodiment of the invention comprises the following steps: whether the pixel point to be processed is in the display area is determined by judging whether the second angle is located in the first angle and the third angle, so that the judging speed and the judging accuracy are improved.
Further, the specific implementation of calculating the target transparency of the pixel point to be processed according to the judgment result is as follows:
if the judgment result is that the pixel point to be processed is not in the display area, setting the target transparency of the pixel point to be processed as a preset upper limit;
and if the judgment result is that the pixel point to be processed is in the display area, taking the difference value of the third angle and the first angle as a display angle corresponding to the display area, calculating a quotient of the deflection angle and the display angle, and taking the percentage of the quotient as the target transparency of the pixel point to be processed.
The effect of the method in the embodiment of the invention comprises the following steps: the quotient of the deflection angle and the display angle is used as the target transparency of the pixel point to be processed, so that the correlation between the deflection angle of the pixel point to be processed and the target transparency is accurately measured, and the gradual change effect of the gradual change ring is improved.
Further, before the obtaining of the to-be-processed ring, the method for displaying a graduated ring based on an instrument further includes:
Creating a vertex shader and a fragment shader in an open graphics library;
The specific implementation of acquiring the preset initial pixel point of the to-be-processed ring and calculating the deflection angle of the to-be-processed pixel point relative to the preset initial pixel point is as follows:
Acquiring a preset initial pixel point of the to-be-processed ring through the vertex shader;
and calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point through the fragment shader.
The effect of the method in the embodiment of the invention comprises the following steps: and performing matrix transformation on input data through the vertex shader, calculating coordinates and sending the coordinates and other parameters to the fragment shader, so that the fragment shader calculates the target transparency of each pixel to be processed, and different transparencies are set for each pixel to be processed, thereby realizing the effect of a gradual change ring.
The invention also provides a computer-readable storage medium having stored thereon a computer program for executing the above-mentioned method when executed by a processor.
the invention also provides a meter terminal which comprises the storage medium and a processor, wherein the processor realizes the steps of the method when executing the computer program on the storage medium.
the invention also provides a gradual change ring display device based on the instrument, which comprises:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a to-be-processed circular ring which comprises a plurality of to-be-processed pixel points;
the angle calculation module is used for acquiring a preset initial pixel point of the to-be-processed circular ring and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point;
the transparency calculation module is used for calculating the target transparency of the pixel points to be processed according to the deflection angle;
and the display module is used for adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
The effect of the device in the embodiment of the invention comprises the following steps: the development environment of the SDK of Qt is utilized, the open graphics library technology of OpenGL is combined, the gradual change circular ring effect of the liquid crystal instrument is achieved through some targeted algorithms, the used resources are few, the gradual change circular ring effect is achieved mainly by means of a software algorithm, the system expenditure is greatly reduced, and the smooth operation of the whole software can be guaranteed.
On the basis of the technical scheme, the invention can be further improved as follows:
further, the angle calculation module includes:
the acquisition submodule is used for acquiring a preset initial pixel point of the to-be-processed ring;
The first angle calculation module is used for calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis;
and the second angle calculation module is used for taking the difference value between the second angle and the first angle as the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
The effect of the device in the embodiment of the invention comprises the following steps: in this embodiment, a first angle between the radius of the preset starting pixel point and the horizontal coordinate axis and a second angle between the radius of the to-be-processed pixel point and the horizontal coordinate axis are calculated according to the coordinates of the points and an arc tangent function formula, so that a deflection angle of the to-be-processed pixel point relative to the preset starting pixel point is quickly calculated, and the display rate of the gradual change ring is improved.
Further, the first angle calculating module includes:
The first obtaining submodule is used for obtaining the starting point coordinates of the preset starting pixel points, the pixel point coordinates of the pixel points to be processed and the circle center coordinates of the circular ring to be processed;
The first angle meter operator module is used for calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis according to the initial point coordinate and the circle center coordinate;
And the second angle calculation submodule is used for calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis according to the pixel point coordinate and the circle center coordinate.
the effect of the device in the embodiment of the invention comprises the following steps: and calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis and a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis in real time through a trigonometric function, thereby quickly calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point and improving the calculation efficiency.
further, the transparency calculation module includes:
the second acquisition submodule is used for acquiring a preset termination pixel point and taking a to-be-processed circular ring between the radius of the preset starting pixel point and the radius of the preset termination pixel point as a display area;
And the judging module is used for judging whether the pixel points to be processed are positioned in the display area or not and calculating the target transparency of the pixel points to be processed according to the judging result.
The effect of the device in the embodiment of the invention comprises the following steps: the processing efficiency of the pixel points in the non-display area is improved by dividing the to-be-processed circular ring into the display area and the non-display area.
Further, the judging module includes:
the first judgment submodule is used for acquiring the coordinates of the termination point of the preset termination pixel point; calculating a third angle between the radius of the preset termination pixel point and the horizontal coordinate axis according to the termination point coordinate and the circle center coordinate; and judging whether the pixel point to be processed is in the display area according to the first angle, the second angle and the third angle.
The effect of the device in the embodiment of the invention comprises the following steps: whether the pixel point to be processed is in the display area is determined by judging whether the second angle is located in the first angle and the third angle, so that the judging speed and the judging accuracy are improved.
Further, the judging module includes:
The second judgment submodule is used for setting the target transparency of the pixel point to be processed as a preset upper limit if the judgment result is that the pixel point to be processed is not in the display area; and if the judgment result is that the pixel point to be processed is in the display area, taking the difference value of the third angle and the first angle as a display angle corresponding to the display area, calculating a quotient of the deflection angle and the display angle, and taking the percentage of the quotient as the target transparency of the pixel point to be processed.
the effect of the device in the embodiment of the invention comprises the following steps: the quotient of the deflection angle and the display angle is used as the target transparency of the pixel point to be processed, so that the correlation between the deflection angle of the pixel point to be processed and the target transparency is accurately measured, and the gradual change effect of the gradual change ring is improved.
Further, the above-mentioned gradual change ring display device based on instrument still includes:
the shader creation module is used for creating a vertex shader and a fragment shader in the open graphics library;
the angle calculation module is further configured to obtain a preset starting pixel point of the to-be-processed ring through the vertex shader; and calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point through the fragment shader.
the effect of the device in the embodiment of the invention comprises the following steps: and performing matrix transformation on input data through the vertex shader, calculating coordinates and sending the coordinates and other parameters to the fragment shader, so that the fragment shader calculates the target transparency of each pixel to be processed, and different transparencies are set for each pixel to be processed, thereby realizing the effect of a gradual change ring.
Drawings
FIG. 1 is a flowchart illustrating a method for displaying a graduated ring based on a gauge according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for displaying a graduated ring based on a meter according to a second embodiment of the present invention;
FIG. 3 is a schematic view illustrating angle calculation according to a second embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for displaying a graduated ring based on a meter according to a third embodiment of the present invention;
fig. 5 is a block diagram of a gradual change annular display device based on a meter according to an embodiment of the present invention.
Detailed Description
the principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
as shown in fig. 1, a gradual change ring display method based on a meter is applied to a meter terminal, and the method includes:
S10: and acquiring a to-be-processed ring, wherein the to-be-processed ring comprises a plurality of to-be-processed pixel points.
the application scenario of this embodiment is an SDK development environment based on Qt, and an Open Graphics Library (OpenGL) is used to achieve a gradual change ring effect. Specifically, a QML (QML) application environment is used as a substitute for a C + + Language to realize rapid development of graphical interface software, so that a gradient ring is quickly rendered.
the to-be-processed ring is a ring picture, wherein all parts except the ring part are set to be fully transparent, pixel points of the ring part are used as to-be-processed pixel points, and the to-be-processed pixel points are all preset colors. In order to display a ring with a preset color as a gradient ring, before acquiring a ring to be processed, a vertex shader and a fragment shader are created in an open graphics library, so that the vertex shader performs matrix transformation on input data, coordinates are calculated, and parameters such as the coordinates are sent to the fragment shader, so that the fragment shader calculates the target transparency of each pixel point to be processed, different transparencies are set for each pixel point to be processed, and the effect of the gradient ring is realized.
in the specific implementation, a ring material file is read and written into a memory, a ring to be processed and the width and height of the ring to be processed are read from the ring material file, and the circle center coordinate of the ring to be processed is determined according to the width and height of the ring to be processed, so that the position of a pixel point to be processed in the ring to be processed is determined according to the coordinate and the circle center coordinate of the pixel point to be processed.
s20: and acquiring a preset initial pixel point of the to-be-processed ring, and calculating the deflection angle of the to-be-processed pixel point relative to the preset initial pixel point.
In general, a user does not require a gradual change circular ring meter of the whole circumference, but only needs a gradual change sector ring meter, for example, a 180 ° gradual change sector ring with a negative half axis of a horizontal coordinate axis as a starting point and a positive half axis of the horizontal coordinate axis as a terminal point, so the present embodiment sets a preset starting pixel point and a preset ending pixel point according to the user requirement to define the display area of the gradual change effect.
In this embodiment, the preset starting pixel points and the preset stopping pixel points are pixel points on the inner circle of the to-be-processed ring, the to-be-processed ring between the radius of the preset starting pixel points and the radius of the preset stopping pixel points is used as a display area, and the to-be-processed ring outside the display area is used as a non-display area. And setting the to-be-processed pixel points in the non-display area to be fully transparent, and setting the to-be-processed pixel points in the display area to be gradually changed in transparency, so that the gradual change effect of the display area is realized.
in order to realize the gradual change effect of the display area, the target transparency of the pixel point to be processed is calculated according to the position of the pixel point to be processed in the display area, and in order to obtain the position of the pixel point to be processed in the display area, a preset starting pixel point of the circular ring to be processed is obtained through the vertex shader, and the deflection angle of the pixel point to be processed relative to the preset starting pixel point is calculated through the fragment shader. The deflection angle is a rotation angle between the to-be-processed pixel point and the preset initial pixel point by taking the circle center of the to-be-processed ring as a rotation center, and the deflection angle can represent the position distribution of the to-be-processed pixel point in the display area.
S30: and calculating the target transparency of the pixel points to be processed according to the deflection angle.
When the color of the pixel points to be processed is gradually lightened from left to right according to the user requirement, the transparency of the pixel points to be processed is gradually increased along with the increase of the deflection angle, namely the deflection angle is in positive correlation with the transparency, and the target transparency of the pixel points to be processed is calculated according to a preset positive correlation formula and the deflection angle of the pixel points to be processed. And when the color of the pixel points to be processed is required to be gradually deepened from left to right, gradually reducing the transparency of the pixel points to be processed along with the increase of the deflection angle, namely the deflection angle is in negative correlation with the transparency, and calculating the target transparency of the pixel points to be processed according to a preset negative correlation formula and the deflection angle of the pixel points to be processed.
s40: and adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
after the target transparency of each pixel point to be processed is obtained through calculation, the transparency of the pixel point to be processed is adjusted to be the corresponding target transparency, and the target transparency is related to the deflection angle of the pixel point to be processed, so that the transparency of the pixel point to be processed is gradually changed along with the increase of the deflection angle, a target gradual change ring is obtained, the target gradual change ring is displayed, the requirement of a user on the display effect of a liquid crystal instrument is met, and the visual experience of the user is improved. In the embodiment, the development environment of the SDK of the Qt is utilized, the open graphics library technology of OpenGL is combined, the gradual change circular ring effect of the liquid crystal instrument is realized through some targeted algorithms, the used resources are less, the gradual change circular ring effect is realized mainly by means of a software algorithm, the system expenditure is greatly reduced, and the smooth operation of the whole software can be ensured. And the scheme is independently researched and developed, so that the project cost is reduced, and the need of purchasing a third-party solution is eliminated.
as shown in fig. 2, in the second embodiment provided by the present invention, the specific implementation of S20 is as follows:
s201: acquiring a preset initial pixel point of the to-be-processed ring;
S202: calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis, and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis;
And clockwise rotating by taking the circle center of the circular ring to be processed as a coordinate origin and taking the negative half axis of the horizontal coordinate axis as an angle of 0 degree to obtain a first angle between the radius of the preset initial pixel point and the horizontal coordinate axis and a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis, wherein the difference value obtained by subtracting the first angle from the second angle is the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
the specific implementation of S202 is:
acquiring the starting point coordinates of the preset starting pixel points, the pixel point coordinates of the pixel points to be processed and the circle center coordinates of the circular ring to be processed;
Calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis according to the initial point coordinate and the circle center coordinate;
and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis according to the pixel point coordinate and the circle center coordinate.
as shown in fig. 3, a perpendicular line is drawn from the preset start pixel point to the horizontal coordinate axis, the perpendicular line, the horizontal coordinate axis, a connection line between the preset start pixel point and the center of a circle form a right triangle, in the right triangle, the lengths of the two right-angled sides can be calculated according to the start point coordinates (x, y) and the center coordinates (x0, y0), and the first angle α between the radius of the preset start pixel point and the horizontal coordinate axis can be calculated according to the lengths of the two right-angled sides and an arctangent function formula. And calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis and a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis in real time through a trigonometric function, thereby quickly calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point and improving the calculation efficiency.
similarly, a perpendicular line is drawn from the pixel point to be processed to the horizontal coordinate axis, the perpendicular line, the horizontal coordinate axis, the pixel point to be processed and a line connecting the circle center form a right triangle, the length of the two right-angle sides can be calculated according to the starting point coordinate and the circle center coordinate in the right triangle, and the second angle between the radius of the pixel point to be processed and the horizontal coordinate axis can be calculated according to the length of the two right-angle sides and an arctangent function formula.
S203: and taking the difference value of the second angle and the first angle as the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
In this embodiment, a first angle between the radius of the preset starting pixel point and the horizontal coordinate axis and a second angle between the radius of the to-be-processed pixel point and the horizontal coordinate axis are calculated according to the coordinates of the points and an arc tangent function formula, so that a deflection angle of the to-be-processed pixel point relative to the preset starting pixel point is quickly calculated, and the display rate of the gradual change ring is improved.
As shown in fig. 4, in the third embodiment provided by the present invention, the specific implementation of S30 is as follows:
S301: and acquiring a preset termination pixel point, and taking a to-be-processed ring between the radius of the preset initial pixel point and the radius of the preset termination pixel point as a display area.
in general, a user does not require a gradual change ring meter of the whole circumference, but only needs a half gradual change ring meter, so in this embodiment, a preset start pixel point and a preset stop pixel point are set according to the user requirement, a to-be-processed ring between the radius of the preset start pixel point and the radius of the preset stop pixel point is defined as a display area with gradual change effect, and the to-be-processed ring outside the display area is used as a non-display area.
s302: and judging whether the pixel points to be processed are in the display area or not, and calculating the target transparency of the pixel points to be processed according to the judgment result.
In a specific implementation, whether the pixel point to be processed is in the display area or not is judged, and the target transparency of the pixel point to be processed is calculated according to the judgment result. And setting the transparency of the pixel points to be processed in the non-display area as a preset upper limit, and setting the gradient transparency of the pixel points to be processed in the display area, so that the gradient effect of the display area is realized. The processing efficiency of the pixel points in the non-display area is improved by dividing the to-be-processed circular ring into the display area and the non-display area.
further, the specific implementation of determining whether the pixel point to be processed is located in the display area is as follows:
Acquiring the coordinates of a termination point of the preset termination pixel point;
Calculating a third angle between the radius of the preset termination pixel point and the horizontal coordinate axis according to the termination point coordinate and the circle center coordinate;
And judging whether the pixel point to be processed is in the display area according to the first angle, the second angle and the third angle.
The radius of the preset starting pixel point and the radius of the preset stopping pixel point limit the range of the display area, and the display angle range corresponding to the display area is from a first angle between the radius of the preset starting pixel point and the horizontal coordinate axis to a third angle between the radius of the preset stopping pixel point and the horizontal coordinate axis. Therefore, in this embodiment, whether the pixel point to be processed is in the display area is determined by determining whether the second angle is located in the first angle and the third angle, so that the determination speed and accuracy are improved.
further, the specific implementation of calculating the target transparency of the pixel point to be processed according to the judgment result is as follows:
If the judgment result is that the pixel point to be processed is not in the display area, setting the target transparency of the pixel point to be processed as a preset upper limit;
and if the judgment result is that the pixel point to be processed is in the display area, taking the difference value of the third angle and the first angle as a display angle corresponding to the display area, calculating a quotient of the deflection angle and the display angle, and taking the percentage of the quotient as the target transparency of the pixel point to be processed.
the preset upper limit is a maximum value of transparency, for example, 100%, and when the pixel point to be processed is not located in the display region, it is indicated that the pixel point to be processed is located in a non-display region, and the pixel point to be processed does not need to be displayed, so that the target transparency of the pixel point to be processed is set as the preset upper limit, so that the pixel point to be processed is invisible to a user. For example, a semicircular ring obtained by taking the upper side of the horizontal axis as a display area and the lower side of the horizontal axis as a non-display area has a more concentrated visual effect compared with the whole circular ring, and can achieve better user experience.
when the pixel point to be processed is located in the display region, the transparency gradually decreases or gradually increases within a certain range from the preset starting pixel point to the preset ending pixel point, for example, the transparency gradually increases within a range of 20% to 90%. In the embodiment, the quotient of the deflection angle and the display angle is used as the target transparency of the pixel point to be processed, so that the correlation between the deflection angle of the pixel point to be processed and the target transparency is accurately measured, and the gradual change effect of the gradual change ring is improved.
The invention also provides a computer-readable storage medium having stored thereon a computer program for executing the above-mentioned method when executed by a processor.
the invention also provides a meter terminal which comprises the storage medium and a processor, wherein the processor realizes the steps of the method when executing the computer program on the storage medium.
as shown in fig. 5, the present invention further provides a gradual change ring display device based on a meter, which includes:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a to-be-processed circular ring which comprises a plurality of to-be-processed pixel points;
The angle calculation module is used for acquiring a preset initial pixel point of the to-be-processed circular ring and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point;
The transparency calculation module is used for calculating the target transparency of the pixel points to be processed according to the deflection angle;
And the display module is used for adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
the development environment of the SDK of Qt is utilized, the open graphics library technology of OpenGL is combined, the gradual change circular ring effect of the liquid crystal instrument is achieved through some targeted algorithms, the used resources are few, the gradual change circular ring effect is achieved mainly by means of a software algorithm, the system expenditure is greatly reduced, and the smooth operation of the whole software can be guaranteed.
in one or more embodiments provided herein, the angle calculation module includes:
the acquisition submodule is used for acquiring a preset initial pixel point of the to-be-processed ring;
The first angle calculation module is used for calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis;
and the second angle calculation module is used for taking the difference value between the second angle and the first angle as the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
In one or more embodiments of the present invention, the first angle calculating module includes:
The first obtaining submodule is used for obtaining the starting point coordinates of the preset starting pixel points, the pixel point coordinates of the pixel points to be processed and the circle center coordinates of the circular ring to be processed;
the first angle meter operator module is used for calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis according to the initial point coordinate and the circle center coordinate;
and the second angle calculation submodule is used for calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis according to the pixel point coordinate and the circle center coordinate.
In one or more embodiments provided by the present invention, the transparency calculation module includes:
The second acquisition submodule is used for acquiring a preset termination pixel point and taking a to-be-processed circular ring between the radius of the preset starting pixel point and the radius of the preset termination pixel point as a display area;
And the judging module is used for judging whether the pixel points to be processed are positioned in the display area or not and calculating the target transparency of the pixel points to be processed according to the judging result.
In one or more embodiments provided in the present invention, the determining module includes:
The first judgment submodule is used for acquiring the coordinates of the termination point of the preset termination pixel point; calculating a third angle between the radius of the preset termination pixel point and the horizontal coordinate axis according to the termination point coordinate and the circle center coordinate; and judging whether the pixel point to be processed is in the display area according to the first angle, the second angle and the third angle.
in one or more embodiments provided in the present invention, the determining module includes:
the second judgment submodule is used for setting the target transparency of the pixel point to be processed as a preset upper limit if the judgment result is that the pixel point to be processed is not in the display area; and if the judgment result is that the pixel point to be processed is in the display area, taking the difference value of the third angle and the first angle as a display angle corresponding to the display area, calculating a quotient of the deflection angle and the display angle, and taking the percentage of the quotient as the target transparency of the pixel point to be processed.
In one or more embodiments of the present invention, the above-mentioned gauge-based graduated ring display device further includes:
the shader creation module is used for creating a vertex shader and a fragment shader in the open graphics library;
The angle calculation module is further configured to obtain a preset starting pixel point of the to-be-processed ring through the vertex shader; and calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point through the fragment shader.
it is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
in addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
the integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
while the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

Claims (10)

1. a gradual change ring display method based on an instrument is characterized by comprising the following steps:
Acquiring a to-be-processed ring, wherein the to-be-processed ring comprises a plurality of to-be-processed pixel points;
Acquiring a preset initial pixel point of the to-be-processed circular ring, and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point;
Calculating the target transparency of the pixel points to be processed according to the deflection angle;
And adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
2. The method for displaying a graduated ring based on an instrument according to claim 1, wherein the specific implementation of obtaining the preset initial pixel point of the to-be-processed ring and calculating the deflection angle of the to-be-processed pixel point relative to the preset initial pixel point is as follows:
Acquiring a preset initial pixel point of the to-be-processed ring;
calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis, and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis;
And taking the difference value of the second angle and the first angle as the deflection angle of the pixel point to be processed relative to the preset initial pixel point.
3. The instrument-based gradual change ring display method of claim 2, wherein the specific implementation of calculating the first angle between the radius of the preset starting pixel point and the horizontal coordinate axis and calculating the second angle between the radius of the pixel point to be processed and the horizontal coordinate axis is as follows:
acquiring the starting point coordinates of the preset starting pixel points, the pixel point coordinates of the pixel points to be processed and the circle center coordinates of the circular ring to be processed;
Calculating a first angle between the radius of the preset initial pixel point and a horizontal coordinate axis according to the initial point coordinate and the circle center coordinate;
and calculating a second angle between the radius of the pixel point to be processed and the horizontal coordinate axis according to the pixel point coordinate and the circle center coordinate.
4. the instrument-based gradual change ring display method according to claim 3, wherein the specific implementation of calculating the target transparency of the pixel point to be processed according to the deflection angle is as follows:
Acquiring a preset termination pixel point, and taking a to-be-processed ring between the radius of the preset initial pixel point and the radius of the preset termination pixel point as a display area;
And judging whether the pixel points to be processed are in the display area or not, and calculating the target transparency of the pixel points to be processed according to the judgment result.
5. The instrument-based gradual-change circular ring display method according to claim 4, wherein the specific implementation of the determining whether the pixel point to be processed is located in the display area is as follows:
acquiring the coordinates of a termination point of the preset termination pixel point;
Calculating a third angle between the radius of the preset termination pixel point and the horizontal coordinate axis according to the termination point coordinate and the circle center coordinate;
and judging whether the pixel point to be processed is in the display area according to the first angle, the second angle and the third angle.
6. The method for displaying a gradually-changing ring based on an instrument according to claim 5, wherein the specific implementation of calculating the target transparency of the pixel point to be processed according to the judgment result is as follows:
if the judgment result is that the pixel point to be processed is not in the display area, setting the target transparency of the pixel point to be processed as a preset upper limit;
and if the judgment result is that the pixel point to be processed is in the display area, taking the difference value of the third angle and the first angle as a display angle corresponding to the display area, calculating a quotient of the deflection angle and the display angle, and taking the percentage of the quotient as the target transparency of the pixel point to be processed.
7. the method of claim 1, wherein prior to obtaining the ring to be processed, the method further comprises:
creating a vertex shader and a fragment shader in an open graphics library;
The specific implementation of acquiring the preset initial pixel point of the to-be-processed ring and calculating the deflection angle of the to-be-processed pixel point relative to the preset initial pixel point is as follows:
acquiring a preset initial pixel point of the to-be-processed ring through the vertex shader;
and calculating the deflection angle of the pixel point to be processed relative to the preset initial pixel point through the fragment shader.
8. a computer-readable storage medium, having stored thereon a computer program for performing, when executed by a processor, the method of any one of claims 1-9.
9. A meter terminal comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein: the processor, when executing the computer program, realizes the steps of the method according to any of claims 1 to 9.
10. a gradual change ring display device based on instrument, characterized by that includes:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a to-be-processed circular ring which comprises a plurality of to-be-processed pixel points;
The angle calculation module is used for acquiring a preset initial pixel point of the to-be-processed circular ring and calculating a deflection angle of the to-be-processed pixel point relative to the preset initial pixel point;
the transparency calculation module is used for calculating the target transparency of the pixel points to be processed according to the deflection angle;
and the display module is used for adjusting the transparency of the pixel points to be processed into the target transparency so as to obtain and display a target gradual change circular ring.
CN201910801850.4A 2019-08-28 2019-08-28 Instrument-based gradual change circular ring display method, medium, instrument and device Active CN110539639B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910801850.4A CN110539639B (en) 2019-08-28 2019-08-28 Instrument-based gradual change circular ring display method, medium, instrument and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910801850.4A CN110539639B (en) 2019-08-28 2019-08-28 Instrument-based gradual change circular ring display method, medium, instrument and device

Publications (2)

Publication Number Publication Date
CN110539639A true CN110539639A (en) 2019-12-06
CN110539639B CN110539639B (en) 2020-12-01

Family

ID=68710916

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910801850.4A Active CN110539639B (en) 2019-08-28 2019-08-28 Instrument-based gradual change circular ring display method, medium, instrument and device

Country Status (1)

Country Link
CN (1) CN110539639B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112109549A (en) * 2020-08-25 2020-12-22 惠州华阳通用电子有限公司 Instrument display method and system
CN114756316A (en) * 2022-03-29 2022-07-15 南斗六星系统集成有限公司 Expression interaction display method, medium, instrument and device based on liquid crystal screen
CN116664734A (en) * 2022-10-19 2023-08-29 荣耀终端有限公司 Method for displaying ring chart, electronic device and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080238818A1 (en) * 2007-03-27 2008-10-02 Denso Corporation Display device
CN104992412A (en) * 2015-06-10 2015-10-21 北京金山安全软件有限公司 Picture gradual change method and device
CN105427258A (en) * 2015-11-25 2016-03-23 惠州Tcl移动通信有限公司 Optimization processing method and system for smooth display of circular patterns as well as intelligent equipment
JP2016078495A (en) * 2014-10-10 2016-05-16 矢崎総業株式会社 Vehicular display device
CN107154063A (en) * 2017-04-19 2017-09-12 腾讯科技(深圳)有限公司 The shape method to set up and device in image shows region
CN109130855A (en) * 2018-08-03 2019-01-04 浙江中科领航汽车电子有限公司 A kind of householder method, system and the device of liquid crystal instrument display elements fade effect
CN109964101A (en) * 2016-11-08 2019-07-02 株式会社电装 Display apparatus

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080238818A1 (en) * 2007-03-27 2008-10-02 Denso Corporation Display device
JP2016078495A (en) * 2014-10-10 2016-05-16 矢崎総業株式会社 Vehicular display device
CN104992412A (en) * 2015-06-10 2015-10-21 北京金山安全软件有限公司 Picture gradual change method and device
CN105427258A (en) * 2015-11-25 2016-03-23 惠州Tcl移动通信有限公司 Optimization processing method and system for smooth display of circular patterns as well as intelligent equipment
CN109964101A (en) * 2016-11-08 2019-07-02 株式会社电装 Display apparatus
CN107154063A (en) * 2017-04-19 2017-09-12 腾讯科技(深圳)有限公司 The shape method to set up and device in image shows region
CN109130855A (en) * 2018-08-03 2019-01-04 浙江中科领航汽车电子有限公司 A kind of householder method, system and the device of liquid crystal instrument display elements fade effect

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112109549A (en) * 2020-08-25 2020-12-22 惠州华阳通用电子有限公司 Instrument display method and system
CN114756316A (en) * 2022-03-29 2022-07-15 南斗六星系统集成有限公司 Expression interaction display method, medium, instrument and device based on liquid crystal screen
CN116664734A (en) * 2022-10-19 2023-08-29 荣耀终端有限公司 Method for displaying ring chart, electronic device and readable storage medium
CN116664734B (en) * 2022-10-19 2024-05-07 荣耀终端有限公司 Method for displaying ring chart, electronic device and readable storage medium

Also Published As

Publication number Publication date
CN110539639B (en) 2020-12-01

Similar Documents

Publication Publication Date Title
CN110539639B (en) Instrument-based gradual change circular ring display method, medium, instrument and device
JP6903183B2 (en) Changes in effective resolution based on screen position in graphics processing by approximating the projection of vertices on a curved viewport
US10733691B2 (en) Fragment shaders perform vertex shader computations
CN104933749B (en) Clipping of graphics primitives
US20160125649A1 (en) Rendering apparatus and rendering method
KR20080067840A (en) 3-dimensional graphics accelerator and method of distributing pixel thereof
US10540789B2 (en) Line stylization through graphics processor unit (GPU) textures
US8730258B1 (en) Anti-aliasing of straight lines within a map image
US8982127B2 (en) Computing device and method for establishing three dimensional coordinate system using graphics
CN103677828A (en) Coverage drawing method, drawing engine and terminal equipment
US20190035049A1 (en) Dithered variable rate shading
US6947054B2 (en) Anisotropic filtering
KR20220099499A (en) Graphics texture mapping
CN109598672B (en) Map road rendering method and device
CN109427084B (en) Map display method, device, terminal and storage medium
CN114756316A (en) Expression interaction display method, medium, instrument and device based on liquid crystal screen
KR102276910B1 (en) Tessellation apparatus and tessellation method
Gilg et al. Comparison of Depth Buffer Techniques for Large and Detailed 3D Scenes
CN117608433A (en) Three-dimensional interface information display method, computer medium and electronic equipment
CN115965702A (en) Vector graphic rendering method and device and electronic equipment
JP2020190937A (en) Light source position control method, apparatus therefor, program therefor, and computer-readable recording medium
CN114723865A (en) Rendering method and device for rounded square frame and map rendering method
CN118096951A (en) Special effect processing method, device, electronic equipment, storage medium and program product
KR20150057232A (en) Method and apparatus for rendering an object

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
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A gradient ring display method, medium, instrument and device based on instrument

Effective date of registration: 20211221

Granted publication date: 20201201

Pledgee: Industrial Bank Limited by Share Ltd. Wuhan branch

Pledgor: SOUTH SAGITTARIUS INTEGRATION Co.,Ltd.

Registration number: Y2021420000150