Method and related equipment for realizing nine-point effect diagram display in MacOS system

By constructing a third-party point nine-picture rendering framework and integrating it into MacOS programs, the problem of difficulty in displaying point nine-pictures in MacOS systems is solved, and flexible scaling and adapting to different resolutions is achieved, which improves software development efficiency.

CN114546378BActive Publication Date: 2025-02-07SHENZHEN ZHENAI JIEYUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210080497.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2025-02-07
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

In MacOS systems, it is difficult to realize the display of the point nine diagrams in the existing technology, and the scaling parameters of Xcode Slicing need to be specified before software compilation, and cannot be flexibly changed, making it difficult to meet the needs of software developers.

Method used

Construct a third-party point nine-picture rendering framework, including a PNG data parser, image preprocessing tool and display container, integrate it into a MacOS program, receive the PNG file of point nine-picture, decode, slice and zoom according to the zoom mark, and finally Splice the display point nine effect diagram in the display container.

Benefits of technology

It supports the display of point nine pictures in MacOS system, improves software development efficiency, allows flexible changes in zoom parameters, and meets the needs of different screen resolutions and control sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546378B_ABST
    Figure CN114546378B_ABST
Patent Text Reader

Abstract

The present invention provides a method and related equipment for realizing the display of a nine-dot effect diagram in a MacOS system. The method of the present invention first constructs a third-party nine-dot diagram rendering framework including a PNG data parser, a picture preprocessing tool and a display container carrying the nine-dot diagram, and then integrates the third-party nine-dot diagram rendering framework in a MacOS terminal program that needs to display the nine-dot diagram, so that the MacOS terminal program can also realize the display of the nine-dot diagram. After receiving the PNG file of the nine-dot diagram, the MacOS terminal program of the present invention calls the PNG data parser for decoding to obtain the picture object and the scaling mark of the nine-dot diagram, and then after obtaining the segmentation layout of the picture object based on the scaling mark, the picture preprocessing tool is used to slice and divide the picture object into a plurality of non-scaling slice objects and a plurality of scaling slice objects. When the nine-dot diagram needs to be displayed, the scaling slice object and the non-scaling slice object after scaling processing are spliced ​​in the display container to complete the display of the nine-dot diagram in the MacOS terminal program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of graphics rendering, and in particular to a method and related equipment for realizing the display of a nine-dot effect graph in a MacOS system. Background Art

[0002] The nine-point image is a picture format that is uniquely supported by the Android platform. It can be stretched horizontally and vertically to meet the needs of displaying on controls of different sizes and different screen resolutions without losing fineness and texture. In this way, only one set of interface cuts is needed to adapt to different resolutions, and the size of the installation package is greatly reduced. In this way, the program can achieve its stretching without special processing, which also reduces the amount of code and development workload. Currently, the nine-point image can only be run in the Android system. In the MacOS system, the image stretching uses Xcode Slicing. Compared with the nine-point image, the scaling parameters of Xcode Slicing need to be specified before the software is compiled, and cannot be flexibly changed after compilation, which is difficult to meet the needs of software developers. If the nine-point image can be transplanted to MacOS software development, it will greatly improve the development efficiency of MacOS software.

[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0004] The main purpose of the present invention is to enable the application program of MacOS system to also support the display of nine-point diagram.

[0005] The first aspect of the present invention provides a method for realizing the display of a point nine effect diagram in a MacOS system, comprising the steps of:

[0006] Constructing a third-party nine-dot-picture rendering framework, wherein the third-party nine-dot-picture rendering framework includes a PNG data parser, an image preprocessing tool, and a display container for carrying the nine-dot-picture;

[0007] Integrate the third-party nine-dot rendering framework into the MacOS terminal program;

[0008] Receive the PNG file of the dot-nine diagram;

[0009] Decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram;

[0010] Obtaining a slice layout of the picture object based on the zoom mark;

[0011] Slicing the image object based on the slice layout using the image preprocessing tool to obtain M non-scaled slice objects and N to-be-scaled slice objects, where M and N are both positive integers; determining a size parameter of the display container, and judging whether the image object needs to be scaled according to the size parameter of the display container and the size parameter of the image object;

[0012] When the picture object needs to be scaled, the N to-be-scaled slice objects are scaled in sequence to obtain N scaled slice objects;

[0013] A two-dimensional rendering coordinate system is established with the lower left corner of the display container as the origin, and with the origin as the starting point, the M non-scaling slice objects and the N scaling slice objects are filled into the display container in a preset filling order to obtain a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects fill each layer in the display container in an order from left to right, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects are filled layer by layer in an order from bottom to top.

[0014] In an optional implementation of the first aspect of the present invention, the PNG data parser includes a BytesUtils component and a PNGParser component, and the PNGParser component includes a registry for extending the parsing of npTc data blocks; decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram includes:

[0015] Perform bytecode processing on the PNG file based on the BytesUtils component to obtain the data structure of the PNG file;

[0016] The image object and the scaling mark of the nine-dot diagram are obtained by parsing the data structure of the PNG file based on the PNGParser component.

[0017] In an optional implementation of the first aspect of the present invention, the step of extracting the picture object and the scaling mark of the dot-nine diagram from the data structure of the PNG file based on the PNGParser component includes:

[0018] Parse the image data block of the data structure to obtain the picture object information of the nine-point diagram;

[0019] Generate the picture object of the nine-dot diagram based on the picture object information;

[0020] Parse the scaling mark information of the nine-point diagram from the npTc data block of the data structure;

[0021] A scaling mark of the dot-nine diagram is generated at the periphery of the picture object based on the scaling mark information.

[0022] In an optional implementation of the first aspect of the present invention, when the picture object needs to be scaled, scaling the N to-be-scaled slice objects in sequence to obtain the N scaled slice objects includes:

[0023] Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, the scaling length and scaling width corresponding to each of the to-be-scaled slice objects are calculated in sequence according to the preset filling order;

[0024] Then, a scaling operation is performed on each of the to-be-scaled slice objects according to the calculated scaling length and scaling width of each of the to-be-scaled slice objects, so as to obtain N scaled slice objects.

[0025] In an optional implementation of the first aspect of the present invention, the non-scaled slice object at the lower left corner of the picture object is used as a starting point, and the scaling length and scaling width corresponding to each of the to-be-scaled slice objects are calculated in sequence according to the preset filling order, including:

[0026] Obtain the image length, image width, fixed area length and fixed area width of the picture object;

[0027] Calculate the total length of the scaling area based on the image length and the fixed area length, and calculate the total width of the scaling area based on the image length and the fixed area width;

[0028] Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, traverse the N to-be-scaled slice objects according to the preset filling order;

[0029] For each target slice object to be scaled among the N slice objects to be scaled, obtaining a target slice length and a target slice width of the target slice object to be scaled;

[0030] Determine the region to which the target to-be-scaled slice object belongs;

[0031] If the target slice object to be scaled only belongs to the horizontal stretching area, the slice object to be scaled is only scaled horizontally, and the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width is equal to the target slice width;

[0032] If the target slice object to be scaled only belongs to the vertical stretching area, only the slice object to be scaled is vertically scaled, the scaling width = the total length of the vertical stretching area of ​​the display container * (the target slice width / the total width of the scaling area), and the scaling length is equal to the target slice length;

[0033] If the target slice object to be scaled belongs to both the horizontal stretching area and the vertical stretching area, the target slice object to be scaled is scaled horizontally and vertically, then the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width = the total length of the horizontal stretching area of ​​the display container * (the target slice width / the total width of the scaling area).

[0034] In an optional implementation of the first aspect of the present invention, the nine-point diagram rendering framework further includes a text overlay display tool, wherein the lower left corner of the display container is used as the origin to establish a two-dimensional rendering coordinate system, and the origin is used as the starting point to fill M non-scaled slice objects and N scaled slice objects into the display container in a preset filling order, and after obtaining the nine-point effect diagram, the following is further included:

[0035] When it is necessary to display text on the zoomed point-nine diagram;

[0036] Dividing a text content area on the zoomed point-nine diagram by using the text overlay display tool;

[0037] The received text information is filled into the text content area and displayed floating on the zoomed nine-point diagram.

[0038] In an optional implementation of the first aspect of the present invention, the data structure of the PNG file includes a PNG file flag, a file header data block, a palette data block, a number of image data blocks, an npTc data block and an image end data block.

[0039] A second aspect of the present invention provides a device for realizing the display of a point-nine effect diagram in a MacOS system, comprising:

[0040] A construction module, used to construct a third-party nine-dot image rendering framework, wherein the third-party nine-dot image rendering framework includes a PNG data parser, an image preprocessing tool, and a display container for carrying the nine-dot image;

[0041] An integration module, used to integrate the third-party point nine-image rendering framework into the MacOS terminal program;

[0042] The receiving module is used to receive the PNG file of the nine-point diagram;

[0043] A decoding module, used for decoding the PNG file through the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram;

[0044] A layout module, configured to obtain a slice layout of the picture object based on the zoom mark;

[0045] a slicing module, configured to slice the image object using the image preprocessing tool and based on the slicing layout to obtain M non-scaled slice objects and N to-be-scaled slice objects, wherein M and N are both positive integers;

[0046] A judgment module, used for determining the size parameters of the display container, and for judging whether the picture object needs to be scaled according to the size parameters of the display container and the size parameters of the picture object;

[0047] A scaling module, used for performing scaling operations on the N to-be-scaled slice objects in sequence when the picture object needs to be scaled, to obtain N scaled slice objects;

[0048] The splicing display module is used to establish a two-dimensional rendering coordinate system with the lower left corner of the display container as the origin, and to fill the M non-scaling slice objects and the N scaling slice objects into the display container in a preset filling order with the origin as the starting point, so as to obtain a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects fill each layer in the display container in an order from left to right, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects are filled layer by layer in an order from bottom to top.

[0049] The third aspect of the present invention provides a device for realizing the display of a dot-nine effect diagram in a MacOS system, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected through lines; it is characterized in that the at least one processor calls the instructions in the memory so that the device executes any one of the above-mentioned methods for realizing the display of a dot-nine effect diagram in a MacOS system.

[0050] A fourth aspect of the present invention provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes any one of the above-mentioned methods for realizing the display of a nine-point effect diagram in a MacOS system.

[0051] Beneficial effect: The present invention provides a method and related equipment for realizing the display of dot-nine effect diagrams in a MacOS system. The method of the present invention constructs a third-party dot-nine diagram rendering framework, which includes a PNG data parser, an image preprocessing tool and a display container. Then, the third-party dot-nine diagram rendering framework is integrated into a MacOS-side program, so that the MacOS-side program can also realize the display of the dot-nine diagram. When the MacOS-side program receives the PNG file of the dot-nine diagram, the PNG data parser is called for decoding to obtain the image object and scaling mark of the dot-nine diagram. After obtaining the segmentation layout of the image object based on the scaling mark, the image preprocessing tool is used to slice and divide the image object into a number of non-scaling slice objects and a number of scaling slice objects. When the dot-nine diagram needs to be displayed, the scaling slice object and the non-scaling slice object after scaling are spliced ​​in the display container to complete the display of the dot-nine diagram in the MacOS-side program. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 It is a flowchart of an embodiment of a method for realizing the display of a nine-point effect diagram in a MacOS system in an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of the data structure of a traditional PNG file in an embodiment of the present invention;

[0054] Figure 3 It is a structural schematic diagram of a special npTc data block in the point nine diagram data structure in an embodiment of the present invention;

[0055] Figure 4 It is a structural schematic diagram of a nine-point diagram in an embodiment of the present invention;

[0056] Figure 5 A schematic diagram of an embodiment of a container for carrying a nine-point diagram in an embodiment of the present invention;

[0057] Figure 6 It is a schematic diagram of an embodiment of a device for realizing the display of a dot-nine effect diagram in a MacOS system according to an embodiment of the present invention;

[0058] Figure 7 It is a schematic diagram of an embodiment of a device for realizing the display of a nine-point effect diagram in a MacOS system in an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The embodiment of the present invention provides a method and related equipment for realizing the display of a nine-point effect diagram in a MacOS system.

[0060] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0061] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The first aspect of the present invention provides a method for realizing the display of a point nine effect diagram in a MacOS system, comprising the steps of:

[0062] S101, construct a third-party nine-point image rendering framework, which includes a PNG data parser, an image preprocessing tool, a display container for carrying the nine-point image, and a text overlay display tool; the PNG data parser includes a BytesUtils component and a PNGParser component, the BytesUtils component is a byte processing tool, which is responsible for reading, intercepting, and big-endian and small-endian compatibility of file byte streams, the PNGParser component is a PNG file parser, which depends on the BytesUtil component and is responsible for converting bytes into PNG data structures, the PNGParser component includes a registry for extended parsing of npTc data blocks, which can register special Chunk segment data structures for parsing by the parser to be compatible with special PNG data structures such as nine-point images; and the container for carrying the nine-point image is NinePatchImage View is compatible with ordinary Image object display. When a NinePatch Image object is passed to it, it will be drawn in real time by splicing and stretching local images according to its current size. In order to implement content constraints in the NinePatch Image, the system UITableViewCell is simulated to include contentView. ContentView is also designed as the content area in NinePatchImageView. The position of contentView relative to NinePatchImageView is strictly controlled according to the content constraints of the NinePatchImageView. When adding subviews to NinePatchImageView, you can directly add them to the contentView and layout them relative to it. Finally, combined with the actual application scenarios of the NinePatch Image, the functions of left-right flipping and up-down flipping are provided to meet the needs of chat bubbles, barrages, etc., and avoid repeated image cutting work.

[0063] S102, integrating the third-party nine-point rendering framework into the MacOS terminal program;

[0064] After the third-party nine-point rendering framework of the present invention is constructed, the third-party nine-point rendering framework is packaged into a Framework, which is adapted to the UIKit of MacOS so that MacOS developers can use it directly. The third-party nine-point rendering framework of the present invention is named NinePatchKit, and NinePatchKit has been registered in CocoaPods, a third-party library management tool developed by Apple. Developers can integrate NinePatchKit into any MacOS development project through CocoaPods.

[0065] S103, receiving a PNG file of a nine-dot map; a nine-dot map is also a PNG image, see Figure 2For the common PNG image data structure, we can see that PNG data is composed of a signature string Singnature with fixed length content and multiple Chunks with flexible lengths. The Chunk segment (data block) structure is also arranged according to a fixed structure rule, including four fields: Length, ChunkType Code, Chunk Data, and CRC. Except for the Chunk Data size which is determined by the value of the Length field, the other fields are all fixed lengths. According to this rule and structure, the corresponding PNG data model and Chunk data model and their holding relationship are established. See Figure 3 Compared with the ordinary PNG data structure, the nine-point image data structure has an additional npTc Chunk segment. The Type Code of the npTc Chunk segment is npTc, and its Chunk Data stores the scaling mark information of the nine-point image.

[0066] S104, decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram;

[0067] See also Figure 4 During the design and production stage of the nine-point diagram, a unit of transparent pixels will be newly created around the original image, and the scaling and content constraint information will be marked by pure black pixels: the black lines on the left and top represent the horizontal and vertical scaling areas respectively, and the scaling area can have multiple segments, and the scaling is performed in proportion to the line length; the black lines on the right and bottom represent the horizontal and vertical content areas respectively. After the black line diagram is compiled, these information coordinates will be placed in the npTc Chunk segment to generate the final nine-point diagram; the third-party nine-point diagram framework of the present invention divides the rendering work of the nine-point diagram into three parts: decoding, preprocessing and real-time rendering, wherein the decoding stage is to parse the PNG file of the nine-point diagram to obtain the picture object, scaling mark and content area mark of the nine-point diagram.

[0068] In the S400, decoding the PNG file by the PNG data parser to obtain the picture object and the scaling mark of the nine-point diagram includes:

[0069] Based on the BytesUtils component, the bytecode in the PNG file is processed to obtain the data structure of the PNG file; in the step, the BytesUtils component converts the bytecode in the PNG file, divides the header string identifier of the signature recorded in the PNG file (PNG file identifier part) and a number of data blocks (Chunks), each of which includes four parts, namely Length (Chunk Date length), Chunk Type Code (data block type code), Chunk Data (data block data) and CRC (cyclic redundancy check code). In an exemplary embodiment, the data structure of the PNG file obtained after processing by the present invention includes a PNG file identifier, a file header data block, a palette data block, a number of Chunk data blocks, an npTc data block and an image end data block.

[0070] The image object and the scaling mark of the nine-dot diagram are obtained by parsing the data structure of the PNG file based on the PNGParser component.

[0071] In this step, the PNGParser component starts from the PNG file logo, and parses and reads the contents of the file header data block, the palette data block, several image data blocks and the npTc data block in sequence until the image end data block. Exemplarily, the parsing and reading process includes: first analyzing whether the PNG file logo part (header string) is "89504e470d0a1a0a", if it is determined to be a PNG string logo, then continue to process the structural image data, and if it is not a PNG string logo, then directly end the processing process, and if it is determined to be a PNG string logo, then determine that the number of index characters is 8, and then further determine whether there is a string after the PNG string logo, and if there are subsequent characters, parse the length code, data block type code, picture content data block, CRC verification code, each time the length code is parsed, the index character number is increased by 4, each time the data block type code is parsed, the index character number is increased by 4, and each time the picture content data block is parsed, the data size corresponding to the length code is increased in the index character number, that is, the number of characters of the picture content data block. The processing process of the CRC verification code is different. After the CRC verification code is parsed, the number of characters in the verified image content data block is added to the index character number. The value of the index character number is used to determine whether the expansion of the Chunk Data is completed. If the expansion is completed, it is directly parsed based on the PNG Parser plug-in. Since there are many data blocks in the PNG file data structure, the above process of parsing the length code, data block type code, image content data block and CRC verification code needs to be repeated until the image end data block is parsed.

[0072] In an optional implementation manner of the present invention, the step of extracting the picture object and the scaling mark of the dot-nine diagram from the data structure of the PNG file based on the PNGParser component includes:

[0073] Parse the image data block of the data structure to obtain the picture object information of the nine-point diagram;

[0074] Generate the picture object of the nine-dot diagram based on the picture object information;

[0075] Parse the scaling mark information of the nine-point diagram from the npTc data block of the data structure;

[0076] In this step, for the dot nine image, because the npTc data block contains a special chunk segment npTcChunk structure, it can be processed by implementing the chunkData extended parsing method in PNG Parser. Specifically, during the parsing process, if the npTc Chunk type code is recognized, the index character number beginIndex is cleared to zero. After beginIndex=0, execute beginIndex=beginIndex+1, read the set horizontal coordinate length X, and execute beginIndex=beginIndex+1. Read the fixed vertical coordinate length Y, and execute beginIndex=beginIndex+1. Read the color array length, execute beginIndex=beginIndex+1, then skip 8 bytes, and execute beginIndex=beginIndex+8. Read the left boundary length of the content, and execute beginIndex=beginIndex+4. Read the right boundary length of the content, and execute beginIndex=beginIndex+4. Read the top border length and execute beginIndex=beginIndex+4. Read the bottom border length and execute beginIndex=beginIndex+4. Skip 4 bytes and execute beginIndex=beginIndex+4. Define a counter i, i=0, determine whether i is less than the horizontal coordinate length X, if so, assign beginIndex to i, execute beginIndex=beginIndex+4, then determine whether i is less than the horizontal coordinate length X, loop until i is not less than the horizontal coordinate length X and execute the following steps. Define a counter j, j=0, determine whether j is less than the vertical coordinate length Y, if so, assign beginIndex to j, execute beginIndex=beginIndex+4, then determine whether j is less than the vertical coordinate length Y, loop until j is not less than the vertical coordinate length Y and execute the following steps. Define a counter m, m=0, and determine whether m is less than the length of the color array. If so, assign beginIndex to m, beginIndex=beginIndex+4, and then determine whether m is less than the length of the color array. Loop until m is not less than the length of the color array and end the parsing process.

[0077] A scaling mark of the dot-nine diagram is generated at the periphery of the picture object based on the scaling mark information. Figure 4, a zoom mark of the dot-nine diagram is generated on the periphery of the picture object, that is, a unit of transparent pixel points is first created around the picture object, and then the pixel points belonging to the zoom mark are selected from the transparent pixel points on the upper edge and the left edge of the picture object and painted black, so that a horizontal zoom area mark with black pixel points as the mark is formed on the upper edge of the picture object, and a vertical zoom area mark with black pixel points as the mark is formed on the left edge of the picture object.

[0078] S105. Obtain a slice layout of the picture object based on the zoom mark. In this embodiment, because the picture object is a nine-dot diagram, the nine-dot diagram is divided into a stretchable area and a non-stretchable area by the zoom marks on the upper edge and the left edge of the picture object. Therefore, it is necessary to first crop the picture object according to the stretchable area and the non-stretchable area. For the zoom mark on the left edge of the picture object (taking the black line as an example), draw horizontal lines for the two end points of each black line. For the zoom mark on the upper edge of the picture object, draw vertical lines for the two end points of each black line. In this way, the horizontal line and the vertical line will intersect. In this way, the slice layout of the picture object is obtained, and then the picture object can be sliced ​​according to the slice layout.

[0079] S106, slicing the image object based on the slice layout using the image preprocessing tool to obtain M non-scaled slice objects and N to-be-scaled slice objects, where M and N are both positive integers;

[0080] See also Figure 4 In an exemplary slice layout of a picture object of the present invention, the horizontal scaling mark of the upper edge of the picture object is a black line, and the vertical scaling mark of the left edge of the picture object is two black lines. After the picture object is segmented, 15 blocks are formed. The 15 picture object slices are numbered from left to right with the lower left corner as the starting point, and then go up one layer after the end, and then from left to right. In this way, 15 picture object slices with different labels are obtained, among which No. 1, No. 3, No. 7, No. 9, No. 13 and No. 15 are non-scaled slice objects, and No. 2, No. 4, No. 5, No. 6, No. 8, No. 10, No. 11, No. 12 and No. 14 are slice objects to be scaled. In the memory, M non-scaled slice objects and N slice objects to be scaled are stored in the order of numbers from 1 to 15, and the non-scaled slice objects and the slice objects to be scaled are also extracted from the memory in the order of numbers from 1 to 15 in the later stage.

[0081] In step S106, the image preprocessing tool generates and caches some preprocessing information in the process of slicing the image object, so as to be used in the subsequent calculation of the scaling length and scaling width of the slice object to be scaled. The preprocessing information includes the image length, image width, fixed area length and fixed area width of the image object, as well as the length and width of each slice object to be scaled.

[0082] S107, determining the size parameters of the display container, and judging whether the image object needs to be scaled according to the size parameters of the display container and the size parameters of the image object; wherein the size parameters of the display container are changed in real time as required, for example, in the chat bubble example, since the length of the text input by the user is different each time, the size parameters of the display container required each time are also different. Before the display container displays the dot-nine diagram, it is necessary to determine the size parameters of the display container and judge whether the image object needs to be scaled. The specific judgment method is to judge whether the image object needs to be scaled by comparing whether the length of the display container is equal to the length of the image object, and whether the width of the display container is equal to the width of the image object. If the length and / or width of the two are not equal, it proves that the image object needs to be scaled;

[0083] S108, when the picture object needs to be scaled, scaling the N to-be-scaled slice objects in sequence to obtain N scaled slice objects;

[0084] For example, see Figure 5 A display container for carrying zoomed nine-point images, the display container is divided according to the slice layout of the image objects, area 1, area 3, area 7, area 9, area 13 and area 15 are used to place non-zoomed slice object No. 1, non-zoomed slice object No. 3, non-zoomed slice object No. 7, non-zoomed slice object No. 9, non-zoomed slice object No. 13 and non-zoomed slice object No. 15; the sizes of area 1, area 3, area 7, area 9, area 13 and area 15 are adapted to the sizes of the corresponding non-zoomed slice objects; area 2, area 4, area 5, area 6, area 8, area 10, area 11, area 12 and area 14 are used to place zoomed slice object No. 2, zoomed slice object No. 4, zoomed slice object No. 5, zoomed slice object No. 6, area 8 No. 10, No. 11, No. 12, and No. 14; area No. 2, area No. 4, area No. 5, area No. 6, area No. 8, area No. 10, area No. 11, area No. 12, and area No. 14 are all larger than the areas of their corresponding scaled slice objects before scaling, so No. 2, No. 4, No. 5, No. 6, No. 8, No. 10, No. 11, No. 12, and No. 14 need to be scaled to fill the corresponding areas; based on the scaling principle of the point nine diagram, the M non-scaled slice objects in the point nine diagram do not need to be changed, so only the N scaled slice objects need to be scaled;

[0085] In this embodiment, the operation of scaling the N scaled slice objects is performed one by one in a certain order. In an exemplary implementation, when the picture object needs to be scaled, the N to-be-scaled slice objects are scaled in sequence to obtain the N scaled slice objects, including:

[0086] Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, the scaling length and scaling width corresponding to each of the to-be-scaled slice objects are calculated in sequence according to the preset filling order; in this step, see Figure 4 , exemplarily, the present invention takes the non-scaled slice object No. 1 at the lower left corner of the picture object as the starting point, and calculates the scaled length and scaled width corresponding to each of the slice objects to be scaled according to the preset filling order, that is, according to the order of the slice object No. 2 to be scaled, the slice object No. 4 to be scaled, the slice object No. 5 to be scaled, the slice object No. 6 to be scaled, the slice object No. 8 to be scaled, the slice object No. 10 to be scaled, the slice object No. 11 to be scaled, the slice object No. 12 to be scaled and the slice object No. 14 to be scaled, respectively, to obtain the scaled length and scaled width corresponding to each slice object to be scaled;

[0087] Then, a scaling operation is performed on each of the to-be-scaled slice objects according to the calculated scaling length and scaling width of each to-be-scaled slice object, to obtain N scaled slice objects. In this step, after the scaling length and scaling width of each scaled slice object are calculated, each of the scaled slice objects is scaled according to the calculated scaling length and scaling width; in an optional implementation of the first aspect of the present invention, the non-scaled slice object at the lower left corner of the picture object is used as a starting point, and the scaling length and scaling width corresponding to each to-be-scaled slice object are calculated in sequence according to the preset filling order, including:

[0088] Get the image length, image width, fixed area length and fixed area width of the picture object; Figure 4 Taking the picture object as an example, the width of the fixed area can be calculated as the width of the non-scaled slice object No. 1 + the width of the non-scaled slice object No. 7 + the width of the non-scaled slice object No. 13, or the width of the non-scaled slice object No. 3 + the width of the non-scaled slice object No. 9 + the width of the non-scaled slice object No. 15. The length of the fixed area can be calculated as the length of the non-scaled slice object No. 13 + the length of the non-scaled slice object No. 15, or the length of the non-scaled slice object No. 7 + the length of the non-scaled slice object No. 9, or the length of the non-scaled slice object No. 1 + the length of the non-scaled slice object No. 3.

[0089] The total length of the zoomed area is calculated based on the image length and the fixed area length, and the total width of the zoomed area is calculated based on the image length and the fixed area width. In this embodiment, Figure 4 Taking the picture object as an example, the total length of the scaling area = the image length of the picture object - the length of the 13th non-scaled slice object - the length of the 15th non-scaled slice object, that is, the length of the 14th non-scaled slice object; the total width of the scaling area = the image width of the picture object - the width of the 1st non-scaled slice object - the width of the 7th non-scaled slice object - the width of the 13th non-scaled slice object, that is, the sum of the width of the 4th to-be-scaled slice object and the width of the 10th scaled slice object.

[0090] Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, traverse the N to-be-scaled slice objects according to the preset filling order; in this embodiment, Figure 4 For example, starting from the non-scaled slice object No. 1, traverse the slice object No. 2 to be scaled, the slice object No. 4 to be scaled, the slice object No. 5 to be scaled, the slice object No. 6 to be scaled, the slice object No. 8 to be scaled, the slice object No. 10 to be scaled, the slice object No. 13 to be scaled, and the slice object No. 15 to be scaled in order from left to right and from bottom to top;

[0091] For each target slice object to be scaled among the N slice objects to be scaled, a target slice length and a target slice width of the target slice object to be scaled are obtained; Figure 4 Taking the No. 2 to-be-scaled slice object in as an example, when the No. 2 to-be-scaled slice object is traversed, the No. 2 to-be-scaled slice object is the target to-be-scaled slice object, the target slice length is the length of the No. 2 to-be-scaled slice object, and the target slice width is the width of the No. 2 to-be-scaled slice object;

[0092] Determine the region to which the target slice object to be scaled belongs; Figure 4 For example, according to the scaling principle of the point nine diagram, the slice object No. 2 to be scaled, the slice object No. 8 to be scaled, and the slice object No. 14 to be scaled belong only to the horizontal stretching area, the slice object No. 4 to be scaled, the slice object No. 10 to be scaled, the slice object No. 6 to be scaled, and the slice object No. 12 to be scaled belong to the vertical stretching area, and the slice object No. 5 to be scaled and the slice object No. 11 to be scaled belong to both the horizontal stretching area and the vertical stretching area;

[0093] If the target slice object to be scaled only belongs to the horizontal stretching area, then only the slice object to be scaled is horizontally scaled, and the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width is equal to the target slice width; taking the slice object No. 2 to be scaled as an example, the scaling length of the slice object No. 2 to be scaled = ( Figure 5The length of area 2)*( Figure 4 The length of the slice object to be scaled in No. 2 / ( Figure 4 Image length of the picture object in - Figure 4 The length of the non-scaled slice object No. 1 - Figure 4 The length of the non-scaled slice object No. 3 in the middle);

[0094] If the target slice object to be scaled only belongs to the vertical stretching area, only the slice object to be scaled is vertically scaled, and the scaling width = the total length of the vertical stretching area of ​​the display container * (the target slice width / the total width of the scaling area), and the scaling length is equal to the target slice length; taking the slice object No. 4 to be scaled as an example, the scaling width of the slice object No. 4 to be scaled = ( Figure 5 Length of area 4+ Figure 5 The length of area 10 in the middle)*( Figure 4 The width of the slice object to be scaled in No. 4 / ( Figure 4 Image width of the picture object in - Figure 4 The width of the non-scaled slice object in the middle - Figure 4 The width of the non-scaled slice object in size 7 - Figure 4 The width of the non-scaled slice object in size 13);

[0095] If the target slice object to be scaled belongs to both the horizontal stretching area and the vertical stretching area, the target slice object to be scaled is scaled horizontally and vertically, then the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width = the total length of the horizontal stretching area of ​​the display container * (the target slice width / the total width of the scaling area). Taking the slice object No. 5 to be scaled as an example, the scaling width of the slice object No. 5 to be scaled = ( Figure 5 The width of the middle 5 area + Figure 5 The width of the area in No. 11)*( Figure 4 The width of the slice object to be scaled in No. 5 / ( Figure 4 Image width of the picture object in - Figure 4 The width of the non-scaled slice object in No. 2 - Figure 4 The width of the non-scaled slice object in size 8 - Figure 4 The width of the non-scaled slice object No. 14)), the scaled length of the scaled slice object No. 5 = ( Figure 5 The length of area 5)*( Figure 4 The length of the slice object to be scaled in No. 5 / ( Figure 4 Image length of the picture object in - Figure 4 The length of the non-scaled slice object No. 4 - Figure 4 The length of the non-scaled slice object No. 6 in the middle)).

[0096] S109. A two-dimensional rendering coordinate system is established with the lower left corner of the display container as the origin. With the origin as the starting point, the M non-scaling slice objects and the N scaling slice objects are filled into the display container in a preset filling order to obtain a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects fill each layer in the display container in a left-to-right order, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects are filled layer by layer in a bottom-to-top order.

[0097] In this embodiment, M of the non-scaling slice objects and N of the scaling slice objects are filled into the display container by splicing and restoring them in the display container according to the slice layout of the picture object. For example, the splicing method is to fill the display container with non-scaling slice object No. 1, scaling slice object No. 2, non-scaling slice object No. 3, scaling slice object No. 4, scaling slice object No. 5, scaling slice object No. 6, non-scaling slice object No. 7, scaling slice object No. 8, non-scaling slice object No. 9, scaling slice object No. 10, scaling slice object No. 11, scaling slice object No. 12, non-scaling slice object No. 13, scaling slice object No. 14, and non-scaling slice object No. 15.

[0098] In another optional implementation of the present invention, when the image object is sliced ​​using an image preprocessing tool and based on a deceptive layout to obtain M non-scaled slice objects and N to-be-scaled slice objects, preprocessing information of the image object is obtained, including: image length, image width, fixed area length and fixed area width of the image object, and slice object length and slice object width of each to-be-scaled slice object in the N to-be-scaled slice objects; a scaling ratio of each to-be-scaled slice object is calculated based on the preprocessing information, wherein, for each to-be-scaled slice object, if the to-be-scaled slice object belongs to a horizontal scaling area, the scaling ratio includes a horizontal scaling ratio, and the horizontal scaling ratio=slice object length / (image length-fixed area length); if the to-be-scaled slice object belongs to a vertical scaling area, the scaling ratio The scaling ratio includes a vertical scaling ratio, and the vertical scaling ratio = slice object width / (image length-fixed area width). If the slice object to be scaled belongs to both the horizontal scaling area and the vertical scaling area, the scaling ratio includes a horizontal scaling ratio and a vertical scaling ratio, and the horizontal scaling ratio = slice object length / (image length-fixed area length), and the vertical scaling ratio = slice object width / (image length-fixed area width). M non-scaled slice objects, N slice objects to be scaled, and scaling ratios corresponding to the N slice objects to be scaled are cached in a preset filling order, so the image object to be scaled can also be scaled during filling. The specific filling method is to extract the non-scaled slice objects and the slice objects to be scaled from the memory one by one in the storage order when drawing the point nine diagram, so as to obtain the non-scaled slice objects and the slice objects to be scaled. Figure 4For example, the storage order of the M non-scaled slice objects and the N scaled slice objects in the memory is non-scaled slice object No. 1, slice object No. 2 to be scaled, non-scaled slice object No. 3, slice object No. 4 to be scaled, slice object No. 5 to be scaled, slice object No. 6 to be scaled, non-scaled slice object No. 7, slice object No. 8 to be scaled, slice object No. 9, slice object No. 10 to be scaled, slice object No. 11 to be scaled, slice object No. 12 to be scaled, non-scaled slice object No. 13, slice object No. 14 to be scaled and non-scaled slice object No. 15, and this order is also followed when extracting non-scaled slice objects and slice objects to be scaled; the extracted non-scaled slice objects and slice objects to be scaled are also filled into the display container with the lower left corner of the display container as the starting point. If the extracted non-scaled slice object is directly filled into the display container, if the extracted slice object is a slice object to be scaled, it is added according to the scaling ratio, display container length, The display container width calculates the scaling length and scaling width of the slice object to be scaled, scales the slice object to be scaled to obtain the scaled slice object, extracts the maximum coordinate value (X, Y) of the current filling area, wherein X is less than or equal to the display container length, and Y is less than or equal to the display container width. Based on the maximum coordinate value, the scaling length of the scaled slice object, and the scaling width of the scaled slice object, it is determined whether the scaled slice object can be accommodated, that is, whether the filling length is less than or equal to the display container length, and whether the filling width is less than or equal to the display container width, wherein the filling length = the maximum horizontal coordinate X + scaling length, and the filling width = the maximum vertical coordinate Y + scaling width. If the filling length is less than or equal to the display container length, and the filling width is less than or equal to the display container width, the scaled slice object is filled. If the filling length is greater than the display container length and / or the filling width is greater than the display container width, the scaled slice object is filled with a new line.

[0099] In summary, from the display effect, after the MacOS program is adapted to the NinePatch, it has a more refined and flexible display method compared to the existing image display method. For example, for the bubble setting above, the implementation of the NinePatch solution can perfectly avoid the arrow stretching problem under the bubble in the above picture, and can additionally control the content display area. From the demand perspective, since the NinePatch puts the layout information in the picture, for style replacement requirements (such as skinning), you only need to update the NinePatch resources and send them through the network. The client can flexibly update the layout without agreeing on redundant protocols to send new layout parameters, saving development costs. This type of demand can achieve rapid iteration. From the performance perspective, due to the excellent scaling characteristics and fine display effects of the NinePatch, smaller images can be used to replace repetitive original images to reduce the package size. Since NinePatchKit is also adapted to the large-screen MacOS end, this effect is more obvious, and a large display space can be covered with small images without loss.

[0100] In an optional implementation manner of the first aspect of the present invention, after S109, the step further includes:

[0101] S110. When it is necessary to display text on the zoomed nine-point diagram, divide a text content area on the zoomed nine-point diagram by using the text overlay display tool, fill the received text information into the text content area and display it floating on the zoomed nine-point diagram.

[0102] See also Figure 6 The second aspect of the present invention provides a device for realizing the display of a point nine effect diagram in a MacOS system, comprising:

[0103] Construction module 10, used to construct a third-party nine-dot map rendering framework, the third-party nine-dot map rendering framework includes a PNG data parser, an image preprocessing tool, a display container for carrying the nine-dot map and a text overlay display tool; the PNG data parser includes a BytesUtils component and a PNGParser component, and the PNGParser component includes a registry for extending the parsing of npTc data blocks;

[0104] An integration module 20, used to integrate the third-party point nine-image rendering framework into the MACOS terminal program;

[0105] The receiving module 30 is used to receive the PNG file of the nine-point diagram;

[0106] A decoding module 40, configured to decode the PNG file through the PNG data parser to obtain the image object and scaling mark of the nine-point diagram;

[0107] A layout module 50, configured to obtain a slice layout of the picture object based on the zoom mark;

[0108] A slicing module 60, configured to slice the image object using the image preprocessing tool and based on the slicing layout to obtain M non-scaled slice objects and N to-be-scaled slice objects, wherein M and N are both positive integers;

[0109] A judging module 70, used for determining the size parameters of the display container, and for judging whether the picture object needs to be scaled according to the size parameters of the display container and the size parameters of the picture object;

[0110] A scaling module 80 is used for, when the picture object needs to be scaled, sequentially performing scaling operations on the N slice objects to be scaled to obtain N scaled slice objects;

[0111] The splicing display module 90 is used to establish a two-dimensional rendering coordinate system with the lower left corner of the display container as the origin, and to fill the M non-scaled slice objects and the N scaled slice objects into the display container in a preset filling order with the origin as the starting point, so as to obtain a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaled slice objects and the N scaled slice objects fill each layer in the display container in an order from left to right, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaled slice objects and the N scaled slice objects are filled layer by layer in an order from bottom to top.

[0112] In an optional implementation of the second aspect of the present invention, the decoding module 40 includes:

[0113] A bytecode processing unit, used for performing bytecode processing on the PNG file based on a BytesUtils component to obtain a data structure of the PNG file; the data structure of the PNG file includes a PNG file flag, a file header data block, a plurality of image data blocks, an npTc data block and an image end data block;

[0114] The parsing unit is used to parse the data structure of the PNG file based on the PNGParser component to obtain the picture object and the scaling mark of the nine-point diagram.

[0115] In an optional implementation of the second aspect of the present invention, the parsing unit includes:

[0116] An image information acquisition subunit, used for parsing the image data block of the data structure to obtain the picture object information of the nine-point diagram;

[0117] A picture generating subunit, configured to generate a picture object of the dot-nine diagram based on the picture object information;

[0118] A scaling information acquisition subunit, used for parsing the scaling mark information of the nine-point diagram from the npTc data block of the data structure;

[0119] The zoom mark generating subunit is used to generate the zoom mark of the point-nine diagram at the periphery of the picture object based on the zoom mark information.

[0120] In an optional implementation of the second aspect of the present invention, the scaling module 80 includes:

[0121] A scaling calculation unit, configured to take the non-scaled slice object at the lower left corner of the picture object as a starting point, and sequentially calculate the scaling length and scaling width corresponding to each of the slice objects to be scaled according to the preset filling order;

[0122] The image scaling unit is configured to perform a scaling operation on each of the to-be-scaled slice objects according to the calculated scaling length and scaling width of each of the to-be-scaled slice objects, so as to obtain N scaled slice objects.

[0123] In an optional implementation of the second aspect of the present invention, the scaling calculation unit includes:

[0124] A first acquisition subunit is used to acquire the image length, image width, fixed area length and fixed area width of the picture object;

[0125] a calculation subunit, configured to calculate a total length of the zoomed area based on the image length and the fixed area length, and to calculate a total width of the zoomed area based on the image length and the fixed area width;

[0126] A traversal subunit, configured to traverse the N to-be-scaled slice objects according to the preset filling order, starting from the non-scaled slice object at the lower left corner of the picture object;

[0127] A second acquisition subunit is configured to acquire, for each target slice object to be scaled among the N slice objects to be scaled, a target slice length and a target slice width of the target slice object to be scaled;

[0128] A determination subunit, used for determining the region to which the target to-be-scaled slice object belongs;

[0129] The scaling calculation subunit is used for horizontally scaling only the slice object to be scaled if the target slice object to be scaled only belongs to the horizontal stretching area, and the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width is equal to the target slice width;

[0130] and for performing vertical scaling on the target slice object to be scaled if the target slice object to be scaled only belongs to the vertical stretching area, wherein the scaling width=the total length of the vertical stretching area of ​​the display container*(the target slice width / the total width of the scaling area), and the scaling length is equal to the target slice length;

[0131] And is used for horizontally scaling and vertically scaling the target slice object to be scaled if the target slice object to be scaled belongs to both the horizontal stretching area and the vertical stretching area, then the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width = the total length of the horizontal stretching area of ​​the display container * (the target slice width / the total width of the scaling area).

[0132] In an optional implementation of the second aspect of the present invention, the device for realizing the display of the dot-nine effect diagram in the MacOS system further includes:

[0133] The text overlay module is used to divide the text content area on the scaled nine-point diagram through the text overlay display tool when it is necessary to display text on the scaled nine-point diagram, and fill the received text information into the text content area and display it floating on the scaled nine-point diagram.

[0134] Figure 7 It is a schematic diagram of the structure of a device for realizing the display of a dot-nine effect diagram in a MacOS system provided by an embodiment of the present invention. The device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 100 (for example, one or more processors) and a memory 110, and one or more storage media 130 for storing applications 120 or data (for example, one or more mass storage devices). Among them, the memory and the storage medium can be short-term storage or persistent storage. The program stored in the storage medium may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the device. Furthermore, the processor may be configured to communicate with the storage medium and execute a series of instruction operations in the storage medium on the device.

[0135] The device for realizing the display of the dot-nine effect diagram in the MacOS system of the present invention may also include one or more power supplies 140, one or more wired or wireless network interfaces 150, one or more input and output interfaces 160, and / or one or more operating systems 170, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It can be understood by those skilled in the art that Figure 7 The device structure shown does not constitute a limitation on the device of the present invention, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0136] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the method of the present invention for realizing the display of a nine-point effect diagram in a MacOS system.

[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device or unit described above can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0138] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0139] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for realizing the display of a point nine effect diagram in a MacOS system, characterized in that: Includes steps: Constructing a third-party nine-dot-picture rendering framework, wherein the third-party nine-dot-picture rendering framework includes a PNG data parser, an image preprocessing tool, and a display container for carrying the nine-dot-picture; Integrate the third-party nine-dot rendering framework into the MacOS terminal program; Receive the PNG file of the dot-nine diagram; Decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram; Obtaining a slice layout of the picture object based on the zoom mark; Slicing the image object based on the slice layout using the image preprocessing tool to obtain M non-scaled slice objects and N to-be-scaled slice objects, where M and N are both positive integers; determining a size parameter of the display container, and judging whether the image object needs to be scaled according to the size parameter of the display container and the size parameter of the image object; When the picture object needs to be scaled, the N to-be-scaled slice objects are scaled in sequence to obtain N scaled slice objects; Taking the lower left corner of the display container as the origin, establishing a two-dimensional rendering coordinate system, taking the origin as the starting point, filling the M non-scaling slice objects and the N scaling slice objects into the display container according to a preset filling order, and obtaining a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects fill each layer in the display container in a left-to-right order, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects are filled layer by layer in a bottom-to-top order; The PNG data parser includes a BytesUtils component and a PNGParser component, wherein the PNGParser component includes a registry for extending and parsing npTc data blocks; Decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-dot diagram includes: performing bytecode processing on the PNG file based on the BytesUtils component to obtain the data structure of the PNG file; parsing the data structure of the PNG file based on the PNGParser component to obtain the picture object and scaling mark of the nine-dot diagram; The method of extracting the picture object and zoom mark of the nine-dot diagram from the data structure of the PNG file based on the PNGParser component includes: parsing the picture object information of the nine-dot diagram from the image data block of the data structure; generating the picture object of the nine-dot diagram based on the picture object information; parsing the zoom mark information of the nine-dot diagram from the npTc data block of the data structure; and generating the zoom mark of the nine-dot diagram around the periphery of the picture object based on the zoom mark information.

2. The method for realizing the display of the dot-nine effect diagram in the MacOS system according to claim 1, characterized in that: When the picture object needs to be scaled, the N to-be-scaled slice objects are scaled in sequence to obtain N scaled slice objects, including: Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, the scaling length and scaling width corresponding to each of the to-be-scaled slice objects are calculated in sequence according to the preset filling order; Then, a scaling operation is performed on each of the slice objects to be scaled according to the calculated scaling length and scaling width of each of the slice objects to be scaled, so as to obtain N scaled slice objects.

3. The method for realizing the display of the dot-nine effect diagram in the MacOS system according to claim 2, characterized in that: The method of taking the non-scaled slice object at the lower left corner of the picture object as a starting point and sequentially calculating the scaled length and scaled width corresponding to each of the to-be-scaled slice objects according to the preset filling order includes: Obtain the image length, image width, fixed area length and fixed area width of the picture object; Calculate the total length of the zoom area based on the image length and the fixed area length, and calculate the total width of the zoom area based on the image length and the fixed area width; Taking the non-scaled slice object at the lower left corner of the picture object as the starting point, traverse the N to-be-scaled slice objects according to the preset filling order; For each target slice object to be scaled among the N slice objects to be scaled, obtaining a target slice length and a target slice width of the target slice object to be scaled; Determine the region to which the target slice object to be scaled belongs; If the target slice object to be scaled only belongs to the horizontal stretching area, the slice object to be scaled is only scaled horizontally, and the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width is equal to the target slice width; If the target slice object to be scaled only belongs to the vertical stretching area, only the slice object to be scaled is vertically scaled, the scaling width = the total length of the vertical stretching area of ​​the display container * (the target slice width / the total width of the scaling area), and the scaling length is equal to the target slice length; If the target slice object to be scaled belongs to both the horizontal stretching area and the vertical stretching area, the target slice object to be scaled is scaled horizontally and vertically, then the scaling length = the total length of the horizontal stretching area of ​​the display container * (the target slice length / the total length of the scaling area), and the scaling width = the total length of the horizontal stretching area of ​​the display container * (the target slice width / the total width of the scaling area).

4. The method for realizing the display of dot-nine effect diagram in MacOS system according to claim 1, characterized in that: The nine-point rendering framework also includes a text overlay display tool, which takes the lower left corner of the display container as the origin, establishes a two-dimensional rendering coordinate system, takes the origin as the starting point, fills the M non-scaled slice objects and the N scaled slice objects into the display container according to a preset filling order, and after obtaining the nine-point rendering, it also includes: When it is necessary to display text on the zoomed point-nine diagram; Dividing a text content area on the zoomed point-nine diagram by using the text overlay display tool; The received text information is filled into the text content area and displayed floating on the zoomed nine-point diagram.

5. The method for realizing the display of the dot-nine effect diagram in the MacOS system according to claim 2, characterized in that: The data structure of the PNG file includes a PNG file flag, a file header data block, a palette data block, a plurality of image data blocks, an npTc data block and an image end data block.

6. A device for realizing the display of dot-nine effect diagram in MacOS system, characterized in that: include: A construction module, used to construct a third-party nine-dot image rendering framework, wherein the third-party nine-dot image rendering framework includes a PNG data parser, an image preprocessing tool, and a display container for carrying the nine-dot image; An integration module, used to integrate the third-party point nine-image rendering framework into the MacOS terminal program; The receiving module is used to receive the PNG file of the nine-point diagram; A decoding module, used for decoding the PNG file through the PNG data parser to obtain the picture object and scaling mark of the nine-point diagram; A layout module, configured to obtain a slice layout of the picture object based on the zoom mark; a slicing module, configured to slice the image object using the image preprocessing tool and based on the slicing layout to obtain M non-scaled slice objects and N to-be-scaled slice objects, wherein M and N are both positive integers; A judgment module, used for determining the size parameters of the display container, and for judging whether the picture object needs to be scaled according to the size parameters of the display container and the size parameters of the picture object; A scaling module, used for performing scaling operations on the N to-be-scaled slice objects in sequence when the picture object needs to be scaled, to obtain N scaled slice objects; a splicing display module, for establishing a two-dimensional rendering coordinate system with the lower left corner of the display container as the origin, and filling the M non-scaling slice objects and the N scaling slice objects into the display container in a preset filling order with the origin as the starting point, so as to obtain a point nine effect diagram, wherein the preset filling order is: in the horizontal direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects fill each layer in the display container in a left-to-right order, and in the vertical direction of the two-dimensional rendering coordinate system, the M non-scaling slice objects and the N scaling slice objects are filled layer by layer in a bottom-to-top order; The PNG data parser includes a BytesUtils component and a PNGParser component, wherein the PNGParser component includes a registry for extending and parsing npTc data blocks; Decoding the PNG file by the PNG data parser to obtain the picture object and scaling mark of the nine-dot diagram includes: performing bytecode processing on the PNG file based on the BytesUtils component to obtain the data structure of the PNG file; parsing the data structure of the PNG file based on the PNGParser component to obtain the picture object and scaling mark of the nine-dot diagram; The method of extracting the picture object and zoom mark of the nine-dot diagram from the data structure of the PNG file based on the PNGParser component includes: parsing the picture object information of the nine-dot diagram from the image data block of the data structure; generating the picture object of the nine-dot diagram based on the picture object information; parsing the zoom mark information of the nine-dot diagram from the npTc data block of the data structure; and generating the zoom mark of the nine-dot diagram around the periphery of the picture object based on the zoom mark information.

7. A device for realizing the display of a dot-nine effect diagram in a MacOS system, comprising: A memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; characterized in that the at least one processor calls the instructions in the memory so that the device executes the method for realizing the display of a nine-point effect diagram in a MacOS system as described in any one of claims 1 to 5 above.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method for realizing the display of a nine-point effect diagram in a MacOS system as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Picture processing method and apparatus, server and client

    CN107066430A

  • Information Processing Method and Apparatus, Storage Medium, and Electronic Device

    US20210203767A1