Vector Graphics Filling Using Bit Shifting to Reduce CPU Load
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing methods for filling vector graphs in FLASH format are computationally intensive, requiring significant CPU resources due to the need for frequent coordinate transformations and division operations, which consume substantial processing capacity.
Innovation Solution
A method and device that map vector graphs into a new drawing coordinate system with 1/2n pixel resolution, using a transformation matrix and parameter A=2n/K, allowing for reduced division operations by replacing them with bit shifting, and accounting for tailoring errors to minimize CPU resource consumption.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If vertex coordinates are transformed through matrix operations and scan conversion is applied to convert polygon into scan lines, then the polygon can be accurately filled in the drawing window, but the division operation during coloring consumes considerable CPU resource and processing time
Solution Approach 1:
The patent changes the coordinate system parameter from 1/20 pixel to 1/2n pixel by introducing a transformation parameter A=2n/K. This parameter change allows the system to perform operations at a coarser resolution level, reducing the number of division operations needed during the coloring phase while maintaining acceptable filling accuracy through the transformed coordinate system.
Solution Approach 2:
The patent replaces the mechanical division operation with a bit shifting operation. By transforming coordinates to the new drawing coordinate system with 1/2n pixel resolution, the division by K is substituted with a right shift by n bits, which is a much faster CPU operation that consumes significantly less processing time and resource.
2Measurement precision
If all operations are performed with 1/20 pixel coordinates before coloring, then the polygon can be accurately mapped and converted, but the division operation by 20 during coloring consumes considerable CPU resource
Solution Approach 1:
The patent performs preliminary coordinate transformation before the coloring operation. By mapping the polygon into a new drawing coordinate system with 1/2n pixel resolution using the transformation parameter A=2n/K, the system prepares the coordinates in advance to avoid division operations during the critical coloring phase, thereby improving CPU processing efficiency.
Solution Approach 2:
The patent substitutes the division operation with a bit shifting operation. The transformation parameter A=2n/K enables the system to replace division by K with a right shift by n bits, which is a much faster operation that significantly improves CPU processing efficiency while maintaining coordinate precision through the transformed coordinate system.
3Manufacturing precision
If the polygon is tailored with respect to the drawing window and scan conversion is applied, then the polygon can be accurately converted into scan lines, but the entire process requires great processing capacity of the CPU
Solution Approach 1:
The patent changes the resolution parameter from 1/20 pixel to 1/2n pixel by introducing the transformation parameter A=2n/K. This parameter change reduces the computational complexity of the scan conversion process by performing operations at a coarser resolution level, thereby reducing the CPU processing capacity required while maintaining acceptable polygon conversion accuracy.
Solution Approach 2:
The patent replaces division operations with bit shifting operations throughout the coordinate transformation and scan conversion process. By using the transformation parameter A=2n/K, the system substitutes division by K with right shifts by n bits, which are much faster CPU operations that significantly reduce the processing capacity required while maintaining accurate polygon conversion through the transformed coordinate system.
Data Source
AI summary
A method and a device for reducing the waste of the central process unit (CPU) resource during the filling process of a vector graphic, and the method includes: parsing the vector graphic to obtain a series of polygons; mapping the polygons into a new drawing coordinate whose unit is 1/2n pixel using a transform parameter and a transform matrix, while updating an original drawing window into the new drawing coordinate at the same time, wherein the transform parameter is A, A=2n/K, n is a shift parameter, the unit of the vertex coordinate of the polygon is 1/K pixel, and n, K are valued for natural numbers; obtaining the portions of the polygons located in the new drawing window in the new drawing coordinate; transforming the portions of the polygons located in the new drawing window in the new drawing coordinate into a group of scan segments; and shifting the original code of the coordinate of the scan segments to right by n bit, and rendering the pixels of the shifted scan segments. In the embodiment of the present invention, when the pixels covered by the scanning line are rendered, and the division operations are replaced with the manner of shifting the coordinate values, and the generated polygon cutting error is transferred to the calculating process before the rendering, the division operation is reduced in the precondition of ensuring the result is correct, so that the occupation of the CPU resource is reduced.


