A method, device and storage medium for generating custom height and gradient level

By dynamically generating gradient data templates, it solves the problem of fixed height level templates occupying storage space, realizes flexible adjustment of custom heights and gradient levels, and improves the visual appeal of printed products and system efficiency.

CN117785082BActive Publication Date: 2024-10-29GUANGZHOU SENYANG ELECTRONIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311823814.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2024-10-29
Estimated Expiration
2043-12-27

AI Technical Summary

Technical Problem

The feathering templates with fixed height levels in existing printer programs require more storage space to dynamically generate gradient level templates with custom heights, which increases the size and storage footprint of program files.

Method used

By determining the number of printing height points and custom feathering levels, the gradient data template is dynamically generated, and the error diffusion method and linear interpolation method are used to generate templates with custom height and gradient levels, reducing the need for pre-built templates.

Benefits of technology

It achieves flexible adjustment of printing effects, reduces storage space occupation, improves system efficiency and flexibility, and enhances the visual appeal and richness of details of images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117785082B_ABST
    Figure CN117785082B_ABST
Patent Text Reader

Abstract

The invention discloses a method, device and storage medium for generating a custom height and gradient level; the method comprises the steps of: S1: determining the number of printing height points, S2: calculating the gradient level height of a data template according to the value of step S1, and S3: calculating and generating a gradient template according to the value of step S2; the invention realizes the effect of dynamically generating the custom height and gradient level, dynamically generates a gradient data template according to the number of printing height points, feathering level and other parameters input by a user, and applies the generated template to the corresponding height to form a dynamic gradient effect, generates a gradient effect with a custom height and gradient level according to user needs, and the user can flexibly adjust the number of printing height points, feathering level and other parameters to obtain a gradient effect that meets his needs, and reduces the storage space occupation problem caused by a large number of pre-built-in templates by dynamically generating gradient data templates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of printers, and in particular to a method, a device and a storage medium for generating a custom height and a gradient level. Background Art

[0002] When the printer prints, it gives the nozzle image data for each swath. Each time the nozzle scans the paper surface is called a swath. Adding gradient data to the data processing template is called feathering. The gradient data of different swaths will complement each other to form the complete data of the image. The height and gradient level of the feathering template of most printer programs are adjusted according to the fixed feathering level. The feathering template is generally a fixed height level template data pre-built into the program file. If the template data of the gradient level with a custom height can be dynamically generated during printing, the printer can infinitely adjust the required printing feathering degree according to his own preferences.

[0003] In the prior art, template data with fixed height levels are pre-built in, and dynamically generated template data with gradient levels of custom heights may require more storage space to store temporary calculation results or generated template data, which increases the size of the program file and occupies more storage space. Summary of the invention

[0004] The object of the present invention is to provide a method, device and storage medium for generating custom height and gradient level, so as to realize stepless adjustment of feathering level without the need for pre-built-in templates, thereby reducing the program storage space occupied.

[0005] The purpose of the present invention can be achieved through the following technical solutions:

[0006] This application provides a method for generating custom height and gradient levels, including the following steps:

[0007] S1: Determine the number of print height dots, based on the number of vertical print nozzles for each color of the printer nozzle and the custom feathering level, with a value range of 0%~∞%;

[0008] S2: Calculate the gradient level height of the data template according to the value of step S1, and determine that two gradient data templates need to be dynamically generated for the feathering levels A and B;

[0009] S3: Generate a gradient template based on the value of step S2. The template is essentially a monochrome image with a height equal to swathHeight and a 1-bit color depth. A dark pixel value represents ink discharge from the nozzle, and a light pixel value represents no ink discharge from the nozzle.

[0010] Preferably, according to the step S1, the number of printing height dots is determined, and the number of printing height dots is set to 800 nozzle holes: swathHeight = 800;

[0011] Feathering level A is 50%: softenLevelA = 50%; Feathering level B is 150%; softenLevelB = 150%.

[0012] As a preferred embodiment, the concept of feathering points is introduced according to step S2. The feathering points refer to the gradient height points used by the nozzle to complement the part under the printing height points, which are calculated from the feathering level. The calculation method of the feathering level within 100% is as follows:

[0013] Feathering points softenDots = swathHeight / 2 * softenLevel;

[0014] Calculation method for feathering level exceeding 100%:

[0015] Feathering points softenDots = swathHeight - swathHeight / 2 / softenLevel;

[0016] The feathering points for feathering level A are calculated as:

[0017] softenDotsA = swathHeight / 2 * softenLevelA = 200;

[0018] Calculate the feathering points for feathering level B:

[0019] softenDotsB = swathHeight - swathHeight / 2 / softenLevelB = 533.

[0020] Preferably, a gradient template is generated according to the calculation described in step S3, and the template width softenWidht is set to 200; the method for generating template A is to first generate a gradient image with a high grayscale of 200 (softenWidht) * 200 (softenDotsA) and a high color depth that gradually changes from 0 to 100% from top to bottom, and then reduce the color depth of the image to 1 bit using the error diffusion method, fill it to rows 0 to 200 of the template, and then set rows 200 to 600 of the template to dark colors; finally, the previous gradient image is inverted and filled to rows 600 to 800 of the template;

[0021] Template B is generated by first generating a high-depth gradient image with a height of 200 (softenWidht) * 800 (swathHeight) from light to dark and then from dark to light, and the generation must satisfy the average integral of the grayscale from top to bottom == (swathHeight- softenDotsB) / swathHeight = 33%; then the image is reduced to 1 bit in depth using the error diffusion method and filled into the entire template.

[0022] Preferably, the error diffusion method creates an error matrix with the same size as the original image and an initial value of 0;

[0023] Traverse each pixel of the original image from the upper left corner, process each pixel, and then obtain the grayscale value of the current pixel based on the pixel value at the corresponding position in template A or template B;

[0024] Add the gray value of the current pixel to the value of the corresponding position in the error matrix to obtain a new gray value; then quantize the new gray value according to the number of bits required to reduce it to 1-bit color depth, that is, a binary image;

[0025] Subtract the quantized grayscale value from the new grayscale value, calculate the error, and then get the error value. The error value is distributed to the surrounding pixels according to certain weights, and their error matrix values ​​are updated. The Floyd-Steinberg algorithm is used to distribute the error value to the pixels to the right, below, lower right, and lower left of the current pixel according to certain weights.

[0026] Preferably, two gradient data templates are dynamically generated according to step S2, a dynamic gradient effect is generated according to the input height and gradient level, a specific value of each gradient level is calculated, a height difference value of each gradient level is calculated according to the input height and gradient level, a color difference value of each gradient level is calculated according to the height difference value, and then a gradient effect algorithm is generated according to the color difference value, the specific color value of each gradient level is calculated by the algorithm, the calculated color value is applied to the corresponding height, and a dynamic gradient effect is generated;

[0027] By observing the generated dynamic gradient effect, testing and analyzing the generated dynamic gradient effect, analyzing the observed gradient effect, determining whether it meets the expected requirements, and then adjusting the algorithm or parameters for optimization.

[0028] Preferably, the template of custom height and gradient level is generated according to step S3.

[0029] First, obtain the parameters of the custom height and gradient level, and obtain the height and gradient level parameters of the template that the user wants to generate;

[0030] Generate a gradient sequence through linear interpolation. According to the obtained gradient level parameters, a gradient sequence is generated using the linear interpolation method. Specifically: Divide the gradient level parameters into equal intervals, and record the color value corresponding to each level. According to the custom height parameter, calculate the total height of the template to be generated. According to the total height and the gradient level parameter, calculate the height of each gradient level. For each gradient level, use the linear interpolation method to calculate the color value at the corresponding height. Arrange all the color values ​​according to the corresponding height to obtain the final gradient sequence.

[0031] A device for generating custom height and gradient levels includes a printer, at least one processor, at least one memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the above-mentioned method is implemented.

[0032] A storage medium stores computer program instructions, which implement the above-mentioned method when the computer program instructions are executed by a processor.

[0033] The beneficial effects of the present invention are:

[0034] (1) This method realizes the effect of dynamically generating custom height and gradient level. According to the number of printing height points, feather level and other parameters input by the user, a gradient data template is dynamically generated, and the generated template is applied to the corresponding height to form a dynamic gradient effect.

[0035] (2) It is possible to generate gradient effects with customized height and gradient levels according to user needs. Users can flexibly adjust the print height dots, feathering level and other parameters to obtain a gradient effect that meets their needs. Such flexibility can provide more diverse printing effect options, enhance the visual appeal of the print, and make the image have smooth transitions and rich details;

[0036] (3) By dynamically generating gradient data templates, the storage space occupied by a large number of pre-built-in templates is reduced. Compared with the traditional method that requires storing multiple fixed templates, this method only needs to dynamically generate templates based on the parameters input by the user, which reduces the storage space occupied and improves the efficiency and flexibility of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] For better understanding and implementation, the technical solution of the present application is described in detail below with reference to the accompanying drawings.

[0038] Figure 1 A flowchart of the steps of a method for generating a custom height and gradient level provided in Example 1 of the present application;

[0039] Figure 2 A schematic diagram of generating a method template A for generating a custom height and gradient level provided in Example 1 of the present application;

[0040] Figure 3 A schematic diagram of the generation of a method template B for generating a custom height and gradient level provided in Example 1 of the present application. DETAILED DESCRIPTION

[0041] In order to further explain the technical means and effects taken by the present invention to achieve the predetermined invention purpose, exemplary embodiments will be described in detail here, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of methods and systems consistent with some aspects of the present application as detailed in the attached claims.

[0042] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0043] The specific implementation methods, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. Example 1

[0044] See also Figure 1-Figure 3 The present embodiment provides a method, device and storage medium for generating a custom height and gradient level, which realizes the infinite adjustment of the feathering level without the need for a pre-built-in template, thereby reducing the program storage space occupied.

[0045] The present invention provides a method for generating a custom height and gradient level, comprising the following steps:

[0046] S1: Determine the number of print height dots, based on the number of vertical print holes for each color of the printer nozzle, and the custom feathering level (0%~∞%);

[0047] S2: Calculate the gradient level height of the data template according to the value of step S1, and determine that two gradient data templates need to be dynamically generated for the feathering levels A and B;

[0048] S3: Generate a gradient template based on the value of step S2. The template is essentially a monochrome image with a height equal to swathHeight and a 1-bit color depth. A dark pixel value represents ink discharge from the nozzle, and a light pixel value represents no ink discharge from the nozzle.

[0049] For example, assuming that the number of vertical printing nozzles for each color of the printer nozzle is 100, the custom feathering level is 50%, and the printing height of the printer is 1000 dots, then the gradient level height is 1000 * (1 - 5) = 500 dots.

[0050] Assume that the feathering level of type A is 20% and that of type B2 is 80%. Based on the gradient level height of 500 points, two gradient templates can be generated, in which 100 * 2 = 20 points in the feathering level template of type A are dark (ink out), and 100 * 8 = 80 points in the feathering level template of type B2 are dark (ink out).

[0051] Assuming swathHeight is 10 points, the width of the gradient template is 500 / 10 = 50 pixels, of which 20 pixels are dark and 30 pixels are light in the A feathering level template; 80 pixels are dark and 20 pixels are light in the B2 feathering level template.

[0052] Achieving the goal of generating dynamic gradient effects based on print height dots and feathering levels can enhance the visual appeal of prints, giving images smooth transitions and rich details.

[0053] In this embodiment, according to the determination of the number of printing height dots in step S1, the number of printing height dots is set to 800 nozzle holes: swathHeight = 800;

[0054] Feathering level A is 50%: softenLevelA = 50%; Feathering level B is 150%; softenLevelB = 150%.

[0055] In the calculation part, for example, assuming that you need to print an image with a length and width of 10cm x 10cm, and the diameter of each nozzle is 1mm, then the total number of print height dots required is: Print height dots = (image length / nozzle diameter) x (image width / nozzle diameter) = (10cm / 1mm) x (10cm / 1mm) = 1000 x 1000 = 1,000,000 nozzles.

[0056] Since the set print height dots are 800 nozzles, it needs to be adjusted according to the set feathering level. In the evaluation part, the actual print height dots required are calculated according to the set feathering level A: actual print height dots = set print height dots x feathering level A = 800 x 50% = 400 nozzles;

[0057] In the analysis part, according to the set feathering level B, the actual number of print height dots required is calculated: actual print height dots = set print height dots x feathering level B = 800 x 150% = 1200 nozzles;

[0058] In the statistics part, for example, when printing multiple images, the actual printing height points of each image are counted and the average value is calculated. Assuming there are 3 images, and their actual printing height points are 400, 500 and 600 nozzles respectively, then the average value is: average actual printing height points = (400 + 500 + 600) / 3 = 500 nozzles.

[0059] In this embodiment, the concept of feathering points is introduced according to step S2. The feathering points refer to the gradient height points used by the nozzle to complement the part under the printing height points, which are calculated from the feathering level. The calculation method of the feathering level within 100% is as follows:

[0060] Feathering points softenDots = swathHeight / 2 * softenLevel;

[0061] Calculation method for feathering level exceeding 100%:

[0062] Feathering points softenDots = swathHeight - swathHeight / 2 / softenLevel;

[0063] The feathering points for feathering level A are calculated as:

[0064] softenDotsA = swathHeight / 2 * softenLevelA = 200;

[0065] Calculate the feathering points for feathering level B:

[0066] softenDotsB = swathHeight - swathHeight / 2 / softenLevelB = 533.

[0067] Feathering level A effect: For feathering level A, use the feathering point softenDotsA to generate a gradient effect from top to bottom from light to dark in the template. Under the print height point, swathHeight = 800, the first 200 lines will show a grayscale gradient from light to dark, indicating the gradient level height points of the complementary part, and the remaining 600 lines can be set to dark color;

[0068] Feathering level B effect: For feathering level B, use feathering points softenDotsB to generate a gradient effect in the template for the entire height range swathHeight = 800. This gradient will show a grayscale gradient from light to dark and then to light from top to bottom.

[0069] It can realize the gradient effect dynamically generated according to the feathering level and the number of printing height points, which can be used in the printing or image processing process to achieve the required feathering effect and gradient effect.

[0070] In this embodiment, the gradient template is generated according to the calculation described in step S3, and the template width softenWidht=200 is set; the method for generating template A is to first generate a gradient image with a high grayscale of 200 (softenWidht) * 200 (softenDotsA) and a high color depth that gradually changes from 0 to 100% from top to bottom, and then use the error diffusion method to reduce the color depth of the image to 1 bit, fill it into rows 0 to 200 of the template, and then set rows 200 to 600 of the template to dark colors; finally, the previous gradient image is inverted and filled into rows 600 to 800 of the template, and the effect is as follows: Figure 2 As shown;

[0071] Template B is generated by first generating a high-bit color depth gradient image with a height of 200 (softenWidht) * 800 (swathHeight) from light to dark and then from dark to light. The generation must satisfy the average integral of the grayscale from top to bottom == (swathHeight- softenDotsB) / swathHeight = 33%; then the image is reduced to 1 bit using the error diffusion method and filled into the entire template. The effect is as follows Figure 3 shown.

[0072] The gradient effects of template A and template B can be obtained. Template A has a grayscale gradient from 0% to 100% in the upper part, a dark color in the middle part, and an inverted grayscale gradient in the lower part; Template B presents a grayscale gradient from light to dark and then to light in the entire height range.

[0073] In this embodiment, the error diffusion method creates an error matrix with the same size as the original image and an initial value of 0;

[0074] Traverse each pixel of the original image from the upper left corner, process each pixel, and then obtain the grayscale value of the current pixel based on the pixel value at the corresponding position in template A or template B;

[0075] Add the gray value of the current pixel to the value of the corresponding position in the error matrix to obtain a new gray value; then quantize the new gray value according to the number of bits required to reduce it to 1-bit color depth, that is, a binary image;

[0076] Subtract the quantized grayscale value from the new grayscale value, calculate the error, and then get the error value. The error value is distributed to the surrounding pixels according to certain weights, and their error matrix values ​​are updated. The Floyd-Steinberg algorithm is used to distribute the error value to the pixels to the right, below, lower right, and lower left of the current pixel according to certain weights.

[0077] Assume that the pixel value range of the original image is 0-255. Now take an 8x8 original image as an example, where the grayscale value of each pixel is as follows:

[0078] [100, 200, 50, 150, 70, 220, 180, 90

[0079] 80, 120, 160, 30, 240, 190, 100, 210

[0080] 60, 110, 140, 190, 70, 220, 180, 90

[0081] 80, 120, 130, 230, 240, 190, 100, 210

[0082] 60, 110, 140, 190, 70, 220, 180, 90

[0083] 80, 120, 160, 30, 240, 190, 100, 210

[0084] 60, 110, 140, 190, 70, 220, 180, 90

[0085] 80, 120, 130, 230, 240, 190, 100, 210]

[0086] Then create an error matrix with the same size as the original image and initial value 0: Error matrix: [0, 0, 0, 0, 0, 0, 0, 0

[0087] 0, 0, 0, 0, 0, 0, 0, 0

[0088] 0, 0, 0, 0, 0, 0, 0, 0

[0089] 0, 0, 0, 0, 0, 0, 0, 0

[0090] 0, 0, 0, 0, 0, 0, 0, 0

[0091] 0, 0, 0, 0, 0, 0, 0, 0

[0092] 0, 0, 0, 0, 0, 0, 0, 0

[0093] Next, iterate over each pixel of the original image starting from the top-left corner.

[0094] For each pixel, get the grayscale value of the current pixel according to the pixel value at the corresponding position in template A or template B. Assuming that template A is used, its corresponding pixel values ​​are as follows: Template A: [0, 0, 0 0, 0, 7 3, 5, 1]. Now process the first pixel (100) of the original image and calculate the grayscale value of the current pixel according to template A: Grayscale value of the current pixel = 100 + (0 / 16) = 100. Next, quantize according to the required number of bits and reduce it to 1-bit color depth, that is, a binary image.

[0095] Assuming that a threshold of 128 is used for quantization, the new grayscale value is: new grayscale value = 0 (if the grayscale value of the current pixel is less than 128), 255 (if the grayscale value of the current pixel is greater than or equal to 128), the new grayscale value is 0, because 100 is less than 128.

[0096] Then, calculate the error and get the error value: Error = Gray value of current pixel - New gray value = 100 -0 = 100. Distribute the error value to the surrounding pixels according to certain weights and update their error matrix values.

[0097] Use the Floyd-Steinberg algorithm to assign error values ​​to the pixels to the right, below, bottom right, and bottom left of the current pixel according to certain weights. Assume that the following error weights are used: Error weight: [0, 0, 0 0, 0, 7 3, 5, 1];

[0098] Update the error matrix value of the pixel in the second row and second column: error matrix += error * 7 / 16 = 0 + (100 * 7 / 16) = 475;

[0099] Update the error matrix value of the pixel in the first row and third column: error matrix += error * 3 / 16 = 0 + (100 * 3 / 16) = 175;

[0100] Update the error matrix value of the pixel in the second row and third column: error matrix += error * 5 / 16 = 0 + (100 * 5 / 16) = 325;

[0101] Update the error matrix value of the pixel in the third row and third column: error matrix += error * 1 / 16 = 0 + (100 * 1 / 16) = 25;

[0102] Now, continue to process the next pixel and repeat the above steps until the entire image is processed. Through the error diffusion method, the high-bit color depth image can be reduced to a 1-bit color depth image, and the storage space and transmission bandwidth can be reduced, and the 8-bit grayscale image can be reduced to a 1-bit grayscale image, that is, a binary image.

[0103] The error diffusion method can be used to reduce high-bit color depth images to 1-bit color depth images, which can reduce storage space and transmission bandwidth and maintain the visual quality of the image to a certain extent.

[0104] In this embodiment, two gradient data templates are dynamically generated according to step S2, a dynamic gradient effect is generated according to the input height and gradient level, and the specific value of each gradient level is calculated. According to the input height and gradient level, the height difference of each gradient level is calculated, and the color difference of each gradient level is calculated according to the height difference. Then, according to the color difference, a gradient effect algorithm is generated, and the specific color value of each gradient level is calculated by the algorithm. The calculated color value is applied to the corresponding height to generate a dynamic gradient effect.

[0105] By observing the generated dynamic gradient effect, testing and analyzing the generated dynamic gradient effect, analyzing the observed gradient effect, determining whether it meets the expected requirements, and then adjusting the algorithm or parameters for optimization.

[0106] By continuously observing, testing and analyzing, and adjusting algorithms or parameters according to actual needs, the dynamic gradient effect can be gradually optimized to make it more in line with expected requirements. Such an optimization process can help improve the quality and visual perception of the gradient effect to meet user needs.

[0107] In this embodiment, the template of custom height and gradient level is generated according to step S3.

[0108] First, obtain the parameters of the custom height and gradient level, and obtain the height and gradient level parameters of the template that the user wants to generate;

[0109] Generate a gradient sequence through linear interpolation. According to the obtained gradient level parameters, a gradient sequence is generated using the linear interpolation method. Specifically: Divide the gradient level parameters into equal intervals, and record the color value corresponding to each level. According to the custom height parameter, calculate the total height of the template to be generated. According to the total height and the gradient level parameter, calculate the height of each gradient level. For each gradient level, use the linear interpolation method to calculate the color value at the corresponding height. Arrange all the color values ​​according to the corresponding height to obtain the final gradient sequence.

[0110] Generate a template with a custom height and gradient level according to step S3. For example, if the custom height parameter is 1000 and the gradient level parameter is 5, the height and gradient level parameters of the generated template are 500 and the gradient level parameter is 3.

[0111] First, according to the gradient level parameters, the gradient level parameters are divided at equal intervals, that is, 5 gradient levels are divided into 3, and the color value corresponding to each level is obtained.

[0112] Assume that the color of gradient level 1 is red, the color of gradient level 2 is yellow, and the color of gradient level 3 is green. Then, according to the custom height parameter, the total height of the template to be generated is calculated to be 1000. According to the total height and gradient level parameters, the height of each gradient level is calculated.

[0113] In this example, the total template height is 500 and the gradient level is 3, so the height of each gradient level is 500 / 3 = 1667.

[0114] Next, for each gradient level, the linear interpolation method is used to calculate the color value at the corresponding height. For gradient level 1, the template height is 1667, and the color at the height of 1667 calculated by linear interpolation is red; for gradient level 2, the template height is 3333, and the color at the height of 3333 calculated by linear interpolation is yellow; for gradient level 3, the template height is 500, and the color at the height of 500 calculated by linear interpolation is green.

[0115] Finally, all color values ​​are arranged according to the corresponding heights to obtain the final gradient sequence, where the gradient sequence can be expressed as: red (height 0-1667), yellow (height 1667-3333), green (height 3333-500).

[0116] Through the above calculation and interpolation process, a template generated according to the custom height and gradient level parameters is obtained, in which the gradient sequence is arranged according to the corresponding height, and the color gradually changes from low height to high height.

[0117] A device for generating custom height and gradient levels includes a printer, at least one processor, at least one memory, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, the above-mentioned method is implemented.

[0118] A storage medium stores computer program instructions, which implement the above-mentioned method when the computer program instructions are executed by a processor. Example 2

[0119] This embodiment provides a method for generating a custom height and gradient level, which realizes flexible adjustment of element height and gradient level, and does not require a large number of pre-built-in templates, thereby reducing the space occupied by program storage. Users can realize custom height and gradient effects according to specific needs and interactive operations, and improve the visualization effect and user experience of the page. At the same time, by dynamically adjusting the feathering level, a more delicate and smooth transition effect can be achieved, which enhances the visual appeal and expressiveness of the elements.

[0120] A method to generate custom height and gradient levels, including

[0121] Determine the height attribute of the element. You can adjust the height of the element by setting a specific value or percentage. This can be achieved through CSS style or JavaScript code to set the height attribute of the element as required;

[0122] Determine the gradient level property of an element. You can adjust the gradient level of an element by setting a specific value or keyword. Similarly, you can use CSS styles or JavaScript code to set the gradient level property of an element.

[0123] Determine the infinite adjustment properties of the feathering level. According to the change requirements of the feathering level, different methods can be used to achieve the transition effect of elements between different feathering levels;

[0124] Adjust the opacity property of the element. You can adjust the gradient effect according to the change of feathering level by setting the opacity property of the element.

[0125] Adjust the shadow properties of the element. You can adjust the blur effect by setting the shadow (box-shadow) property of the element according to the change of the feathering level;

[0126] Adjust the filter properties of the element. You can set the filter properties of the element to adjust the blur, transparency and other effects according to the changes in the feathering level;

[0127] Adjust the clipping path property of the element. You can adjust the shape change effect according to the change of feathering level by setting the clipping path (clip-path) property of the element;

[0128] Determine the range and value method of custom height and gradient level. According to specific needs, you can set the range and value method of custom height and gradient level, such as setting the value range or using keywords to adjust;

[0129] Determine the change mode and trigger conditions of element height and gradient level. You can adjust the element height and gradient level based on user interaction, timer or other event triggering methods. At the same time, determine the trigger conditions of element height and gradient level, such as triggering the change of height and gradient level based on user behavior, page scroll position or other conditions;

[0130] Determine the default values ​​and animation effects of element height and gradient level. When the element is initialized, you can set the default height and gradient level. In addition, you can use CSS transition or animation properties to achieve a smooth transition effect of element height and gradient level to provide a better visual experience.

[0131] The above is only the preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as the preferred embodiment, it is not used to limit the present invention. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any brief modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still fall within the scope of the technical solution of the present invention.

Claims

1. A method for generating custom height and gradient levels, characterized in that: The steps include: S1: Determine the number of print height dots, based on the number of vertical print nozzles for each color of the printer nozzle and the custom feathering level, with a value range of 0%~∞%; S2: Calculate the gradient level height of the data template according to the value of step S1, and determine that two gradient data templates need to be dynamically generated for the feathering levels A and B; S3: Generate a gradient template based on the value of step S2. The template is essentially a monochrome image with a height equal to swathHeight and a 1-bit color depth. Dark pixel values ​​represent ink discharge from the nozzles, and light pixel values ​​represent no ink discharge from the nozzles. Dynamically generate two gradient data templates according to step S2, generate a dynamic gradient effect according to the input height and gradient level, calculate the specific value of each gradient level, calculate the height difference of each gradient level according to the input height and gradient level, calculate the color difference of each gradient level according to the height difference, and then generate a gradient effect algorithm according to the color difference, calculate the specific color value of each gradient level through the algorithm, apply the calculated color value to the corresponding height, and generate a dynamic gradient effect; By observing the generated dynamic gradient effect, testing and analyzing the generated dynamic gradient effect, analyzing the observed gradient effect, determining whether it meets the expected requirements, and then adjusting the algorithm or parameters for optimization; The step S3 generates a template with a custom height and gradient level, first obtaining the parameters of the custom height and gradient level, and obtaining the height and gradient level parameters of the template that the user wants to generate; Generate a gradient sequence through linear interpolation. According to the obtained gradient level parameters, a gradient sequence is generated using the linear interpolation method. Specifically: Divide the gradient level parameters into equal intervals, and record the color value corresponding to each level. According to the custom height parameter, calculate the total height of the template to be generated. According to the total height and the gradient level parameter, calculate the height of each gradient level. For each gradient level, use the linear interpolation method to calculate the color value at the corresponding height. Arrange all the color values ​​according to the corresponding height to obtain the final gradient sequence.

2. A method for generating custom heights and gradient levels according to claim 1, characterized in that: According to the step S1, the number of printing height dots is determined, and the number of printing height dots is set to 800 nozzle holes: swathHeight = 800; Feathering level A is 50%: softenLevelA = 50%; Feathering level B is 150%; softenLevelB = 150%.

3. A method for generating custom heights and gradient levels according to claim 1, characterized in that: According to step S2, the concept of feathering points is introduced. Feathering points refer to the gradient height points used by the nozzle to complement the part under the printing height points. It is calculated from the feathering level. The calculation method of the feathering level within 100% is as follows: Feathering points softenDots = swathHeight / 2 * softenLevel; Calculation method for feathering level exceeding 100%: Feathering points softenDots = swathHeight - swathHeight / 2 / softenLevel; The feathering points for feathering level A are calculated as: softenDotsA = swathHeight / 2 * softenLevelA = 200; Calculate the feathering points for feathering level B: softenDotsB = swathHeight - swathHeight / 2 / softenLevelB = 533.

4. A method for generating custom heights and gradient levels according to claim 1, characterized in that: Generate a gradient template according to the calculation described in step S3, and set the template width softenWidht = 200; the method for generating template A is to first generate a high-bit color depth gradient image with a height grayscale of 200 (softenWidht) * 200 (softenDotsA) and a gradient from 0 to 100% from top to bottom, and then use the error diffusion method to reduce the color depth of the image to 1 bit, fill it to rows 0 to 200 of the template, and then set all rows 200 to 600 of the template to dark colors; finally, invert the previous gradient image and fill it to rows 600 to 800 of the template; Template B is generated by first generating a high-depth gradient image with a height of 200 (softenWidht) * 800 (swathHeight) from light to dark and then from dark to light, and the generation must satisfy the average integral of the grayscale from top to bottom == (swathHeight- softenDotsB) / swathHeight = 33%; then the image is reduced to 1 bit in color depth using the error diffusion method and filled into the entire template.

5. A method for generating custom heights and gradient levels according to claim 4, characterized in that: The error diffusion method creates an error matrix with the same size as the original image and an initial value of 0; Traverse each pixel of the original image from the upper left corner, process each pixel, and then obtain the grayscale value of the current pixel based on the pixel value at the corresponding position in template A or template B; Add the gray value of the current pixel to the value of the corresponding position in the error matrix to obtain a new gray value; then quantize the new gray value according to the number of bits required to reduce it to 1-bit color depth, that is, a binary image; Subtract the quantized grayscale value from the new grayscale value, calculate the error, and then get the error value. The error value is distributed to the surrounding pixels according to certain weights, and their error matrix values ​​are updated. The Floyd-Steinberg algorithm is used to distribute the error value to the pixels to the right, below, lower right, and lower left of the current pixel according to certain weights.

6. A device for generating custom height and gradient levels, characterized in that: The invention comprises a printer, at least one processor, at least one memory and computer program instructions stored in the memory, and when the computer program instructions are executed by the processor, the method according to any one of claims 1 to 5 is implemented.

7. A storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Feathering mask template, generation method and device thereof, and readable storage medium

    CN114283146A

  • Automatic adjustment method, device and equipment of feathering template and storage medium

    CN115071286A