A method and system for recognizing and setting a nine-square grid UI map
Patent Information
- Application Number
- CN202211456558.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-11-21
AI Technical Summary
[0022]本发明的有益效果在于:本发明能对九宫格UI贴图进行识别,并将识别到的九宫格UI贴图自动设置纵向九宫拉升边界或者设置横向九宫拉升边界,从而无需人为进行识别操作,提高了工作效率的同时,识别率准确。
Smart Images

Figure CN118072047B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game UI development technology, and in particular to a method and system for recognizing and setting nine-grid UI textures. Background Technology
[0002] The purpose of UI textures is to describe the material of an object's surface. The textures and materials created interact with light in the game engine (virtual world).
[0003] In game UI development, it is common to encounter 3x3 grid UI textures that need to have their grid boundaries set. Manually identifying which textures are 3x3 grid textures and setting their boundaries is particularly time-consuming, especially in large projects with a large number of 3x3 grid textures. Therefore, it is necessary to use tools to automatically identify 3x3 grid textures and set their boundaries. Summary of the Invention
[0004] To overcome the above problems, the purpose of this invention is to provide a method for recognizing and setting nine-grid UI textures. This method can automatically set the boundaries of nine-grid UI textures, thereby improving work efficiency.
[0005] This invention is implemented using the following scheme: a method for recognizing and setting a nine-grid UI texture, the method comprising the following steps: Step S1, reading all UI texture format resources in the game project;
[0006] Step S2: Read all pixels of each texture and cache them;
[0007] Step S3: A nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture.
[0008] Step S4: Read the cached pixels of each UI texture and determine whether the number of rows of consecutive identical pixels in the horizontal direction is greater than the threshold. If yes, the UI texture can be horizontally graticulated, and the horizontal graticule boundary is set to the start and end rows of consecutive identical pixels; then proceed to step S5; otherwise, directly execute step S5.
[0009] Step S5: Determine whether the number of columns with consecutive identical pixels in the vertical direction is greater than the threshold. If yes, the texture can be vertically stretched into a nine-grid layout, and the vertical nine-grid layout boundary is set to the start and end columns of consecutive identical pixels; and proceed to step S6; otherwise, the UI texture cannot be horizontally stretched into a nine-grid layout or vertically stretched into a nine-grid layout, and no operation is performed.
[0010] Step S6: Determine if all UI textures have been evaluated. If yes, end the process; otherwise, continue to evaluate the next UI texture.
[0011] Furthermore, step S4 is further specified as follows: read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, and set each row of pixels read as the starting row pixel. Then, start reading each row of pixels from the next row of pixels of the starting row pixel and compare it with the starting row pixel. If the next row of pixels of the starting row pixel is completely the same as the starting row, increment the number of identical pixels in each row by one until a row of pixels is different from the starting row pixel. Then, judge whether the number of rows of identical pixels is greater than the threshold. If it is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid, and set the horizontal boundary of the 3x3 grid as the ending row of pixels from the starting row pixel to the last identical pixel. If it is less than the threshold, the starting row pixel becomes the next row pixel, and continue to read each row of pixels from the next row of pixels of the starting row pixel and compare it. If the number of consecutive identical pixels in each row is less than the threshold, the texture cannot be horizontally scaled up in a 3x3 grid. If the number of consecutive identical pixels in each row is greater than the threshold, the texture is a texture that can be horizontally scaled up in a 3x3 grid.
[0012] Furthermore, step S5 is further specified as follows: In the pixels cached in each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels of the starting column pixel and compared with the starting column pixel. If the next column of pixels of the starting column pixel is completely the same as the starting column, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically graticule-scaled, and the vertical boundary of the graticule is set as the end column of pixels from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels of the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically graticule-scaled. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically graticule-scaled.
[0013] The present invention also provides a system for recognizing and setting nine-grid UI textures, the system comprising: a texture reading module, a pixel caching module, a threshold setting module, a texture horizontal setting module, a texture vertical setting module, and a judgment module;
[0014] The texture reading module reads all UI texture resources in the game project;
[0015] The pixel caching module reads all pixels of each texture and caches them;
[0016] The threshold setting module states that a nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture.
[0017] The horizontal setting module reads the cached pixels of each UI texture and determines whether the number of consecutive rows of identical pixels in the horizontal direction exceeds a threshold. If yes, the UI texture can be horizontally scaled up in a 3x3 grid, and the horizontal 3x3 grid boundary is set as the start and end rows of consecutive identical pixels; then it proceeds to the vertical setting module; otherwise, it directly executes the vertical setting module.
[0018] The vertical setting module for the texture determines whether the number of columns with consecutive identical pixels in the vertical direction is greater than a threshold. If yes, the texture can be vertically scaled up in a 3x3 grid, and the vertical 3x3 scaling boundary is set to the start and end columns of consecutive identical pixels; then it proceeds to the determination module; otherwise, the UI texture cannot be scaled up horizontally or vertically, and no operation is performed.
[0019] The judgment module determines whether all UI textures have been judged. If yes, the process ends; otherwise, it continues to judge the next UI texture.
[0020] Furthermore, the implementation of the texture horizontal setting module is further specified as follows: Read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, setting each row of pixels as the starting row pixel, then starting from the row below the starting row pixel, read each row of pixels and compare it with the starting row pixel. If the row below the starting row pixel is completely the same as the starting row pixel, increment the number of identical pixels in each row by one, until a row of pixels is different from the starting row pixel, then judge the difference. If the number of rows with the same pixel is greater than a threshold, the texture can be horizontally scaled up to a 3x3 grid, and the horizontal boundary of the 3x3 grid is set to the end row of pixels from the starting row. If the number of rows with the same pixel is less than the threshold, the starting row becomes the next row, and the process of reading each row of pixels from the next row of pixels continues and comparing them is performed. If the number of consecutive rows with the same pixel is less than the threshold, the texture cannot be horizontally scaled up to a 3x3 grid. If the number of consecutive rows with the same pixel is greater than the threshold, the texture can be horizontally scaled up to a 3x3 grid.
[0021] Furthermore, the implementation of the texture vertical setting module is further specified as follows: In the pixels cached for each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels of the starting column pixel and compared with the starting column pixel. If the next column of pixels of the starting column pixel is completely the same as the starting column pixel, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically scaled up in a 3x3 grid, and the vertical boundary of the 3x3 grid is set as the ending column pixel from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels of the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically scaled up in a 3x3 grid. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically scaled up in a 3x3 grid.
[0022] The beneficial effects of this invention are as follows: This invention can identify nine-grid UI textures and automatically set vertical or horizontal nine-grid expansion boundaries for the identified nine-grid UI textures, thereby eliminating the need for manual identification operations, improving work efficiency, and ensuring accurate identification. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the method flow of the present invention.
[0024] Figure 2 This is a schematic diagram of the starting and ending rows of the horizontal and vertical nine-square grid of the present invention.
[0025] Figure 3 This is a system principle block diagram of the present invention. Detailed Implementation
[0026] The invention will now be further described with reference to the accompanying drawings.
[0027] Please see Figure 1 As shown, the present invention provides a method for recognizing and setting a nine-grid UI texture, the method including the following steps: Step S1, read all UI texture format resources in the game project;
[0028] Step S2: Read all pixels of each texture and cache them;
[0029] Step S3: A nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture.
[0030] Step S4: Read the cached pixels of each UI texture and determine whether the number of rows of consecutive identical pixels in the horizontal direction is greater than the threshold. If yes, the UI texture can be horizontally graticulated, and the horizontal graticule boundary is set to the start and end rows of consecutive identical pixels; then proceed to step S5; otherwise, directly execute step S5.
[0031] Step S4 is further specified as follows: Read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, and set each row of pixels read as the starting row pixel. Then, start reading each row of pixels from the next row of pixels of the starting row pixel and compare it with the starting row pixel. If the next row of pixels of the starting row pixel is completely the same as the starting row, increment the number of the same pixels in each row by one until a row of pixels is different from the starting row pixel. Then, judge whether the number of rows of the same pixels is greater than the threshold. If it is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid, and set the horizontal boundary of the 3x3 grid as the ending row of pixels from the starting row pixel to the last row of the same pixels. If it is less than the threshold, the starting row pixel becomes the next row pixel, and continue to read each row of pixels from the next row of pixels of the starting row pixel and compare it. If the number of consecutive rows of the same pixels is less than the threshold, the texture cannot be horizontally scaled up in a 3x3 grid. If the number of consecutive rows of the same pixels is greater than the threshold, the texture is a texture that can be horizontally scaled up in a 3x3 grid.
[0032] Step S5: Determine whether the number of columns with consecutive identical pixels in the vertical direction is greater than the threshold. If yes, the texture can be vertically stretched into a nine-grid layout, and the vertical nine-grid layout boundary is set to the start and end columns of consecutive identical pixels; and proceed to step S6; otherwise, the UI texture cannot be horizontally stretched into a nine-grid layout or vertically stretched into a nine-grid layout, and no operation is performed.
[0033] Step S5 is further specified as follows: In the pixels cached in each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels of the starting column pixel and compared with the starting column pixel. If the next column of pixels of the starting column pixel is completely the same as the starting column, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically graticulated, and the vertical boundary of the graticule is set to the end column of pixels from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels of the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically graticulated. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically graticulated.
[0034] Step S6: Determine if all UI textures have been evaluated. If yes, end the process; otherwise, continue to evaluate the next UI texture.
[0035] The present invention will be further described below with reference to a specific embodiment:
[0036] A method for recognizing and setting nine-grid UI textures, the method includes the following steps:
[0037] 1. Read all UI texture resources in the engine project. Here, we use the engine's built-in API, such as the AssetDatabase.LoadAssetAtPath() function in the Unity3D engine;
[0038] 2. Use the methods in the engine that read pixels from textures (such as tex.GetPixels in the Unity3D engine) and cache them;
[0039] 3. For a 3x3 grid UI texture, it can be stretched horizontally or vertically only if there are multiple consecutive rows or columns (i.e., two consecutive rows or columns with the same pixels). However, in order to better position the boundaries when manually setting the 3x3 grid, artists usually make more than two consecutive rows or columns with the same pixels. The artists set a threshold: if the number of consecutive rows with the same pixels is greater than this threshold, it can be stretched horizontally into a 3x3 grid; if the number of consecutive columns with the same pixels is greater than this threshold, it can be stretched vertically into a 3x3 grid.
[0040] 4. In the pixel cache of each texture, starting from the first row, read each row of pixels. Each row read is set as the initial row pixel. Then, starting from the next row of pixels, read each row of pixels and compare it with the initial row pixel. If the next row of pixels is exactly the same as the initial row, increment the count of identical pixels in each row until a row is different from the initial row. Then check if the number of rows with identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid, and the horizontal boundary of the 3x3 grid is set to the end row of pixels from the initial row pixel to the last identical pixel (using the engine's built-in API). If it is less than the threshold, the initial row pixel becomes the next row pixel, and the process of reading and comparing each row of pixels from the next row of pixels continues. If the number of consecutive identical pixels in a row is less than the threshold, the texture cannot be horizontally scaled up in a 3x3 grid. If the number of consecutive identical pixels in a row is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid, and the horizontal 3x3 grid boundary is set to the start and end positions of the rows with identical pixels. Please refer to [link to relevant documentation]. Figure 2 As shown;
[0041] 5. As described above, in the pixels cached for each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the initial column pixel. Then, starting from the next column of pixels, each column of pixels is read and compared with the initial column pixel. If the next column of pixels is exactly the same as the initial column pixel, the number of identical pixels in each column is incremented by one until a column of pixels is different from the initial column pixel. Then, it is checked whether the number of identical pixels in each column is greater than a threshold. If it is greater than the threshold, the texture can be vertically scaled up in a 3x3 grid, and the vertical boundary of the 3x3 grid is set to the end column pixel from the initial column pixel to the last identical pixel (using the engine's built-in API). If it is less than the threshold, the initial column pixel becomes the next column pixel, and the process of reading each column of pixels from the next column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically scaled up in a 3x3 grid. If the number of consecutive identical pixels in each column is greater than the threshold, the texture can be vertically scaled up in a 3x3 grid, and the vertical 3x3 grid boundary is set to the start and end positions of the identical pixel columns.
[0042] 6. Use the tool to perform steps 4 and 5 on all cached UI textures to identify all textures in the game project that can be scaled up to 3x3, and use the engine's built-in API to set the horizontal or vertical boundaries of the scaled-up textures.
[0043] Please see Figure 3 As shown, the present invention also provides a system for recognizing and setting nine-grid UI textures, the system comprising: a texture reading module, a pixel caching module, a threshold setting module, a texture horizontal setting module, a texture vertical setting module, and a judgment module;
[0044] The texture reading module reads all UI texture resources in the game project;
[0045] The pixel caching module reads all pixels of each texture and caches them;
[0046] The threshold setting module states that a nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture.
[0047] The horizontal setting module reads the cached pixels of each UI texture and determines whether the number of consecutive rows of identical pixels in the horizontal direction exceeds a threshold. If yes, the UI texture can be horizontally scaled up in a 3x3 grid, and the horizontal 3x3 grid boundary is set as the start and end rows of consecutive identical pixels; then it proceeds to the vertical setting module; otherwise, it directly executes the vertical setting module.
[0048] The implementation of the texture horizontal setting module is further specified as follows: Read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, setting each row of pixels as the starting row pixels, then starting from the next row of pixels of the starting row pixels, read each row of pixels and compare it with the starting row pixels. If the next row of pixels of the starting row pixels is completely the same as the starting row pixels, increment the number of identical pixels in each row by one, until a row of pixels is different from the starting row pixels, then judge the identical pixels. If the number of rows of pixels exceeds a threshold, the texture can be horizontally scaled up to a 3x3 grid, and the horizontal boundary of the 3x3 grid is set to the end row of pixels from the starting row to the last pixel of the same type. If the number of rows is less than the threshold, the starting row becomes the next row, and the process of reading each row of pixels from the next row of pixels continues and comparing them is performed. If the number of consecutive identical rows of pixels is less than the threshold, the texture cannot be horizontally scaled up to a 3x3 grid. If the number of consecutive identical rows of pixels exceeds the threshold, the texture can be horizontally scaled up to a 3x3 grid.
[0049] The vertical setting module for the texture determines whether the number of columns with consecutive identical pixels in the vertical direction is greater than a threshold. If yes, the texture can be vertically scaled up in a 3x3 grid, and the vertical 3x3 scaling boundary is set to the start and end columns of consecutive identical pixels; then it proceeds to the determination module; otherwise, the UI texture cannot be scaled up horizontally or vertically, and no operation is performed.
[0050] The implementation of the vertical setting module for textures is further specified as follows: In the pixels cached for each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels from the starting column pixel and compared with the starting column pixel. If the next column of pixels from the starting column pixel is exactly the same as the starting column pixel, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically scaled up in a 3x3 grid, and the vertical boundary of the 3x3 grid is set to the end column of pixels from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels from the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically scaled up in a 3x3 grid. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically scaled up in a 3x3 grid.
[0051] The judgment module determines whether all UI textures have been judged. If yes, the process ends; otherwise, it continues to judge the next UI texture.
[0052] In summary, this invention can identify nine-grid UI textures and automatically set vertical or horizontal nine-grid expansion boundaries for the identified nine-grid UI textures, thus eliminating the need for manual identification operations, improving work efficiency, and ensuring accurate identification.
[0053] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.
Claims
1. A method for recognizing and setting a nine-grid UI texture, characterized in that: The method includes the following steps: Step S1, read all UI texture resources in the game project; Step S2: Read all pixels of each texture and cache them; Step S3: A nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture. Step S4: Read the cached pixels of each UI texture and determine whether the number of rows of consecutive identical pixels in the horizontal direction is greater than the threshold. If yes, the UI texture can be horizontally scaled up in a 3x3 grid, and the horizontal 3x3 grid boundary is set as the start and end rows of consecutive identical pixels; then proceed to step S5; otherwise, directly execute step S5. Step S5: Determine whether the number of columns with consecutive identical pixels in the vertical direction is greater than the threshold. If yes, the texture can be vertically stretched into a nine-grid pattern, and the vertical nine-grid stretch boundary is set to the start and end columns of consecutive identical pixels; and proceed to step S6; otherwise, the UI texture cannot be horizontally stretched into a nine-grid pattern or vertically stretched into a nine-grid pattern, and no operation is performed. Step S6: Determine if all UI textures have been evaluated. If yes, end the process; otherwise, continue to evaluate the next UI texture. Step S4 is further specified as follows: Read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, set each row of pixels as the starting row pixel, and start reading each row of pixels from the next row of pixels of the starting row pixel and compare it with the starting row pixel. If the next row of pixels of the starting row pixel is completely the same as the starting row, increment the number of the same pixels in each row by one until a row of pixels is different from the starting row pixel. Then judge whether the number of rows of the same pixels is greater than the threshold. If it is greater than the threshold, the texture can be horizontally graticule-scaled, and the horizontal boundary of the graticule is set as the ending row of pixels from the starting row pixel to the last row of the same pixels. If it is less than the threshold, the starting row pixel becomes the next row pixel, and continue to read each row of pixels from the next row of pixels of the starting row pixel and compare it. If the number of consecutive rows of the same pixels is less than the threshold, the texture cannot be horizontally graticule-scaled. If the number of consecutive rows of the same pixels is greater than the threshold, the texture is a texture that can be horizontally graticule-scaled. Step S5 is further specified as follows: In the pixels cached in each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels of the starting column pixel and compared with the starting column pixel. If the next column of pixels of the starting column pixel is completely the same as the starting column, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically graticulated, and the vertical boundary of the graticule is set to the end column of pixels from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels of the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically graticulated. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically graticulated.
2. A system for recognizing and setting nine-grid UI textures, characterized in that: The system includes: a texture reading module, a pixel caching module, a threshold setting module, a texture horizontal setting module, a texture vertical setting module, and a judgment module; The texture reading module reads all UI texture resources in the game project; The pixel caching module reads all pixels of each texture and caches them; The threshold setting module states that a nine-grid UI texture will not be distorted when stretched horizontally or vertically if multiple consecutive rows or columns of pixels are the same. Therefore, a threshold is set to determine how many rows and columns of pixels are the same for a nine-grid UI texture. The horizontal setting module reads the cached pixels of each UI texture and determines whether the number of consecutive rows of identical pixels in the horizontal direction exceeds a threshold. If yes, the UI texture can be horizontally scaled up in a 3x3 grid, and the horizontal 3x3 grid boundary is set as the start and end rows of consecutive identical pixels; then it proceeds to the vertical setting module; otherwise, it directly executes the vertical setting module. The vertical setting module for the texture determines whether the number of columns with consecutive identical pixels in the vertical direction is greater than a threshold. If yes, the texture can be vertically scaled up in a 3x3 grid, and the vertical 3x3 scaling boundary is set to the start and end columns of consecutive identical pixels; then it proceeds to the determination module; otherwise, the UI texture cannot be scaled up horizontally or vertically, and no operation is performed. The judgment module determines whether all UI textures have been judged. If yes, the process ends; otherwise, it continues to judge the next UI texture. The implementation of the texture horizontal setting module is further specified as follows: Read the cached pixels of each UI texture and judge the cached pixels of each UI texture; in the cached pixels of each texture, read each row of pixels starting from the first row, setting each row of pixels as the starting row pixels, then starting from the next row of pixels of the starting row pixels, read each row of pixels and compare it with the starting row pixels. If the next row of pixels of the starting row pixels is completely the same as the starting row pixels, increment the number of identical pixels in each row by one, until a row of pixels is different from the starting row pixels, then judge the identical pixels. If the number of rows of pixels is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid, and the horizontal boundary of the 3x3 grid is set to the end row of pixels from the starting row to the last pixel of the same type. If the number of rows of pixels is less than the threshold, the starting row becomes the next row of pixels, and the above process of reading each row of pixels from the next row of pixels continues and comparing them. If the number of consecutive identical rows of pixels is less than the threshold, the texture cannot be horizontally scaled up in a 3x3 grid. If the number of consecutive identical rows of pixels is greater than the threshold, the texture can be horizontally scaled up in a 3x3 grid. The implementation of the vertical setting module for textures is further specified as follows: In the pixels cached for each texture, each column of pixels is read starting from the first column. Each column of pixels read is set as the starting column pixel. Then, each column of pixels is read starting from the next column of pixels from the starting column pixel and compared with the starting column pixel. If the next column of pixels from the starting column pixel is exactly the same as the starting column pixel, the number of identical pixels in each column is incremented by one until a certain column of pixels is different from the starting column pixel. Then, it is determined whether the number of columns of identical pixels is greater than a threshold. If it is greater than the threshold, the texture can be vertically scaled up in a 3x3 grid, and the vertical boundary of the 3x3 grid is set to the end column of pixels from the starting column pixel to the last identical pixel. If it is less than the threshold, the starting column pixel becomes the next column pixel, and the above process of reading each column of pixels from the next column of pixels from the starting column pixel and comparing is continued. If the number of consecutive identical pixels in each column is less than the threshold, the texture cannot be vertically scaled up in a 3x3 grid. If the number of consecutive identical pixels in each column is greater than the threshold, the texture is a texture that can be vertically scaled up in a 3x3 grid.
Citation Information
Patent Citations
A method and device for controlling a progress bar
CN109213548A
Image storage method and device, electronic equipment and storage medium
CN110413805A