Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, one aspect of the present invention is to provide a method for setting primitive drawing attributes.
Another aspect of the present invention is to provide a system for setting primitive drawing attributes.
Yet another aspect of the invention is directed to a computer device.
Yet another aspect of the present invention is to provide a computer-readable storage medium.
In view of the above, according to an aspect of the present invention, a method for setting a primitive drawing attribute is provided, including: scanning the page, and judging whether the page has overprint attributes or not; when the page has the overprint attribute, acquiring a primitive to be drawn and judging whether the primitive to be drawn is overlapped with the background of the page; when the primitive to be drawn is overlapped with the background of the page, judging whether the page needs to be subjected to delayed color correction or not according to the attribute of the primitive; when the page needs to be delayed and corrected, setting a primitive drawing area on the page as a transparent area; and performing overprinting calculation on the pixel to be drawn in the transparent area to obtain a pixel dot matrix, performing color correction on the pixel dot matrix, and finally outputting the pixel dot matrix.
The invention provides a setting method of primitive drawing attributes, which comprises the steps of firstly determining whether a page has overprint attributes, ending a subsequent flow when the page does not have the overprint attributes, saving system resources, judging whether a primitive to be drawn is overlapped with a page background when the page has the overprint attributes, if the primitive is overlapped with the page background, indicating that delayed color correction processing is possibly needed, dividing a primitive drawing area of the page into a non-transparent area and a transparent area after the delayed color correction processing is determined, namely, forcing the primitive drawing area meeting the overprint effect into the transparent area, avoiding the primitive color management time when the page is interpreted, forcing the primitive which is the transparent area to be subjected to overprint calculation when the transparency is removed, and carrying out color management when a dot matrix obtained during assembly is the final display color of the primitive. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
The method for setting the primitive drawing attribute according to the present invention may further have the following technical features:
in the above technical solution, preferably, when the page has the overprint attribute, the method further includes: establishing a resource statistical area table; and carrying out doubling reduction processing on the resource statistical region table.
According to the technical scheme, after the page is judged to have the overprint attribute, a resource statistical area table is established and used for providing basis for judging whether the graphic element to be drawn is overlapped with the page background. The size of the area table is in direct proportion to the output resolution, and when the output resolution is larger, the area table is necessarily large, so if the resource statistics is carried out when the output resolution is higher or the number of sub-pages is very large, a larger memory is occupied, and the resource statistics area table is subjected to doubling processing.
In any of the above technical solutions, preferably, the step of establishing the resource statistics area table specifically includes: the method comprises the steps of partitioning a page according to a first preset height and a first preset width to obtain a first number of page drawing areas; the page is divided into blocks according to a second preset height and a second preset width to obtain a second number of page blocks; recording the page drawing area and the page block to obtain a resource statistical area table; wherein the first number is less than the second number.
According to the technical scheme, the page is firstly partitioned according to a first preset height and width, for example, the page is partitioned into a plurality of page drawing areas according to the width × and the height 32 × 16, then the page is partitioned again according to a second preset height and width, for example, the page is partitioned into a plurality of page blocks according to the width × and the height 8 × 8, the partitioned page drawing areas and the page blocks are recorded in a table to form a resource statistical area table, so that 1 bit in the drawing table represents one page drawing area of the 32 × 16, 0 represents that the area is not covered by a primitive, and 1 represents that the area is covered by the primitive.
In any of the above technical solutions, preferably, the step of obtaining the primitive to be drawn and determining whether the primitive to be drawn overlaps with the background of the page includes: acquiring a primitive to be drawn, determining the drawing range of the primitive to be drawn, and determining a page drawing area corresponding to the drawing range in the resource statistical area table; counting the number of page blocks covered by the drawing range in the resource counting area table; if the number of the page blocks covered by the drawing range is larger than the preset number, determining that the primitive to be drawn is overlapped with the background of the page; and if the number of the page blocks covered by the drawing range is less than or equal to the preset number, determining that the primitive to be drawn does not overlap with the background of the page.
According to the technical scheme, whether the primitive to be drawn covers a certain page or a certain page drawing area and the surplus page blocks with the preset number are searched in the resource statistical area table, if so, the primitive to be drawn is determined to be overlapped with the background of the page, and whether the primitive to be drawn is overlapped is accurately judged. The judgment frequency of whether coverage occurs can be set, namely more than one judgment can be carried out to ensure the accuracy of the judgment result.
In any of the above technical solutions, preferably, the step of performing the doubling-down process on the resource statistics area table specifically includes setting a height of the resource statistics area table according to a first formula and setting a width of the resource statistics area table according to a second formula, where the first formula is Y ═ H '× D)/H' × D, where Y represents the height of the resource statistics area table, H represents the height of the page, H 'represents the first preset height, and D represents the preset multiplying power, and the second formula is X ═ W' × D)/W '× D/W, where X represents the width of the resource statistics area table, W represents the width of the page, W' represents the first preset width, and W ″ represents the second preset width.
In this technical solution, the magnification is an empirical value, and can be obtained by a formula D ═ MaxResolution +600.0)/600.0, where MaxResolution is the maximum resolution of the page. And calculating according to the formula to obtain the height and the width of the resource statistical area table, namely performing doubling processing on the resource statistical area table to reduce the consumption of memory resources.
According to another aspect of the present invention, a system for setting primitive drawing attributes is provided, including: the scanning unit is used for scanning the page and judging whether the page has overprint attributes or not; the primitive acquiring unit is used for acquiring a primitive to be drawn and judging whether the primitive to be drawn is overlapped with the background of the page or not when the page has the overprint attribute; the judging unit is used for judging whether the page needs to be subjected to delayed color correction according to the attribute of the primitive when the primitive to be drawn is overlapped with the background of the page; the setting unit is used for setting a primitive drawing area on the page as a transparent area when the delayed color correction needs to be carried out on the page; and the processing unit is used for performing overprinting calculation on the pixel to be drawn in the transparent area to obtain a pixel dot matrix, performing color correction on the pixel dot matrix, and finally outputting the pixel dot matrix.
The system for setting the primitive drawing attribute comprises the steps of firstly determining whether a page has the overprint attribute, finishing a subsequent flow when the page does not have the overprint attribute, saving system resources, judging whether a primitive to be drawn is overlapped with a page background when the page has the overprint attribute, if the primitive to be drawn is overlapped with the page background, indicating that delayed color correction processing is possibly needed, dividing a primitive drawing area of the page into a non-transparent area and a transparent area after the delayed color correction processing is determined, namely, forcing the primitive drawing area meeting the overprint effect into the transparent area, avoiding the time of primitive color management when the page is interpreted, forcing the primitive which is the transparent area to be subjected to overprint calculation when the transparency is removed, and carrying out color management when a dot matrix obtained during assembly is the final display color of the primitive. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
The system for setting the primitive drawing attribute according to the present invention may further have the following technical features:
in the above technical solution, preferably, the method further includes: the establishing unit is used for establishing a resource statistical area table when the page has the overprint attribute; and carrying out reduction processing on the resource statistical area table.
According to the technical scheme, after the page is judged to have the overprint attribute, a resource statistical area table is established and used for providing basis for judging whether the graphic element to be drawn is overlapped with the page background. The size of the area table is in direct proportion to the output resolution, and when the output resolution is larger, the area table is necessarily large, so if the resource statistics is carried out when the output resolution is higher or the number of sub-pages is very large, a larger memory is occupied, and the resource statistics area table is subjected to doubling processing.
In any of the above technical solutions, preferably, the establishing unit includes: the page blocking unit is used for blocking the pages according to a first preset height and a first preset width to obtain a first number of page drawing areas; partitioning the page according to a second preset height and a second preset width to obtain a second number of page blocks; the establishing unit is specifically used for recording the page drawing area and the page block to obtain a resource statistical area table; wherein the first number is less than the second number.
According to the technical scheme, the page is firstly partitioned according to a first preset height and width, for example, the page is partitioned into a plurality of page drawing areas according to the width × and the height 32 × 16, then the page is partitioned again according to a second preset height and width, for example, the page is partitioned into a plurality of page blocks according to the width × and the height 8 × 8, the partitioned page drawing areas and the page blocks are recorded in a table to form a resource statistical area table, so that 1 bit in the drawing table represents one page drawing area of the 32 × 16, 0 represents that the area is not covered by a primitive, and 1 represents that the area is covered by the primitive.
In any of the above technical solutions, preferably, the primitive obtaining unit is specifically configured to obtain a primitive to be drawn, determine a drawing range of the primitive to be drawn, and determine a page drawing area corresponding to the drawing range in the resource statistics area table; a primitive acquisition unit comprising: the statistical unit is used for counting the number of page blocks covered by the drawing range in the resource statistical area table; the determining unit is used for determining that the primitive to be drawn is overlapped with the background of the page if the number of the page blocks covered by the drawing range is larger than the preset number; and if the number of the page blocks covered by the drawing range is less than or equal to the preset number, determining that the primitive to be drawn does not overlap with the background of the page.
According to the technical scheme, whether the primitive to be drawn covers a certain page or a certain page drawing area and the surplus page blocks with the preset number are searched in the resource statistical area table, if so, the primitive to be drawn is determined to be overlapped with the background of the page, and whether the primitive to be drawn is overlapped is accurately judged. The judgment frequency of whether coverage occurs can be set, namely more than one judgment can be carried out to ensure the accuracy of the judgment result.
In any of the foregoing technical solutions, preferably, the establishing unit is specifically configured to set a height of the resource statistics area table according to a first formula and a width of the resource statistics area table according to a second formula, where the first formula is Y ═ H + H '× D)/H' × D, where Y represents the height of the resource statistics area table, H represents the height of a page, H 'represents the first preset height, and D represents a preset magnification, and the second formula is X ═ W + W' × D)/W '× D/W ″, where X represents the width of the resource statistics area table, W represents the width of the page, W' represents the first preset width, and W ″ represents the second preset width.
In this technical solution, the magnification is an empirical value, and can be obtained by a formula D ═ MaxResolution +600.0)/600.0, where MaxResolution is the maximum resolution of the page. And calculating according to the formula to obtain the height and the width of the resource statistical area table, namely performing doubling processing on the resource statistical area table to reduce the consumption of memory resources.
According to a further aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for setting primitive drawing attributes according to any one of the above when executing the computer program.
The computer equipment provided by the invention has the advantages that whether the page has the overprint attribute or not is determined when the processor executes the computer program, the subsequent flow is ended when the page does not have the overprint attribute, the system resource is saved, whether the primitive to be drawn is overlapped with the page background or not is judged when the overprint attribute exists, if the primitive to be drawn is overlapped, the delayed color correction processing is possibly required, the primitive drawing area of the page is divided into a non-transparent area and a transparent area after the delayed color correction processing is determined, namely the primitive drawing area meeting the overprint effect is forced to be the transparent area, the time for managing the primitive colors during page explanation is avoided, the primitive forced to be the transparent area is subjected to overprint calculation when the transparency is removed, the dot matrix obtained during assembly is the final display color of the primitive, and then the color management is carried. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
According to a further aspect of the present invention, a computer-readable storage medium is proposed, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the method for setting primitive drawing attributes according to any one of the above.
The computer readable storage medium provided by the invention can be used for determining whether a page has overprint attributes or not when a computer program is executed by a processor, ending a subsequent process when the page does not have the overprint attributes, saving system resources, judging whether a primitive to be drawn is overlapped with a page background or not when the page has the overprint attributes, if the primitive to be drawn is overlapped with the page background, indicating that delayed color correction processing is possibly needed, dividing a primitive drawing area of the page into a non-transparent area and a transparent area after the delayed color correction processing is determined to be needed, namely, forcing the primitive drawing area meeting the overprint effect to be the transparent area, avoiding the time for managing the primitive color when the page is interpreted, forcing the primitive to be the transparent area to perform overprint calculation firstly when the transparency is removed, and obtaining a dot matrix which is the final display color of the primitive when the. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
An embodiment of a first aspect of the present invention provides a method for setting a primitive drawing attribute, and fig. 1 illustrates a flowchart of the method for setting a primitive drawing attribute according to an embodiment of the present invention. Wherein, the method comprises the following steps:
step 102, scanning a page, and judging whether the page has overprint attributes or not;
104, when the page has the overprint attribute, acquiring a primitive to be drawn and judging whether the primitive to be drawn is overlapped with the background of the page;
step 106, when the primitive to be drawn is overlapped with the background of the page, judging whether the page needs to be delayed and corrected according to the attribute of the primitive;
step 108, when the page needs to be delayed and corrected, setting a primitive drawing area on the page as a transparent area;
and 110, performing overprinting calculation on the pixel to be drawn in the transparent area to obtain a pixel dot matrix, performing color correction on the pixel dot matrix, and finally outputting the pixel dot matrix.
The invention provides a setting method of primitive drawing attributes, which comprises the steps of firstly determining whether a page has overprint attributes, ending a subsequent flow when the page does not have the overprint attributes, saving system resources, judging whether a primitive to be drawn is overlapped with a page background when the page has the overprint attributes, if the primitive is overlapped with the page background, indicating that delayed color correction processing is possibly needed, dividing a primitive drawing area of the page into a non-transparent area and a transparent area after the delayed color correction processing is determined, namely, forcing the primitive drawing area meeting the overprint effect into the transparent area, avoiding the primitive color management time when the page is interpreted, forcing the primitive which is the transparent area to be subjected to overprint calculation when the transparency is removed, and carrying out color management when a dot matrix obtained during assembly is the final display color of the primitive. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
Fig. 2 is a flowchart illustrating a method for setting primitive drawing attributes according to another embodiment of the present invention. Wherein, the method comprises the following steps:
step 202, scanning the page, and determining whether the page has an overprint attribute.
Step 204, when the page has the overprint attribute, establishing a resource statistical area table; and carrying out doubling reduction processing on the resource statistical region table.
In step 204 of this embodiment, when it is determined that the page has the overprint attribute, a resource statistics area table is established for providing a basis for determining whether the primitive to be drawn overlaps with the page background. The size of the area table is in direct proportion to the output resolution, and when the output resolution is larger, the area table is necessarily large, so if the resource statistics is carried out when the output resolution is higher or the number of sub-pages is very large, a larger memory is occupied, and the resource statistics area table is subjected to doubling processing.
And step 206, acquiring a primitive to be drawn and judging whether the primitive to be drawn is overlapped with the background of the page.
And 208, when the primitive to be drawn is overlapped with the background of the page, judging whether the page needs to be delayed and corrected according to the attribute of the primitive.
The method for judging whether the page needs to be delayed and corrected according to the attributes of the primitives comprises the step of judging whether the page needs to be delayed and corrected according to the types, the color spaces, the overprint attributes and the like of the primitives, namely whether the page needs to be forced to be a transparent area. The judgment is made according to the rules described in the PDF manual.
And step 210, when delayed color correction needs to be performed on the page, setting a primitive drawing area on the page as a transparent area.
And 212, performing overprinting calculation on the pixel to be drawn in the transparent area to obtain a pixel dot matrix, performing color correction on the pixel dot matrix, and finally outputting the pixel dot matrix.
Fig. 3 is a flowchart illustrating a method for setting primitive drawing attributes according to still another embodiment of the present invention. Wherein, the method comprises the following steps:
step 302, scan the page, determine whether the page has an overprint attribute.
Step 304, when the page has the overprint attribute, partitioning the page according to a first preset height and a first preset width to obtain a first number of page drawing areas; the page is divided into blocks according to a second preset height and a second preset width to obtain a second number of page blocks; recording the page drawing area and the page block to obtain a resource statistical area table; wherein the first number is less than the second number.
In step 304 of this embodiment, when it is determined that the page has the overprint attribute, a resource statistics area table is established for providing a basis for determining whether a primitive to be drawn overlaps with the page background, specifically, the page is first partitioned into a plurality of page drawing areas according to a first preset height and width, for example, the page is partitioned into a plurality of page blocks according to a width × and a height 32 × 16, then the page is partitioned into a plurality of page blocks according to a second preset height and width, for example, the page is partitioned into a plurality of page blocks according to a width × and a height 8 × 8, and the partitioned page drawing areas and page blocks are recorded in the table to form the resource statistics area table, so that 1 bit in the drawing table represents one page drawing area of 32 × 16, 0 represents that the area is not covered by the primitive, and 1 represents that the area is covered by the primitive.
And step 306, setting the height of the resource statistical area table according to a first formula and the width of the resource statistical area table according to a second formula according to the preset multiplying power.
The first formula is (H + H '× D)/H' × D, wherein Y represents the height of the resource statistic region table, H represents the height of the page, H 'represents the first preset height, and D represents the preset multiplying power, and the second formula is (W + W' × D)/W '× D/W', wherein X represents the width of the resource statistic region table, W represents the width of the page, W 'represents the first preset width, and W' represents the second preset width.
In step 306 of this embodiment, the size of the region table is proportional to the output resolution, and when the output resolution is larger, the region table is inevitably large, so if the resource statistics is performed when the output resolution is higher or the number of sub-pages is very large, a larger memory is occupied, and the resource statistics region table is doubled. The magnification is an empirical value, and can be obtained by the formula D ═ max resolution +600.0)/600.0, where max resolution is the maximum resolution of the page. And calculating according to the formula to obtain the height and the width of the resource statistical area table, namely performing doubling processing on the resource statistical area table to reduce the consumption of memory resources.
And 308, acquiring a primitive to be drawn, determining the drawing range of the primitive to be drawn, and determining the corresponding page drawing area of the drawing range in the resource statistical area table.
Step 310, counting the number of page blocks covered by the drawing range in the resource counting area table; if the number of the page blocks covered by the drawing range is larger than the preset number, determining that the primitive to be drawn is overlapped with the background of the page; and if the number of the page blocks covered by the drawing range is less than or equal to the preset number, determining that the primitive to be drawn does not overlap with the background of the page.
In step 308 and step 310 of this embodiment, it is determined whether the primitive to be drawn overlaps the background of the page if the primitive to be drawn overlaps the page in the resource statistics area table by looking up whether the primitive to be drawn covers a certain page or some page drawing areas with an excessive preset number of page blocks, so as to accurately determine whether the primitive to be drawn overlaps the background of the page. The judgment frequency of whether coverage occurs can be set, namely more than one judgment can be carried out to ensure the accuracy of the judgment result.
And step 312, when the primitive to be drawn overlaps the background of the page, judging whether the page needs to be delayed and color-corrected according to the attribute of the primitive.
The method for judging whether the page needs to be delayed and corrected according to the attributes of the primitives comprises the step of judging whether the page needs to be delayed and corrected according to the types, the color spaces, the overprint attributes and the like of the primitives, namely whether the page needs to be forced to be a transparent area. The judgment is made according to the rules described in the PDF manual.
Step 314, when the page needs to be delayed and corrected, setting a primitive drawing area on the page as a transparent area; and performing overprinting calculation on the pixel to be drawn in the transparent area to obtain a pixel dot matrix, performing color correction on the pixel dot matrix, and finally outputting the pixel dot matrix.
In a second aspect of the present invention, a primitive drawing attribute setting system is proposed, and fig. 4 shows a schematic block diagram of a primitive drawing attribute setting system 400 according to an embodiment of the present invention. Among other things, the system 400 includes:
a scanning unit 402, configured to scan a page and determine whether the page has an overprint attribute; a primitive obtaining unit 404, configured to obtain a primitive to be drawn and determine whether the primitive to be drawn overlaps with a background of the page when the page has an overprint attribute; the judging unit 406 is configured to, when a primitive to be drawn overlaps with a background of the page, judge whether to perform delayed color correction on the page according to an attribute of the primitive; the setting unit 408 is configured to set a primitive drawing area on the page as a transparent area when the page needs to be delayed and color corrected; and the processing unit 410 is configured to perform overprinting calculation on the primitive to be drawn in the transparent area to obtain a primitive dot matrix, perform color correction on the primitive dot matrix, and finally output the primitive dot matrix.
The system 400 for setting the primitive drawing attributes provided by the invention firstly determines whether the page has the overprint attributes, ends the subsequent flow when the page does not have the overprint attributes, saves system resources, judges whether the primitive to be drawn is overlapped with the page background when the overprint attributes exist, if the primitive to be drawn is overlapped with the page background, the delay color correction processing is possibly required, divides the primitive drawing area of the page into a non-transparent area and a transparent area after the delay color correction processing is determined, namely, the primitive drawing area meeting the overprint effect is forced to be the transparent area, the time for managing the primitive colors when the page is explained is avoided, the primitive forced to be the transparent area is subjected to overprint calculation when the transparency is removed, and the obtained dot matrix is the final display color when the dot matrix is assembled, and then the color management is carried out. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
Fig. 5 shows a schematic block diagram of a primitive rendering attribute setup system 500 according to another embodiment of the present invention. Among other things, the system 500 includes:
a scanning unit 502, configured to scan a page and determine whether the page has an overprint attribute;
an establishing unit 504, configured to establish a resource statistics area table when the page has the overprint attribute; and carrying out reduction processing on the resource statistical area table;
the establishing unit 504 specifically includes: the blocking unit 542 is configured to block the page according to a first preset height and a first preset width to obtain a first number of page drawing areas; partitioning the page according to a second preset height and a second preset width to obtain a second number of page blocks; an establishing unit 504, specifically configured to record a page drawing area and a page block, so as to obtain a resource statistics area table; wherein the first number is less than the second number;
the establishing unit 504 is further configured to set a height of the resource statistics area table according to a first formula and a width of the resource statistics area table according to a second formula, where the first formula is Y ═ H '× D)/H' × D, where Y denotes the height of the resource statistics area table, H denotes the height of the page, H 'denotes the first preset height, and D denotes a preset magnification, and the second formula is X ═ W' × D)/W '× D/W ", where X denotes the width of the resource statistics area table, W denotes the width of the page, W' denotes the first preset width, and W ″ denotes the second preset width;
a primitive obtaining unit 506, configured to obtain a primitive to be drawn and determine whether the primitive to be drawn overlaps with a background of the page; the system comprises a resource statistical area table, a drawing range table and a drawing area table, wherein the resource statistical area table is used for storing a resource statistical area table;
the primitive obtaining unit 506 includes: a counting unit 562, configured to count the number of page blocks covered by the drawing range in the resource counting area table; a determining unit 564, configured to determine that a primitive to be drawn overlaps with a background of the page if the number of page blocks covered by the drawing range is greater than a preset number; if the number of the page blocks covered by the drawing range is less than or equal to the preset number, determining that the primitive to be drawn does not overlap with the background of the page;
a judging unit 508, configured to judge whether to perform delayed color correction on the page according to an attribute of the primitive when the primitive to be drawn overlaps with the background of the page;
a setting unit 510, configured to set a primitive drawing area on a page as a transparent area when delayed color correction needs to be performed on the page;
and the processing unit 512 is configured to perform overprinting calculation on the primitive to be drawn in the transparent area to obtain a primitive dot matrix, perform color correction on the primitive dot matrix, and finally output the primitive dot matrix.
Specifically, the page is partitioned according to a first preset height and width, for example, the page is partitioned into a plurality of page drawing areas according to a width × and a height 32 × 16, and then the page is partitioned again according to a second preset height and width, for example, the page is partitioned into a plurality of page blocks according to a width × and a height 8 × 8, and the partitioned page drawing areas and page blocks are recorded in the table to form the resource statistical area table, so that 1 bit in the drawing table represents one page drawing area of 32 × 16, 0 represents that the area is not covered by the graphics primitive, and 1 represents that the area is covered by the graphics primitive.
The size of the area table is in direct proportion to the output resolution, and when the output resolution is larger, the area table is necessarily large, so if the resource statistics is carried out when the output resolution is higher or the number of sub-pages is very large, a larger memory is occupied, and the resource statistics area table is subjected to doubling processing. The magnification is an empirical value, and can be obtained by the formula D ═ max resolution +600.0)/600.0, where max resolution is the maximum resolution of the page. And calculating according to the formula to obtain the height and the width of the resource statistical area table, namely performing doubling processing on the resource statistical area table to reduce the consumption of memory resources.
Whether the primitive to be drawn covers a certain page or a certain page drawing area with excessive page blocks of preset quantity is searched in the resource statistical area table, if so, the primitive to be drawn is determined to be overlapped with the background of the page, and whether the primitive to be drawn is overlapped is accurately judged. The judgment frequency of whether coverage occurs can be set, namely more than one judgment can be carried out to ensure the accuracy of the judgment result.
In embodiments of the third aspect of the present invention, a computer device is provided, and fig. 6 shows a schematic block diagram of a computer device 600 according to an embodiment of the present invention. Wherein the computer device 600 comprises:
a memory 602, a processor 604 and a computer program stored on the memory 602 and executable on the processor 604, the processor 604 implementing the steps of the method for setting primitive drawing attributes according to any one of the above when executing the computer program.
In the computer device 600 provided by the present invention, when the processor 604 executes the computer program, it is determined whether the page has the overprint attribute, when the page does not have the overprint attribute, the subsequent process is terminated, the system resources are saved, when the page has the overprint attribute, it is determined whether the primitive to be drawn overlaps with the page background, if the primitive overlaps with the page background, it indicates that the color correction processing may need to be delayed, after the color correction processing needs to be delayed, the primitive drawing area of the page is divided into a non-transparent area and a transparent area, that is, the primitive drawing area satisfying the overprint effect is forced to be the transparent area, the time for managing the primitive color during page interpretation is avoided, when the transparency is removed, the primitive forced to be the transparent area is subjected to the overprint calculation, and the dot matrix obtained during assembly is the final rendering. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
An embodiment of the fourth aspect of the present invention proposes a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for setting primitive drawing attributes according to any one of the above.
The computer readable storage medium provided by the invention can be used for determining whether a page has overprint attributes or not when a computer program is executed by a processor, ending a subsequent process when the page does not have the overprint attributes, saving system resources, judging whether a primitive to be drawn is overlapped with a page background or not when the page has the overprint attributes, if the primitive to be drawn is overlapped with the page background, indicating that delayed color correction processing is possibly needed, dividing a primitive drawing area of the page into a non-transparent area and a transparent area after the delayed color correction processing is determined to be needed, namely, forcing the primitive drawing area meeting the overprint effect to be the transparent area, avoiding the time for managing the primitive color when the page is interpreted, forcing the primitive to be the transparent area to perform overprint calculation firstly when the transparency is removed, and obtaining a dot matrix which is the final display color of the primitive when the. The final output effect of the primitive is obtained first, and then the color correction of the dot matrix level is carried out, so that the change of the color channel number of the primitive before the overprinting is prevented, and the influence on the final overprinting effect is reduced.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.