CN116932118B - Color adjustment method and device for graphic primitive, computer equipment and storage medium - Google Patents

Color adjustment method and device for graphic primitive, computer equipment and storage medium Download PDF

Info

Publication number
CN116932118B
CN116932118B CN202311162266.1A CN202311162266A CN116932118B CN 116932118 B CN116932118 B CN 116932118B CN 202311162266 A CN202311162266 A CN 202311162266A CN 116932118 B CN116932118 B CN 116932118B
Authority
CN
China
Prior art keywords
display
primitive
background
color
information
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.)
Active
Application number
CN202311162266.1A
Other languages
Chinese (zh)
Other versions
CN116932118A (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.)
Zwcad Software Co ltd
Original Assignee
Zwcad Software 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 Zwcad Software Co ltd filed Critical Zwcad Software Co ltd
Priority to CN202311162266.1A priority Critical patent/CN116932118B/en
Publication of CN116932118A publication Critical patent/CN116932118A/en
Application granted granted Critical
Publication of CN116932118B publication Critical patent/CN116932118B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Generation (AREA)

Abstract

The present application relates to a color adjustment method, apparatus, computer device, storage medium and computer program product for graphic elements. The method comprises the following steps: obtaining background color information of a background in a display interface, and obtaining primitive color information of primitives in the display interface; determining definition information for the graphic primitive according to the background color information and the graphic primitive color information; under the condition that the definition information does not meet the preset condition, converting the current color mode into a CMYK mode, and acquiring K channel data of the background in the CMYK mode; and according to the K channel data of the background in the CMYK mode, adjusting the K channel data of the graphic primitive in the CMYK mode to obtain an adjusted graphic primitive, and displaying the adjusted graphic primitive in a display interface. The method can improve the display definition of the graphic primitive in the display interface.

Description

Color adjustment method and device for graphic primitive, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for color adjustment of primitives.
Background
With the development of computer technology, various APP applications are going deep into people's work and life.
At present, when the display function of an application program is optimized, the background and the graphic element of a display interface are often adjusted to improve the reading experience of a user. However, in the process of performing color optimization on the display interface, the colors in the display interface are generally uniformly adjusted based on the current background color of the display interface, and many data contents still exist to be displayed unclear by adopting the uniform adjustment mode.
Therefore, the conventional technology has a problem that the graphic element in the display interface is not clearly displayed.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a color adjustment method, apparatus, computer device, computer-readable storage medium, and computer program product for primitives that can improve the display definition of primitives in a display interface.
A method for color adjustment of primitives, comprising:
obtaining background color information of a background in a display interface, and obtaining primitive color information of primitives in the display interface;
determining definition information for the graphic primitive according to the background color information and the graphic primitive color information;
Under the condition that the definition information does not meet the preset condition, converting the current color mode into a CMYK mode, and acquiring K channel data of the background in the CMYK mode;
and according to the K channel data of the background in the CMYK mode, adjusting the K channel data of the graphic primitive in the CMYK mode to obtain an adjusted graphic primitive, and displaying the adjusted graphic primitive in a display interface.
In one embodiment, determining sharpness information for a primitive based on background color information and primitive color information includes:
determining background relative brightness information according to the background color information, and determining primitive relative brightness information according to the primitive color information;
and determining the contrast ratio for the graphic element as definition information according to the background relative brightness information and the graphic element relative brightness information.
In one embodiment, in a case where the sharpness information does not satisfy the preset condition, converting the current color mode into the CMYK mode includes:
acquiring a contrast threshold;
and under the condition that the contrast of the graphic primitive is smaller than or equal to a contrast threshold value, determining that the definition information does not meet a preset condition, and converting the current color mode into a CMYK mode.
In one embodiment, obtaining the contrast threshold includes:
acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises contrast threshold configuration information corresponding to the display;
inquiring a contrast threshold value corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
In one embodiment, according to K channel data of a background in CMYK mode, adjusting the K channel data of the primitive in CMYK mode to obtain an adjusted primitive, including:
obtaining a K channel numerical value adjustment proportion;
under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than the target value, adjusting the proportion according to the K channel value, and improving the value of the K channel data of the graphic element in the CMYK mode to obtain an adjusted graphic element;
and under the condition that the value corresponding to the K channel data in the CMYK mode of the background is larger than or equal to the target value, according to the K channel value adjustment proportion, reducing the value of the K channel data of the graphic primitive in the CMYK mode, and obtaining the adjusted graphic primitive.
In one embodiment, obtaining the K-channel numerical adjustment ratio includes:
acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises K channel numerical value adjustment proportion information corresponding to the display;
inquiring the K channel numerical value adjustment proportion corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
In one embodiment, the method further comprises:
responding to an adjustment operation for adjusting the proportion of the K channel value, and acquiring a value set by the adjustment operation;
and updating the K channel value adjustment proportion according to the value set by the adjustment operation.
A device for color adjustment of a graphic element, the device comprising:
the acquisition module is used for acquiring background color information of a background in the display interface and acquiring primitive color information of primitives in the display interface;
the determining module is used for determining definition information aiming at the graphic primitive according to the background color information and the graphic primitive color information;
the conversion module is used for converting the current color mode into a CMYK mode and acquiring K channel data of the background in the CMYK mode under the condition that the definition information does not meet the preset condition;
And the adjusting module is used for adjusting the K channel data of the graphic element in the CMYK mode according to the K channel data of the background in the CMYK mode to obtain an adjusted graphic element, and displaying the adjusted graphic element in a display interface.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method described above.
A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described above.
The color adjustment method, the device, the computer equipment, the storage medium and the computer program product of the primitives are used for acquiring the background color information of the background in the display interface and acquiring the primitive color information of the primitives in the display interface; determining definition information for the graphic primitive according to the background color information and the graphic primitive color information; under the condition that the definition information does not meet the preset condition, converting the current color mode into a CMYK mode, and acquiring K channel data of the background in the CMYK mode; according to the K channel data of the background in the CMYK mode, adjusting the K channel data of the graphic primitive in the CMYK mode to obtain an adjusted graphic primitive, and displaying the adjusted graphic primitive in a display interface; therefore, when the display of the plurality of primitives is not clear enough under the current color background, the colors of the primitives are adjusted according to the definition information of the primitives, so that the primitives in the display interface can be clearly displayed, and the display definition of the primitives in the display interface under the current color background is improved.
Drawings
FIG. 1 is an application environment diagram of a method for color adjustment of primitives in one embodiment;
FIG. 2 is a flowchart of a method for color adjustment of primitives according to one embodiment;
FIG. 3 is a flowchart of a method for color adjustment of primitives according to one embodiment;
FIG. 4 is a flowchart of a method for color adjustment of primitives according to one embodiment;
FIG. 5 is a schematic diagram of a setting module of a K channel numerical adjustment scale according to an embodiment;
FIG. 6 is a flowchart of a color adjustment method of a primitive according to another embodiment;
FIG. 7 is a block diagram of a color adjustment device for primitives in one embodiment;
fig. 8 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure.
The color adjustment method of the graphic primitive provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the display 102 is connected to the server 104. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The server 104 obtains background color information of a background in a display interface of the display 102 and obtains primitive color information of primitives in the display interface; the server 104 determines definition information for the primitive according to the background color information and the primitive color information; the server 104 converts the current color mode into a CMYK mode and acquires K channel data of the background in the CMYK mode when the definition information does not meet the preset condition; the server 104 adjusts the K channel data of the graphic element in the CMYK mode according to the K channel data of the background in the CMYK mode, to obtain an adjusted graphic element, and displays the adjusted graphic element in the display interface of the display 102. The display 102 may be, but is not limited to, various mobile phone displays, computer displays, television displays. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a method for adjusting the color of a primitive is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
step S202, obtaining background color information of a background in a display interface and obtaining primitive color information of primitives in the display interface.
The display interface may be a computer operation user interface provided by a display.
The background color information may be data of R, G, B channels corresponding to the background color of the display interface in the RGB mode, or may be color information corresponding to the background color in the HSL mode, the HSB mode, or the like.
Wherein, the graphic element may refer to geometric figures or characters in the display interface.
The primitive color information may be data of three channels R, G, B corresponding to the colors of the geometric figures or the characters in the RGB mode, or may be color information corresponding to the colors of the geometric figures or the characters in the HSL mode, the HSB mode and the like.
In a specific implementation, the server acquires background color information of a current background color in the display interface, and acquires color information of geometric figures or characters in the display interface.
In practical applications, the current color mode may be RGB mode, CMYK mode, HSB mode, lab mode, or the like. In addition, no matter what color mode the current color mode is, the server can acquire data of R, G, B channels corresponding to the current background color in the display interface in the RGB mode so as to obtain background color information; and acquiring data of the corresponding R, G, B three channels of the geometric figure or the text color in the display interface in the RGB mode to obtain the primitive color information.
Step S204, according to the background color information and the primitive color information, definition information for the primitive is determined.
Wherein the sharpness information may refer to contrast.
In specific implementation, the server determines the definition of the geometric figure or the text in the display interface according to the background color information corresponding to the current background color and the primitive color information corresponding to the geometric figure or the text. For example, the server determines the sharpness of the geometric figure or text in the display interface according to the data of the corresponding R, G, B three channels in RGB mode of the current background color and the data of the corresponding R, G, B three channels in RGB mode of the color of the geometric figure or text in the display interface.
In step S206, if the sharpness information does not meet the preset condition, the current color mode is converted into CMYK mode, and K channel data of the background in CMYK mode is obtained.
The color mode may be RGB mode, CMYK mode, HSB mode, lab mode, or the like.
In the specific implementation, under the condition that the definition of the geometric primitive or the text in the display interface does not meet the preset condition, the server converts the current background color, the color of the geometric figure and the color mode of the text into a CMYK mode, and then the server acquires the K value of the background color in the CMYK mode.
Step S208, according to the K channel data of the background in the CMYK mode, the K channel data of the graphic primitive in the CMYK mode is adjusted to obtain an adjusted graphic primitive, and the adjusted graphic primitive is displayed in a display interface.
In the specific implementation, the server adjusts the K value of the geometric figure or the text in the CMYK mode according to the K value of the background color in the CMYK mode to obtain the adjusted geometric figure or text, and displays the adjusted graphic element in the display interface.
In practical application, when the K value of the background color in the CMYK mode is less than 50%, the K value of the unclear primitive color is raised, and when the K value of the background color in the CMYK mode is greater than or equal to 50%, the K value of the unclear primitive color is lowered. The K value adjusting amplitude can be set to 15% -30% according to different application scenes, and when the adjusting amplitude value is larger, the color of the adjusted primitive is clearer, but the color of the adjusted primitive is more different from that of the original primitive.
For the understanding of the person skilled in the art, the first column in table 1 shows the color RGB values of several primitives before adjustment by the above method in a white background, and the second column in table 1 shows the color RGB values of the primitives after adjustment by the above method in a white background. The color of the graphic element can be obviously clearer in a white background after the color RGB value is changed by adopting the method. It should be noted that the actual colors of the primitives are not shown in the table, but the RGB values are used to represent the colors of the corresponding primitives.
TABLE 1
For the convenience of understanding of those skilled in the art, fig. 3 exemplarily provides a flowchart of a color adjustment method of a graphic primitive, which includes the steps of:
step 1: acquiring the current background color;
step 2: acquiring RGB color numbers corresponding to the primitive colors under the current background;
step 3: calculating Contrast Ratio according to the current background color and the RGB color number corresponding to the primitive color under the current background;
step 4: under the condition that the Contrast Ratio is larger than a preset threshold value, color adjustment is not performed; under the condition that the Contrast Ratio is smaller than or equal to a preset threshold value, converting the current background color and the primitive color from an RGB mode to a CMYK mode; for example, the preset threshold may be in the range of 1.2-1.35;
Step 5: judging the K value of the current background color in the CMYK mode, reducing the K value of the primitive color when the K value is greater than or equal to 50%, and increasing the K value of the primitive color when the K value is less than 50%.
The color adjustment method of the graphic primitive provided by the embodiment can be applied to application programs for displaying and editing text information such as a text reader, a text editor, a text processor, a spreadsheet, a presentation, a web browser and the like, can be applied to other application programs with text annotation and geometric graphic primitive annotation functions, and can also be applied to computer aided design.
The color adjustment method, the device, the computer equipment, the storage medium and the computer program product of the primitives are used for acquiring the background color information of the background in the display interface and acquiring the primitive color information of the primitives in the display interface; determining definition information for the graphic primitive according to the background color information and the graphic primitive color information; under the condition that the definition information does not meet the preset condition, converting the current color mode into a CMYK mode, and acquiring K channel data of the background in the CMYK mode; according to the K channel data of the background in the CMYK mode, adjusting the K channel data of the graphic primitive in the CMYK mode to obtain an adjusted graphic primitive, and displaying the adjusted graphic primitive in a display interface; therefore, when the display of the plurality of primitives is not clear enough under the current color background, the colors of the primitives are adjusted according to the definition information of the primitives, so that the primitives in the display interface can be clearly displayed, and the display definition of the primitives in the display interface under the current color background is improved.
In another embodiment, determining sharpness information for a primitive based on background color information and primitive color information includes: determining background relative brightness information according to the background color information, and determining primitive relative brightness information according to the primitive color information; and determining the contrast ratio for the graphic element as definition information according to the background relative brightness information and the graphic element relative brightness information.
The background relative brightness information may be the relative brightness of the background color.
The relative brightness information of the graphic element can be the relative brightness of the graphic element color.
The contrast may be the contrast between the relative brightness of the background color and the relative brightness of the primitive color.
In specific implementation, the server determines the relative brightness of the current background color according to the background color information corresponding to the current background color, determines the relative brightness of the geometric figure or the character according to the primitive color information corresponding to the geometric figure or the character, determines the contrast for the geometric figure or the character according to the relative brightness of the background color and the relative brightness of the geometric figure or the character, and takes the contrast as definition information. For example, the server determines the relative brightness of the background color according to the data of the corresponding R, G, B three channels in the RGB mode of the current background color, and the server determines the relative brightness of the geometric figure or the text according to the data of the corresponding R, G, B three channels in the RGB mode of the geometric figure or the text in the display interface, and the server determines the contrast for the geometric figure or the text according to the relative brightness of the background color and the relative brightness of the geometric figure or the text, and takes the contrast as the definition information.
In practical application, the contrast calculation formula between the background color and the primitive color is as follows:
Contrast Ratio=(L1+0.05)/(L2+0.05)
wherein, contrast Ratio is Contrast, L1 is relative brightness of background color, and L2 is relative brightness of primitive color.
The calculation formula of the relative brightness is as follows:
L=0.2126*R+0.7152*G+0.0722*B
wherein, L is relative brightness, R, G, B takes the following value modes: if XsRGB < = 0.03928, X = XsRGB/12.92; if XsRGB >0.03928, x= ((xsrgb+0.055)/1.055)/(2.4) (where XsRGB denotes RsRGB, gsRGB, bsRGB; xsrgb=x8bit/255, X8bit denotes the value of R, G, B channel 0-255 under 8bit channel).
The above-mentioned Contrast Ratio has a value range of 1-21, and when the Contrast Ratio is closer to 1, the color of the primitive is less clear in the current background. In practical application, when the defined Contrast Ratio is smaller than a certain value, the color of the primitive is the color which is displayed in the current background and is unclear.
According to the technical scheme of the embodiment, the background relative brightness information is determined according to the background color information, and the primitive relative brightness information is determined according to the primitive color information; determining the contrast ratio of the graphic primitive as definition information according to the background relative brightness information and the graphic primitive relative brightness information; therefore, the contrast ratio of the graphic primitive and the background can be accurately determined, and the color of the graphic primitive can be accurately adjusted.
In another embodiment, in a case where the sharpness information does not satisfy the preset condition, converting the current color mode into the CMYK mode includes: acquiring a contrast threshold; and under the condition that the contrast of the graphic primitive is smaller than or equal to a contrast threshold value, determining that the definition information does not meet a preset condition, and converting the current color mode into a CMYK mode.
The contrast threshold may be 1.3, and in practical applications, the contrast threshold may be set within a range of values from 1.2 to 1.35.
In the specific implementation, the server acquires a contrast threshold, determines that the definition information does not meet a preset condition under the condition that the contrast of the geometric figure or the text is smaller than or equal to the contrast threshold, and converts the current color mode into a CMYK mode.
According to the technical scheme, a contrast threshold value is obtained; under the condition that the contrast of the graphic primitive is smaller than or equal to a contrast threshold value, determining that the definition information does not meet a preset condition, and converting the current color mode into a CMYK mode; therefore, whether the current color mode needs to be converted or not can be accurately determined, and the color of the graphic primitive in the display interface can be adjusted quickly.
In another embodiment, obtaining the contrast threshold includes: acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises contrast threshold configuration information corresponding to the display; inquiring a contrast threshold value corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
The display configuration information may be information such as a brand, a model, and a contrast threshold configured by display setting corresponding to the display.
The display configuration information table may be information describing brands, models, display settings, contrast thresholds, and the like of different displays.
The display identifier may be information of a brand, a model, etc. of the display.
Wherein the contrast threshold configuration information may be a configured contrast threshold for the display.
In the specific implementation, the server acquires a display configuration information table of the display, and queries a contrast threshold value in the display configuration information table according to the brand and model corresponding to the display displaying the current display interface.
According to the technical scheme, a configuration information table is displayed by acquiring a display; inquiring a contrast threshold value corresponding to the target display in a display configuration information table according to the display identification of the target display; therefore, different contrast thresholds can be flexibly adopted according to different displays, and mode conversion triggering conditions of different color modes can be set according to different displays, so that the method is beneficial to more accurately converting the color modes of display interfaces of different displays.
In another embodiment, the adjusting the K channel data of the graphic element in the CMYK mode according to the K channel data of the background in the CMYK mode to obtain the adjusted graphic element includes: obtaining a K channel numerical value adjustment proportion; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than the target value, adjusting the proportion according to the K channel value, and improving the value of the K channel data of the graphic element in the CMYK mode to obtain an adjusted graphic element; and under the condition that the value corresponding to the K channel data in the CMYK mode of the background is larger than or equal to the target value, according to the K channel value adjustment proportion, reducing the value of the K channel data of the graphic primitive in the CMYK mode, and obtaining the adjusted graphic primitive.
Wherein, the K channel numerical adjustment ratio can be 25%.
Wherein, the target value can be 50%, and the value range of the target value can be 0-100%.
In a specific implementation, the server obtains the K channel value adjustment proportion to be 25%, and when the K value of the background color in the CMYK mode is less than 50%, the server increases the K value of the primitive color in the CMYK mode by 25%, so as to obtain an adjusted primitive, and when the K value of the background color in the CMYK mode is greater than or equal to 50%, the server decreases the K value of the primitive color in the CMYK mode by 25%, so as to obtain the adjusted primitive.
According to the technical scheme, the K channel numerical value adjustment proportion is obtained; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than the target value, adjusting the proportion according to the K channel value, and improving the value of the K channel data of the graphic element in the CMYK mode to obtain an adjusted graphic element; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is larger than or equal to the target value, the value of the K channel data of the graphic primitive in the CMYK mode is reduced according to the K channel value adjustment proportion, and the adjusted graphic primitive is obtained; therefore, the color adjustment mode of the graphic primitive can be flexibly determined according to the background color, so that the graphic primitive color can be rapidly adjusted, and the display definition of the graphic primitive is further improved.
In another embodiment, obtaining the K-channel numerical adjustment ratio includes: acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises K channel numerical value adjustment proportion information corresponding to the display; inquiring the K channel numerical value adjustment proportion corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
The K-channel numerical adjustment ratio information may be a preset K-channel numerical adjustment ratio value.
In the specific implementation, the server acquires a display configuration information table of the display, and queries the numerical adjustment proportion of the K channel in the display configuration information table according to the brand and model corresponding to the display displaying the current display interface.
For the convenience of understanding of those skilled in the art, fig. 4 exemplarily provides a flowchart of a method for color adjustment of a graphic primitive, which determines different contrast thresholds a and different K-channel numerical adjustment ratios b% based on brands, models and display setting information of different displays, and includes the steps of:
Step 1: establishing a configuration table, wherein the configuration table comprises brands and models of different displays, display settings, set contrast threshold values a and set K channel numerical value adjustment proportion b%;
step 2: obtaining the brand, model and display setting of a user display;
step 3: determining a contrast threshold value a and a K channel numerical value adjustment proportion b of a user display according to the configuration table in the step 1;
step 3: calculating Contrast Ratio according to the current background color of the user display and the RGB color number corresponding to the primitive color under the current background;
step 4: under the condition that the Contrast Ratio is greater than a, color adjustment is not performed; under the condition that the Contrast Ratio is smaller than or equal to a, converting the current background color and the primitive color from an RGB mode to a CMYK mode;
step 5: judging the K value of the current background color in the CMYK mode, when the K value is greater than or equal to 50%, reducing the K value of the primitive color by b%, and when the K value is less than 50%, increasing the K value of the primitive color by b%.
According to the technical scheme, a configuration information table is displayed by acquiring a display; inquiring the K channel numerical value adjustment proportion corresponding to the target display in a display configuration information table according to the display identification of the target display; therefore, different K channel numerical value adjustment proportion values can be flexibly adopted according to different displays, and different K channel numerical value adjustment proportions can be set according to different displays, so that the color adjustment of the graphic elements in the display interfaces of the different displays can be more accurately facilitated, and the display definition of the graphic elements can be improved.
In another embodiment, the method further comprises: responding to an adjustment operation for adjusting the proportion of the K channel value, and acquiring a value set by the adjustment operation; and updating the K channel value adjustment proportion according to the value set by the adjustment operation.
In the specific implementation, the server responds to the adjustment operation of the user on the K channel numerical value adjustment proportion, the numerical value set by the user is obtained, and the server updates the K channel numerical value adjustment proportion according to the numerical value.
For the convenience of understanding of those skilled in the art, fig. 5 exemplarily provides a setting module of a K-channel numerical adjustment ratio, which can be set to a numerical range of 0-50% by sliding a slider on the setting module.
According to the technical scheme of the embodiment, the numerical value set by the adjustment operation is obtained by responding to the adjustment operation aiming at the K channel numerical value adjustment proportion; updating the K channel value adjustment proportion according to the value set by the adjustment operation; therefore, the K channel numerical value adjustment proportion can be reset under the condition that the display is still unclear after the color adjustment of the graphic element, so that the color of each graphic element in the display interface can be quickly adjusted.
In another embodiment, as shown in fig. 6, a method for adjusting color of a primitive is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
Step S602, obtaining background color information of a background in the display interface, and obtaining primitive color information of primitives in the display interface.
In step S604, the background relative brightness information is determined according to the background color information, and the primitive relative brightness information is determined according to the primitive color information.
Step S606, determining the contrast ratio of the graphic primitive as definition information according to the background relative brightness information and the graphic primitive relative brightness information.
In step S608, if the sharpness information does not meet the preset condition, the current color mode is converted into CMYK mode, and K channel data of the background in CMYK mode is obtained.
Step S610, according to the K channel data of the background in the CMYK mode, the K channel data of the graphic element in the CMYK mode is adjusted to obtain an adjusted graphic element, and the adjusted graphic element is displayed in a display interface.
It should be noted that, the specific limitation of the above steps may be referred to the specific limitation of the color adjustment method for one primitive.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a primitive color adjusting device for realizing the above mentioned primitive color adjusting method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the color adjustment device for one or more primitives provided below may be referred to the limitation of the color adjustment method for the primitives hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 7, there is provided a color adjustment device for a graphic primitive, including:
an obtaining module 702, configured to obtain background color information of a background in the display interface, and obtain primitive color information of primitives in the display interface;
a determining module 704, configured to determine definition information for the primitive according to the background color information and the primitive color information;
a conversion module 706, configured to convert the current color mode into a CMYK mode and obtain K channel data of the background in the CMYK mode if the sharpness information does not meet a preset condition;
and the adjusting module 708 is configured to adjust the K channel data of the primitive in the CMYK mode according to the K channel data of the background in the CMYK mode, obtain an adjusted primitive, and display the adjusted primitive in the display interface.
In one embodiment, the determining module 704 is specifically configured to determine the background relative brightness information according to the background color information, and determine the primitive relative brightness information according to the primitive color information; and determining the contrast ratio for the graphic element as definition information according to the background relative brightness information and the graphic element relative brightness information.
In one embodiment, the determining module 704 is specifically configured to obtain a contrast threshold; and under the condition that the contrast of the graphic primitive is smaller than or equal to a contrast threshold value, determining that the definition information does not meet a preset condition, and converting the current color mode into a CMYK mode.
In one embodiment, the determining module 704 is specifically configured to obtain a display configuration information table of the display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises contrast threshold configuration information corresponding to the display; inquiring a contrast threshold value corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
In one embodiment, the adjusting module 708 is specifically configured to obtain a K-channel numerical adjustment ratio; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than the target value, adjusting the proportion according to the K channel value, and improving the value of the K channel data of the graphic element in the CMYK mode to obtain an adjusted graphic element; and under the condition that the value corresponding to the K channel data in the CMYK mode of the background is larger than or equal to the target value, according to the K channel value adjustment proportion, reducing the value of the K channel data of the graphic primitive in the CMYK mode, and obtaining the adjusted graphic primitive.
In one embodiment, the adjustment module 708 is specifically configured to obtain a display configuration information table of the display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises K channel numerical value adjustment proportion information corresponding to the display; inquiring the K channel numerical value adjustment proportion corresponding to the target display in a display configuration information table according to the display identification of the target display; the target display is a display device that displays a display interface.
In one embodiment, the apparatus further comprises: the updating module is specifically used for responding to the adjustment operation of the numerical adjustment proportion of the K channel and acquiring the numerical value set by the adjustment operation; and updating the K channel value adjustment proportion according to the value set by the adjustment operation.
The respective modules in the color adjustment device of the primitive may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 8. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store color adjustment data for the primitives. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of color adjustment of primitives.
It will be appreciated by those skilled in the art that the structure shown in fig. 8 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided that includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of a method for color adjustment of a primitive as described above. The step of the color adjustment method of a primitive may be a step in the color adjustment method of a primitive of the above embodiments.
In one embodiment, a computer readable storage medium is provided, storing a computer program which, when executed by a processor, causes the processor to perform the steps of a method for color adjustment of a graphic element as described above. The step of the color adjustment method of a primitive may be a step in the color adjustment method of a primitive of the above embodiments.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, causes the processor to perform the steps of a method for color adjustment of a graphic element as described above. The step of the color adjustment method of a primitive may be a step in the color adjustment method of a primitive of the above embodiments.
It should be noted that, user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as Static Random access memory (Static Random access memory AccessMemory, SRAM) or dynamic Random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (9)

1. A method for color adjustment of a graphic primitive, the method comprising:
obtaining background color information of a background in a display interface, and obtaining primitive color information of primitives in the display interface;
determining definition information for the graphic primitive according to the background color information and the graphic primitive color information;
under the condition that the definition information does not meet the preset condition, converting the current color mode into a CMYK mode, and acquiring K channel data of the background in the CMYK mode;
According to the K channel data of the background in the CMYK mode, the K channel data of the graphic primitive in the CMYK mode is adjusted to obtain an adjusted graphic primitive, and the adjusted graphic primitive is displayed in the display interface; the method specifically comprises the following steps: obtaining a K channel numerical value adjustment proportion; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than a target value, according to the K channel value adjustment proportion, the value of the K channel data of the graphic primitive in the CMYK mode is improved, and the adjusted graphic primitive is obtained; and under the condition that the value corresponding to the K channel data of the background in the CMYK mode is larger than or equal to the target value, adjusting the proportion according to the K channel value, and reducing the value of the K channel data of the graphic primitive in the CMYK mode to obtain the adjusted graphic primitive.
2. The method of claim 1, wherein said determining sharpness information for the primitive based on the background color information and the primitive color information comprises:
determining background relative brightness information according to the background color information, and determining primitive relative brightness information according to the primitive color information;
And determining the contrast ratio of the graphic primitive according to the background relative brightness information and the graphic primitive relative brightness information as the definition information.
3. The method according to claim 2, wherein converting the current color mode into the CMYK mode in the case where the sharpness information does not satisfy a preset condition, comprises:
acquiring a contrast threshold;
and under the condition that the contrast of the graphic primitive is smaller than or equal to the contrast threshold value, determining that the definition information does not meet the preset condition, and converting the current color mode into a CMYK mode.
4. A method according to claim 3, wherein said obtaining a contrast threshold comprises:
acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises contrast threshold configuration information corresponding to the display;
inquiring a contrast threshold corresponding to a target display in a display configuration information table of the display according to a display identifier of the target display; the target display is a display device for displaying the display interface.
5. The method of claim 1, wherein the obtaining the K-channel numerical adjustment ratio comprises:
acquiring a display configuration information table of a display; the display configuration information table of the display comprises display configuration information of each display; the display configuration information comprises K channel numerical value adjustment proportion information corresponding to the display;
inquiring the K channel numerical value adjustment proportion corresponding to the target display in the display configuration information table of the display according to the display identification of the target display; the target display is a display device for displaying the display interface.
6. The method according to claim 1, wherein the method further comprises:
responding to an adjustment operation for the K channel numerical value adjustment proportion, and acquiring a numerical value set by the adjustment operation;
and updating the K channel numerical value adjustment proportion according to the numerical value set by the adjustment operation.
7. A color adjustment device for a graphic primitive, the device comprising:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring background color information of a background in a display interface and acquiring primitive color information of primitives in the display interface;
The determining module is used for determining definition information aiming at the graphic primitive according to the background color information and the graphic primitive color information;
the conversion module is used for converting the current color mode into a CMYK mode and acquiring K channel data of the background in the CMYK mode under the condition that the definition information does not meet the preset condition;
the adjustment module is used for adjusting the K channel data of the graphic element in the CMYK mode according to the K channel data of the background in the CMYK mode to obtain an adjusted graphic element, and displaying the adjusted graphic element in the display interface; the method specifically comprises the following steps: obtaining a K channel numerical value adjustment proportion; under the condition that the value corresponding to the K channel data of the background in the CMYK mode is smaller than a target value, according to the K channel value adjustment proportion, the value of the K channel data of the graphic primitive in the CMYK mode is improved, and the adjusted graphic primitive is obtained; and under the condition that the value corresponding to the K channel data of the background in the CMYK mode is larger than or equal to the target value, adjusting the proportion according to the K channel value, and reducing the value of the K channel data of the graphic primitive in the CMYK mode to obtain the adjusted graphic primitive.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311162266.1A 2023-09-11 2023-09-11 Color adjustment method and device for graphic primitive, computer equipment and storage medium Active CN116932118B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311162266.1A CN116932118B (en) 2023-09-11 2023-09-11 Color adjustment method and device for graphic primitive, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311162266.1A CN116932118B (en) 2023-09-11 2023-09-11 Color adjustment method and device for graphic primitive, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116932118A CN116932118A (en) 2023-10-24
CN116932118B true CN116932118B (en) 2024-01-30

Family

ID=88392658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311162266.1A Active CN116932118B (en) 2023-09-11 2023-09-11 Color adjustment method and device for graphic primitive, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116932118B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6778300B1 (en) * 2000-05-18 2004-08-17 Canon Kabushiki Kaisha Black generation for color management system
CN110826569A (en) * 2019-11-05 2020-02-21 泰康保险集团股份有限公司 Bill image preprocessing method and device, medium and electronic equipment
CN110942126A (en) * 2019-11-08 2020-03-31 广州追溯信息科技有限公司 Method for generating star array three-dimensional code
CN111399965A (en) * 2020-04-16 2020-07-10 Oppo广东移动通信有限公司 User interface compatible display method and device, equipment and storage medium
WO2022142222A1 (en) * 2020-12-30 2022-07-07 北京搜狗科技发展有限公司 Method and apparatus for setting application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11508071B2 (en) * 2020-09-17 2022-11-22 Xerox Corporation System and method to detect, suppress, and modify background regions of scanned documents

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6778300B1 (en) * 2000-05-18 2004-08-17 Canon Kabushiki Kaisha Black generation for color management system
CN110826569A (en) * 2019-11-05 2020-02-21 泰康保险集团股份有限公司 Bill image preprocessing method and device, medium and electronic equipment
CN110942126A (en) * 2019-11-08 2020-03-31 广州追溯信息科技有限公司 Method for generating star array three-dimensional code
CN111399965A (en) * 2020-04-16 2020-07-10 Oppo广东移动通信有限公司 User interface compatible display method and device, equipment and storage medium
WO2022142222A1 (en) * 2020-12-30 2022-07-07 北京搜狗科技发展有限公司 Method and apparatus for setting application program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
RGB颜色模式图像调色探究;罗龙襄;《电子技术与软件工程》;第182-185页 *

Also Published As

Publication number Publication date
CN116932118A (en) 2023-10-24

Similar Documents

Publication Publication Date Title
CN103843032B (en) For the image procossing of high dynamic range images
CN109741279A (en) Image saturation method of adjustment, device, storage medium and terminal
CN111489322B (en) Method and device for adding sky filter to static picture
CN110728722B (en) Image color migration method and device, computer equipment and storage medium
WO2021175040A1 (en) Video processing method and related device
CN110189384B (en) Image compression method, device, computer equipment and storage medium based on Unity3D
CN111179370B (en) Picture generation method and device, electronic equipment and storage medium
CN117011304A (en) Defect detection method, defect detection device, computer equipment and computer readable storage medium
CN117112090A (en) Business page theme generation method, device, computer equipment, medium and product
CN115115968A (en) Video quality evaluation method and device and computer readable storage medium
CN116932118B (en) Color adjustment method and device for graphic primitive, computer equipment and storage medium
CN114218421A (en) Resource recall method and device and network side equipment
CN116843566A (en) Tone mapping method, tone mapping device, display device and storage medium
CN111090384B (en) Soft keyboard display method and device
US11295496B2 (en) Intelligent exporting of images using an image editing application
CN110956572A (en) Image processing method, device and system
CN111462158A (en) Image processing method and device, intelligent device and storage medium
Schaefer et al. A hybrid color quantization algorithm incorporating a human visual perception model
CN104021579A (en) Method and device for changing colors of image
CN113435515A (en) Picture identification method and device, storage medium and electronic equipment
CN108200433B (en) Image compression and decompression method
CN116977154B (en) Visible light image and infrared image fusion storage method, device, equipment and medium
CN116739937A (en) Tone mapping method, tone mapping device, display device and storage medium
CN116739936A (en) Tone mapping method, tone mapping device, display device and storage medium
CN116452702B (en) Information chart rapid design method, device, computer equipment and storage medium

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