CN114398125B - Point nine effect graph generation method and related device thereof - Google Patents

Point nine effect graph generation method and related device thereof Download PDF

Info

Publication number
CN114398125B
CN114398125B CN202111672857.4A CN202111672857A CN114398125B CN 114398125 B CN114398125 B CN 114398125B CN 202111672857 A CN202111672857 A CN 202111672857A CN 114398125 B CN114398125 B CN 114398125B
Authority
CN
China
Prior art keywords
data
picture
point
code
png
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111672857.4A
Other languages
Chinese (zh)
Other versions
CN114398125A (en
Inventor
周潇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhenai Jieyun Information Technology Co ltd
Original Assignee
Shenzhen Zhenai Jieyun Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhenai Jieyun Information Technology Co ltd filed Critical Shenzhen Zhenai Jieyun Information Technology Co ltd
Priority to CN202111672857.4A priority Critical patent/CN114398125B/en
Publication of CN114398125A publication Critical patent/CN114398125A/en
Application granted granted Critical
Publication of CN114398125B publication Critical patent/CN114398125B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention relates to the field of effect generation, and discloses a method and a related device for generating a point nine effect graph. The method comprises the following steps: the method comprises the following steps: receiving a point nine effect picture generation instruction, and reading picture data corresponding to the point nine effect picture generation instruction; based on the BytesUtils component, performing byte code size end processing on the picture data to obtain byte code analysis data; based on a PNGParser component, carrying out structuring processing on the byte code analysis data to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data; performing frame calculation processing on the picture decoding data, and calculating to generate a drawing frame; and carrying out overall pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect diagram of the picture data in the apple ecosystem.

Description

Point nine effect graph generation method and related device thereof
Technical Field
The invention relates to the field of picture generation, in particular to a method and a related device for generating a point nine effect picture.
Background
The intelligent mobile phone has an automatic transverse screen function, the same interface can change the display direction along with the different parameters of a direction sensor in the mobile phone (or a tablet personal computer), and after the direction of the interface is changed, the graph on the interface can be stretched due to the change of the length and the width, so that the distortion and the deformation of the graph are caused. The android platform has various resolutions, and corners of the cut image files of many controls are fuzzy and distorted after the cut image files are amplified and stretched. By using the point nine PNG technology under an android platform, the picture can be stretched transversely and longitudinally at the same time, so that a perfect display effect under multiple resolutions is realized. After the point nine-picture technology is used, only one set of interface cutting pictures is needed to adapt to different resolutions, and the size of the installation package is greatly reduced. And the program can realize the stretching without special processing, and the code quantity and the development workload are reduced.
However, the point nine graph technology can only be applied under the android platform in terms of system application, but cannot be used in the apple ecosystem. Therefore, a technology is needed to solve the technical problem that the apple ecosystem cannot generate and display the point nine effect map.
Disclosure of Invention
The invention mainly aims to solve the technical problem that an apple ecological system cannot generate and display a point nine effect map.
The first aspect of the invention provides a point nine effect graph generating method which is applied to an apple ecosystem, and the method comprises the following steps:
receiving a point nine effect picture generation instruction, and reading picture data corresponding to the point nine effect picture generation instruction;
based on the BytesUtils component, performing byte code size end processing on the picture data to obtain byte code analysis data;
based on a PNGParser component, carrying out structuring processing on the byte code analysis data to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data;
performing frame calculation processing on the picture decoding data, and calculating to generate a drawing frame;
and carrying out overall pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect diagram of the picture data in the apple ecosystem.
Optionally, in a first implementation manner of the first aspect of the present invention, the performing extended parsing processing on the PNG structure picture data to obtain picture decoding data includes:
judging whether the head character string identifier of the PNG structure picture data is a preset PNG character string identifier or not;
if the character number is the PNG character string identification, defining the character number of the head character string identification as a preset index character number;
judging whether characters exist after the last character of the index character number;
if characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC verification code of the PNG structure picture data, and adding the number of characters of the length code, the number of characters of the data block type code, the number of characters of the picture content data block and the number of check characters of the CRC verification code into the index number of characters;
judging whether the index character number reaches a preset analysis completion threshold value or not;
and if the analysis completion threshold is reached, analyzing the length code, the data block type code, the picture content data block and the CRC verification code based on the PNGParser plug-in to obtain picture decoding sub-data.
Optionally, in a second implementation manner of the first aspect of the present invention, the parsing the length code, the data block type code, the picture content data block, and the CRC validation code based on the PNGParser plug-in to obtain picture decoding sub-data includes:
identifying a preset npTc Chunk type code in the data block type codes;
and clearing the index character number, and performing expansion processing on the picture content data block corresponding to the npTc Chunk type code according to a preset expansion algorithm and the index character number to obtain picture decoding sub-data.
Optionally, in a third implementation manner of the first aspect of the present invention, the drawing frame includes: and the image fixing proportion area and the image scaling area are used for carrying out integral pixel placement processing in the drawing frame according to the image decoding data to obtain a point nine effect diagram in the apple ecosystem, wherein the point nine effect diagram comprises the following steps:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding sub-data, wherein N is an integer;
scaling the picture decoding sub-data corresponding to the image scaling area;
and writing the pixel data of the scaled N picture decoding sub-data into the drawing frame to obtain a point nine effect graph in the apple ecosystem.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the performing a frame calculation process on the picture decoding data, and calculating to generate a drawing frame includes:
reading coordinate data of a content white boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a horizontal scaling area and a vertical scaling area on the image decoding data according to the coordinate data and the fixed area, and generating a drawing frame.
Optionally, in a fifth implementation manner of the first aspect of the present invention, after performing overall pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect map display effect in an apple ecosystem, the method further includes:
generating custom class data from the drawing frame through an Image class of the inheritance system;
and storing the picture decoding data in an in-memory database.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the byte-based module performs size-end processing on the byte code of the picture data to obtain byte-code analysis data, where the byte-code analysis data includes:
based on the BytesUtils component, dividing the byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
The second aspect of the present invention provides a device for generating a point nine effect map, which is characterized in that the device for generating a point nine effect map includes:
the receiving module is used for receiving the point nine effect picture generation instruction and reading picture data corresponding to the point nine effect picture generation instruction;
the dividing module is used for carrying out byte code size end processing on the picture data based on the byte estulis component to obtain byte code analysis data;
the analysis module is used for carrying out structural processing on the byte code analysis data based on the PNGParser component to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data;
the frame calculation module is used for carrying out frame calculation processing on the picture decoding data and calculating to generate a drawing frame;
and the pixel placement module is used for carrying out overall pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect diagram of the picture data in the apple ecosystem.
The third aspect of the present invention provides a point nine effect map generating method and apparatus, including: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause the point nine effect map generating method apparatus to perform the point nine effect map generating method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the above-described point nine effect map generation method.
In the embodiment of the invention, a data model of a parser is designed according to a PNG picture data structure; the parser can decode binary data of the PNG file into a data model, which can be flexibly extended if a special segment structure exists. Splitting the drawing work of the point nine graph into three parts of decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to parse and convert the point nine image data into image objects, and buffer some preprocessing information for use in the drawing stage, and the two stages are executed only once. The instant drawing stage is to carry the point nine graph by using a given container, which will be drawn in real time in combination with its actual size. The nine-point map rendering Framework is packaged into a Framework which is adapted to an AppKit Framework of an apple ecosystem such as macOS, iOS, iPadOS, watchOS, tvOS, and can be directly used by a developer.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a method for generating a point nine effect map according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a PNG graph data structure of a method for generating a point nine effect graph according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a data structure of a data block of a method for generating a point nine effect map according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a point nine point map zoom frame of a point nine effect map generating method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an embodiment of a point nine effect map generating apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another embodiment of a point nine effect map generating apparatus according to an embodiment of the present invention;
fig. 7 is a schematic diagram of an embodiment of a point nine effect map generating apparatus according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a point nine effect graph generation method and a related device thereof.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and an embodiment of a method for generating a point nine effect map in an embodiment of the present invention includes the steps of:
101. receiving a point nine effect picture generation instruction, and reading picture data corresponding to the point nine effect picture generation instruction;
in this embodiment, the point nine effect map generation instruction is activated in the apple ecosystem, and here, the difference between the general PNG map and the point nine map needs to be described. As shown in fig. 2 for explaining specific information of PNG pictures, each PNG picture has a structure in which signature is used as an identifier of PNG picture, chunk is entity Data of PNG picture, length is used as an identifier of Chunk Data defining Data Length in each Chunk Data, length is used as an identifier of Chunk Data defining Data Length, chunk Type Code is used as a Type of Data Chunk defining Data and has a Length of four bytes, chunk Data is actual Data of PNG picture, and CRC is check Code of 4 bytes for calibration. As illustrated in fig. 3, the detailed information of the point nine graph is that the point nine graph is actually different from the PNG graph in that only Chunk Data is different on Chunk Data, and the Data composition definition of npTc Chunk Data is different.
The data structure based on the point nine graph is different from that of the PNG graph, so that the point nine graph generation process in the apple ecosystem is actually completely different from that of the common PNG graph, and the generation mode on the android cannot be used.
102. Based on the BytesUtils component, performing byte code size end processing on the picture data to obtain byte code analysis data;
in this embodiment, the byte modules are byte processing tools, and are responsible for reading, intercepting and size-end compatible operations of a file byte stream, and are responsible for local extraction and ordered arrangement of bytes, and the size-end is a process of processing high bytes and low bytes by a computer, and is the same process of processing the picture data. The processing procedure comprises the following two modes:
big-end mode, meaning that the high bytes of data are stored in the low addresses of memory and the low bytes of data are stored in the high addresses of memory, is somewhat analogous to treating data as a string sequence: the address is greatly increased from small to large, and the data is put from high to low; this is consistent with our reading habits.
The small-end mode refers to that the high byte of the data is stored in the high address of the memory, the low byte of the data is stored in the low address of the memory, and the storage mode effectively combines the high-low address part weight with the data bit weight, and the high-low address part weight is low.
Further, at 102 the following steps may be performed:
1021. based on the BytesUtils component, the byte data of the picture data is divided into a header character string identifier and an entity data block, and byte code analysis data is obtained.
In 1021, the Bytes Utils component is to base the picture data format from a long string of characters on the PNG structure, and the header character string is the head character of the identifier, which is the main identifier for defining and classifying the data in the process of reading the data by the computer in the process of data identification. Dividing the header string identifier of the signature and the entity Data block Chunk, wherein the Chunk has four parts including Length, chunk Type Code, npTc Chunk Data and CRC in sequence, and a plurality of Chunk, and the Data structures of fig. 2 and 3 can be referred to herein, which are the formats defined by PNG pictures, and the ordered PNG byte Data is obtained after analysis.
103. Based on the PNGParser component, carrying out structuring processing on the byte code analysis data to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data;
in this embodiment, the PNG Parser is a PNg file Parser, which relies on Bytes Util, responsible for converting Bytes into a PNG data structure. The PNG Parser contains a registry which can register a special Chunk segment data structure for the Parser to expand and parse to be compatible with a special PNG data structure such as a point nine graph, and the whole point nine graph parsing work is completed by the PNG Parser.
Further, in the "performing extended parsing processing on PNG structure picture data to obtain picture decoding data", the following steps may be performed:
1031. judging whether the head character string identifier of the PNG structure picture data is a preset PNG character string identifier or not;
1032. if the character number is the PNG character string identification, defining the character number of the head character string identification as a preset index character number;
1033 judging whether characters exist after the last character of the index character number;
1034. if the characters exist, sequentially reading the length code, the data block type code, the picture content data block and the CRC verification code of the PNG structure picture data, and adding the character number of the length code, the character number of the data block type code, the character number of the picture content data block and the check character number of the CRC verification code into the index character number;
1035. judging whether the index character number reaches a preset analysis completion threshold value or not;
1036. and if the analysis completion threshold is reached, analyzing the length code, the data block type code, the picture content data block and the CRC verification code based on the PNGParser plug-in to obtain picture decoding sub-data.
In steps 1031-1036, it is analyzed whether the header string is "89504e470d0a1a0a", and if it is determined that it is a PNG string identification, processing of the structure picture data is continued. And if the PNG string identification is not, the processing is directly ended. And when the PNG character string identification is determined, determining that the index character number is 8, and then further judging whether the PNG character string identification has a character string or not. Defining the head character string identification is to define the character value for index calculation, if the character number of the head character string is determined, and characters exist after the last character sequence of the head character string identification, analyzing the length code, the data block type code, the picture content data block and the CRC verification code. 4 is added to the index character number when the length code is analyzed each time, 4 is added to the index character number when the data block type code is analyzed each time, and the data size corresponding to the length code, namely the character number of the picture content data block, is added to the index character number when the picture content data block is analyzed each time. The CRC verification code is processed in different processes, and the character number of the checked picture content data block is added to the index character number after the CRC verification code is analyzed. Whether the expansion of the Chunk Data is completed or not is judged by the numerical value of the index character number, if the expansion is completed, the PNG Parser plug-in is directly analyzed, and after 1036 is completed, the judgment is returned to 1033, and the analysis is mainly carried out by a plurality of Chunk Data and needs to be continuously and circularly read.
Further, at 1036, the following steps may be performed:
10361. identifying a preset npTc Chunk type code in the data block type codes;
10362. and clearing the index character number, and performing expansion processing on the picture content data block corresponding to the npTc Chunk type code according to a preset expansion algorithm and the index character number to obtain picture decoding sub-data.
In steps 10361, 10362, for the point nine graph, because of containing a special chunck segment npTc Chunk structure, the processing is performed by implementing chunkData expansion analysis method in PNG Parser, and when npTc Chunk type code is identified, the index character number begin index is cleared. After the beginindex=0, the beginindex=beginindex+1 is performed, the set abscissa length X is read, and the beginindex=beginindex+1 is performed. The fixed ordinate length Y is read, and the beginindex=beginindex+1 is performed. The color array length is read, the begin=begin index+1 is performed, 8 bytes are skipped, and the begin=begin index+8 is performed. The left boundary length of the content is read, and the beginindex=beginindex+4 is performed. The right boundary length of the content is read, and the begin index=begin index+4 is performed. Read the top boundary length, execute benlndex = benlndex+4. The bottom boundary length is read and the begin=begin index+4 is performed. Skip 4 bytes and execute the benlndex=benlndex+4. Defining a counter i, i=0, judging whether i is smaller than the abscissa length X, if so, assigning the begin index to i, executing the begin index=begin index+4, then judging whether i is smaller than the abscissa length X, and looping until i is not smaller than the abscissa length X to execute the following steps. Defining a counter j, j=0, determining if j is less than the ordinate length Y, assigning a value to j if less, performing a value of bensindex=bensindex+4, and judging whether j is smaller than the ordinate length Y, and executing the following steps until j is not smaller than the ordinate length Y. Defining a counter m, m=0, judging whether m is smaller than the color array length, if so, assigning a value to m, and then judging whether m is smaller than the color array length, circulating until m is not smaller than the color array length, and ending the analysis process.
104. Performing frame calculation processing on the picture decoding data, and calculating to generate a drawing frame;
in this embodiment, the ninePatchkit is a set of icos & macOS end point nine-graph rendering framework, and is responsible for generating nine-point graph objects and providing nine-point graph containers, and can be quickly integrated into project engineering through the apple cocoaPods command line. As shown in fig. 4, the black lines on the left and the upper side represent horizontal and vertical zoom regions, respectively, the zoom regions may have multiple segments, and if there are multiple segments, the zoom regions in this direction are represented as multiple segments, and the zoom regions in this direction are proportional to the line length (for example, the vertical direction of the upper drawing is marked with two vertical stretching regions, and the two marked lines have a length of 1:1, which represents that when stretching or compression is required in the vertical direction, the stretching or compression degree of the two regions is the same); the black lines on the right and the lower side respectively represent the horizontal and vertical content areas, and after compiling, the black line graph can put the information coordinates into the npTc Chunk segment to obtain the final point nine effect graph.
Further, the execution at 104 may perform the steps of:
1041. taking coordinate data of a content white boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
1042. the image decoding data is marked with a horizontal scaling area and a vertical scaling area according to the coordinate data and the fixed area, and a drawing frame is generated.
In steps 1041, 1042, reference is made to fig. 4 mainly for illustrating the idea of a region that is scalable both in terms of the margin width and outside the fixed region. In fig. 4, the image area requiring the highlighting of the distortion is also a fixed area, except that the four boundary areas requiring the display are fixed and non-zoomed areas. It should be noted here that the deformed image may be not only in the middle but also at the edges, which varies according to the process of design. However, the fixed area and the area outside the boundary can be used as the zoom area, and then the zoom area is recorded by the similar projection angles of the horizontal and vertical of the area record, so that the drawing frame is obtained. When calculating the horizontal fixed length, xList is the x-axis direction coordinate set of the starting point and the ending point of the black line, and is arranged according to the x0 starting end, the x0 ending end, the x1 starting end, the x1 ending end … xs starting end and the xs ending end, and the horizontal fixed area is the length of the image which is not in xList, so that the horizontal fixed area = the sum of all lengths of the horizontal length-xList, and the method for calculating the vertical fixed length is consistent with the method for calculating the horizontal fixed length.
105. And according to the picture decoding data, carrying out overall pixel placement processing in the drawing frame to obtain a point nine effect diagram of the picture data in the apple ecosystem.
In this embodiment, the filling of the drawing frame is performed directly in blocks, and the whole pixel placement process is to transfer the pixel value matrix of a certain area to the display component to define the display of the certain area, so that the effect of direct copying and whole scaling is similar to that of the display process.
Referring to fig. 4, an area where the edge is not scaled is fixed as an original area, and a horizontal and vertical pulling-up area, which is black in the center, are required to be pulled up or scaled according to the content according to the scale of the display screen, where pulling up or scaling means a coefficient, for example, a pulling up ratio is greater than 1, and a pulling up ratio is less than 1.
Further, the drawing frame includes: the image fixed scale region, the image scaling region, 105 steps may perform the steps of:
1051. based on a drawing frame, cutting the picture decoding data to obtain N picture decoding sub-data, wherein N is an integer;
1052. scaling the picture decoding sub-data corresponding to the image scaling area;
1053. and writing the pixel data of the scaled N picture decoding sub-data into a drawing frame to obtain a point nine effect graph in the apple ecosystem.
In steps 1051-1053, disassembly is first performed based on the structure of the frame, where disassembly is determined based on the number of partitions of the frame. And respectively carrying out abscissa scaling and then ordinate scaling on the region needing scaling in the frame, or carrying out ordinate scaling and then abscissa scaling to obtain a plurality of scaled picture decryption sub-data. The picture decryption sub-data are all independent units, and are integrally filled back into the drawing frame according to the original unit mapping relation, so that a point nine effect diagram in the apple ecosystem is obtained.
Further, after 105, the following steps may also be performed:
106. generating custom class data by the drawing frame through the Image class of the inheritance system;
107. the picture decoding data is stored in an in-memory database.
In the steps 106-107, a custom class is generated by inheriting the system Image class, and the attribute in the custom class is expanded, wherein the expanded attribute comprises: the attribute values are calculated and cached in the memory when generating the inheritance type object according to the subgraph of the black line mark clipping around, and the solidWidth (the sum of the total pixel width of the scaling area is not used in the horizontal direction) and the padding (the left of the right and lower marked content area relative to the boundary in fig. 4).
After the point nine-graph object is generated, a point nine-graph path and a key-value form cache of the point nine-graph object are established according to the point nine-graph path, and PNG phase search cache is directly skipped under the condition that the point nine-graph with the same address is repeatedly read, so that the efficiency is higher.
In the embodiment of the invention, a data model of a parser is designed according to a PNG picture data structure; the parser can decode binary data of the PNG file into a data model, which can be flexibly extended if a special segment structure exists. Splitting the drawing work of the point nine graph into three parts of decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to parse and convert the point nine image data into image objects, and buffer some preprocessing information for use in the drawing stage, and the two stages are executed only once. The instant drawing stage is to carry the point nine graph by using a given container, which will be drawn in real time in combination with its actual size. The nine-point map rendering Framework is packaged into a Framework which is adapted to an AppKit Framework of an apple ecosystem such as macOS, iOS, iPadOS, watchOS, tvOS, and can be directly used by a developer.
The method for generating the point nine effect map in the embodiment of the present invention is described above, and the device for generating the point nine effect map in the embodiment of the present invention is described below, referring to fig. 5, in which the device for generating the point nine effect map in the embodiment of the present invention includes:
the receiving module 501 is configured to receive a point nine effect map generating instruction, and read picture data corresponding to the point nine effect map generating instruction;
the dividing module 502 is configured to perform byte code size end processing on the picture data based on the byte esuitis component, so as to obtain byte code analysis data;
the parsing module 503 is configured to perform structural processing on the byte code parsing data based on a PNGParser component to obtain PNG structure picture data, and perform expansion parsing processing on the PNG structure picture data to obtain picture decoding data;
the frame calculation module 504 is configured to perform frame calculation processing on the picture decoding data, and calculate to generate a drawing frame;
and the pixel placement module 505 is configured to perform overall pixel placement processing in the drawing frame according to the picture decoding data, so as to obtain a point nine effect diagram of the picture data in the apple ecosystem.
In the embodiment of the invention, a data model of a parser is designed according to a PNG picture data structure; the parser can decode binary data of the PNG file into a data model, which can be flexibly extended if a special segment structure exists. Splitting the drawing work of the point nine graph into three parts of decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to parse and convert the point nine image data into image objects, and buffer some preprocessing information for use in the drawing stage, and the two stages are executed only once. The instant drawing stage is to carry the point nine graph by using a given container, which will be drawn in real time in combination with its actual size. The point nine graph rendering Framework is packaged into a Framework that adapts the UIKit of iOS and the AppKit Framework of macOS, which can be used directly by iOS and macOS developers.
Referring to fig. 6, in another embodiment of the present invention, a method and an apparatus for generating a point-nine effect map include:
the receiving module 501 is configured to receive a point nine effect map generating instruction, and read picture data corresponding to the point nine effect map generating instruction;
the dividing module 502 is configured to perform byte code size end processing on the picture data based on the byte esuitis component, so as to obtain byte code analysis data;
the parsing module 503 is configured to perform structural processing on the byte code parsing data based on a PNGParser component to obtain PNG structure picture data, and perform expansion parsing processing on the PNG structure picture data to obtain picture decoding data;
the frame calculation module 504 is configured to perform frame calculation processing on the picture decoding data, and calculate to generate a drawing frame;
and the pixel placement module 505 is configured to perform overall pixel placement processing in the drawing frame according to the picture decoding data, so as to obtain a point nine effect diagram of the picture data in the apple ecosystem. The dividing module 502 is specifically configured to:
based on the BytesUtils component, dividing the byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
Wherein, the parsing module 503 includes:
a header identifier determining unit 5031, configured to determine whether a header string identifier of the PNG structure picture data is a preset PNG string identifier;
a loop judging unit 5032 for defining the number of characters of the head character string identifier as the preset index number if the PNG character string identifier is a PNG character string identifier
A character presence judging unit 5033 configured to judge whether or not a character is present after the last character of the index character number;
an index counting unit 5034, configured to sequentially read a length code, a data block type code, a picture content data block, and a CRC validation code of the PNG structure picture data if there are characters, and add the number of characters of the length code, the number of characters of the data block type code, the number of characters of the picture content data block, and the number of check characters of the CRC validation code to the index number of characters;
an execution judgment unit 5035, configured to judge whether the index character number reaches a preset parsing completion threshold;
and the decoding unit 5036 is configured to, if the analysis completion threshold is reached, perform analysis processing on the length code, the data block type code, the picture content data block, and the CRC verification code based on the PNGParser plug-in, so as to obtain picture decoding sub-data.
Wherein, the decoding unit 5036 specifically is configured to:
identifying a preset npTc Chunk type code in the data block type codes;
and clearing the index character number, and performing expansion processing on the picture content data block corresponding to the npTc Chunk type code according to a preset expansion algorithm and the index character number to obtain picture decoding sub-data.
Wherein, the frame calculation module 504 is specifically configured to:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding sub-data, wherein N is an integer;
scaling the picture decoding sub-data corresponding to the image scaling area;
and writing the pixel data of the scaled N picture decoding sub-data into the drawing frame to obtain a point nine effect graph in the apple ecosystem.
Wherein, the frame calculation module 504 is specifically configured to:
reading coordinate data of a content white boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a horizontal scaling area and a vertical scaling area on the image decoding data according to the coordinate data and the fixed area, and generating a drawing frame.
The apparatus for generating the point nine effect map further includes a storage module 506, where the storage module 506 is specifically configured to:
generating custom class data from the drawing frame through an Image class of the inheritance system;
and storing the picture decoding data in an in-memory database.
In the embodiment of the invention, a data model of a parser is designed according to a PNG picture data structure; the parser can decode binary data of the PNG file into a data model, which can be flexibly extended if a special segment structure exists. Splitting the drawing work of the point nine graph into three parts of decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to parse and convert the point nine image data into image objects, and buffer some preprocessing information for use in the drawing stage, and the two stages are executed only once. The instant drawing stage is to carry the point nine graph by using a given container, which will be drawn in real time in combination with its actual size. The point nine graph rendering Framework is packaged into a Framework that adapts the UIKit of iOS and the AppKit Framework of macOS, which can be used directly by iOS and macOS developers.
Fig. 5 and fig. 6 above describe the apparatus for generating a point-nine effect map in the embodiment of the present invention in detail from the point of view of the modularized functional entity, and the apparatus for generating a point-nine effect map in the embodiment of the present invention is described in detail from the point of view of hardware processing below.
Fig. 7 is a schematic structural diagram of a point-nine effect map generating method apparatus according to an embodiment of the present invention, where the point-nine effect map generating method apparatus 700 may generate relatively large differences according to different configurations or performances, and may include one or more processors (central processing units, CPU) 710 (e.g., one or more processors) and a memory 720, and one or more storage media 730 (e.g., one or more mass storage devices) storing application programs 733 or data 732. Wherein memory 720 and storage medium 730 may be transitory or persistent. The program stored in the storage medium 730 may include one or more modules (not shown), each of which may include a series of instruction operations in the point-to-point nine-effect map generating method apparatus 700. Still further, the processor 710 may be configured to communicate with the storage medium 730 and execute a series of instruction operations in the storage medium 730 on the point nine effect map generating method apparatus 700.
The point nine effect diagram based generating method apparatus 700 may also include one or more power supplies 740, one or more wired or wireless network interfaces 750, one or more input/output interfaces 760, and/or one or more operating systems 731, such as Windows Server, mac OS X, unix, linux, freeBSD, etc. It will be appreciated by those skilled in the art that the point nine effect map generating method apparatus structure illustrated in fig. 7 is not limiting of the point nine effect map generating method apparatus, and may include more or fewer components than illustrated, or may combine certain components, or may be a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, or may be a volatile computer readable storage medium, where instructions are stored in the computer readable storage medium, when the instructions are executed on a computer, cause the computer to perform the steps of the point nine effect map generating method.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A point nine effect map generating method, characterized by being applied to an apple ecosystem, comprising the steps of:
receiving a point nine effect picture generation instruction, and reading picture data corresponding to the point nine effect picture generation instruction;
based on the BytesUtils component, performing byte code size end processing on the picture data to obtain byte code analysis data;
based on a PNGParser component, carrying out structuring processing on the byte code analysis data to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data;
performing frame calculation processing on the picture decoding data, and calculating to generate a drawing frame;
according to the picture decoding data, carrying out overall pixel placement processing in the drawing frame to obtain a point nine effect diagram of the picture data in the apple ecosystem;
the step of performing expansion analysis processing on the PNG structure picture data to obtain picture decoding data comprises the following steps:
judging whether the head character string identifier of the PNG structure picture data is a preset PNG character string identifier or not;
if the character number is the preset PNG character string identifier, defining the character number of the head character string identifier as a preset index character number;
judging whether characters exist after the last character of the head character string identifier;
if characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC verification code of the PNG structure picture data, and adding the number of characters of the length code, the number of characters of the data block type code, the number of characters of the picture content data block and the number of check characters of the CRC verification code into the index number of characters;
judging whether the index character number reaches a preset analysis completion threshold value or not;
if the analysis completion threshold is reached, analyzing the length code, the data block type code, the picture content data block and the CRC verification code based on a PNGParser plug-in to obtain picture decoding sub-data;
the PNGParser plug-in unit is used for analyzing the length code, the data block type code, the picture content data block and the CRC verification code to obtain picture decoding sub-data, and the picture decoding sub-data comprises the following steps:
identifying a preset npTc Chunk type code in the data block type codes;
and clearing the index character number, and performing expansion processing on the picture content data block corresponding to the npTc Chunk type code according to a preset expansion algorithm and the index character number to obtain picture decoding sub-data.
2. The point nine effect map generating method according to claim 1, wherein said drawing frame comprises: the image fixing proportion area and the image scaling area, the processing of overall pixel placement in the drawing frame according to the image decoding data, and the obtaining of the point nine effect graph of the image data in the apple ecosystem comprises the following steps:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding sub-data, wherein N is an integer;
scaling the picture decoding sub-data corresponding to the image scaling area;
and writing the pixel data of the scaled N picture decoding sub-data into the drawing frame to obtain the point nine effect diagram of the picture data in the apple ecosystem.
3. The point nine effect map generating method according to claim 1, wherein said performing frame calculation processing on said picture decoding data, calculating to generate a drawing frame includes:
reading coordinate data of a content white boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a horizontal scaling area and a vertical scaling area on the picture decoding data according to the coordinate data and the fixed area, and generating a drawing frame.
4. The point nine effect map generating method according to claim 1, wherein after performing integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect map of the picture data in the apple ecosystem, further comprising:
generating custom class data from the drawing frame through an Image class of the inheritance system;
and storing the picture decoding data in an in-memory database.
5. The method for generating a point nine effect map according to claim 1, wherein said byte-based components perform byte-code size-end processing on said picture data to obtain byte-code parsing data, comprising:
based on the BytesUtils component, dividing the byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
6. The device for generating the point nine effect map is characterized by being applied to an apple ecosystem, and comprises the following steps:
the receiving module is used for receiving the point nine effect picture generation instruction and reading picture data corresponding to the point nine effect picture generation instruction;
the dividing module is used for carrying out byte code size end processing on the picture data based on the byte estulis component to obtain byte code analysis data;
the analysis module is used for carrying out structural processing on the byte code analysis data based on the PNGParser component to obtain PNG structure picture data, and carrying out expansion analysis processing on the PNG structure picture data to obtain picture decoding data;
the frame calculation module is used for carrying out frame calculation processing on the picture decoding data and calculating to generate a drawing frame;
the pixel placement module is used for carrying out overall pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect diagram of the picture data in the apple ecosystem;
the analysis module is specifically configured to:
judging whether the head character string identifier of the PNG structure picture data is a preset PNG character string identifier or not;
if the character number is the preset PNG character string identifier, defining the character number of the head character string identifier as a preset index character number;
judging whether characters exist after the last character of the head character string identifier;
if characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC verification code of the PNG structure picture data, and adding the number of characters of the length code, the number of characters of the data block type code, the number of characters of the picture content data block and the number of check characters of the CRC verification code into the index number of characters;
judging whether the index character number reaches a preset analysis completion threshold value or not;
if the analysis completion threshold is reached, analyzing the length code, the data block type code, the picture content data block and the CRC verification code based on a PNGParser plug-in to obtain picture decoding sub-data;
wherein, the parsing module is further specifically configured to:
identifying a preset npTc Chunk type code in the data block type codes;
and clearing the index character number, and performing expansion processing on the picture content data block corresponding to the npTc Chunk type code according to a preset expansion algorithm and the index character number to obtain picture decoding sub-data.
7. The point nine effect graph generating device is characterized in that the point nine effect graph generating method device comprises the following steps: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the point nine effect map generating method apparatus to perform the point nine effect map generating method of any one of claims 1-5.
8. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the point nine effect map generation method according to any of claims 1-5.
CN202111672857.4A 2021-12-31 2021-12-31 Point nine effect graph generation method and related device thereof Active CN114398125B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111672857.4A CN114398125B (en) 2021-12-31 2021-12-31 Point nine effect graph generation method and related device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111672857.4A CN114398125B (en) 2021-12-31 2021-12-31 Point nine effect graph generation method and related device thereof

Publications (2)

Publication Number Publication Date
CN114398125A CN114398125A (en) 2022-04-26
CN114398125B true CN114398125B (en) 2024-02-27

Family

ID=81228201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111672857.4A Active CN114398125B (en) 2021-12-31 2021-12-31 Point nine effect graph generation method and related device thereof

Country Status (1)

Country Link
CN (1) CN114398125B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066430A (en) * 2017-04-21 2017-08-18 广州爱九游信息技术有限公司 Image processing method, device, service end and client
CN109344277A (en) * 2018-08-31 2019-02-15 网易传媒科技(北京)有限公司 Image processing method, device, medium and calculating equipment
CN110795393A (en) * 2019-10-31 2020-02-14 中孚安全技术有限公司 Method, system, equipment and readable storage medium for analyzing binary format of document
CN113096217A (en) * 2021-03-25 2021-07-09 北京达佳互联信息技术有限公司 Picture generation method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11157620B2 (en) * 2019-08-27 2021-10-26 Trend Micro Incorporated Classification of executable files using a digest of a call graph pattern

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066430A (en) * 2017-04-21 2017-08-18 广州爱九游信息技术有限公司 Image processing method, device, service end and client
CN109344277A (en) * 2018-08-31 2019-02-15 网易传媒科技(北京)有限公司 Image processing method, device, medium and calculating equipment
CN110795393A (en) * 2019-10-31 2020-02-14 中孚安全技术有限公司 Method, system, equipment and readable storage medium for analyzing binary format of document
CN113096217A (en) * 2021-03-25 2021-07-09 北京达佳互联信息技术有限公司 Picture generation method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114398125A (en) 2022-04-26

Similar Documents

Publication Publication Date Title
US6801673B2 (en) Section extraction tool for PDF documents
CN110879937A (en) Method and device for generating webpage from document, computer equipment and storage medium
US20070136660A1 (en) Creation of semantic objects for providing logical structure to markup language representations of documents
KR20130143725A (en) Cross-compiling swf to html using an intermediate format
CN106933887B (en) Data visualization method and device
CN108399172B (en) Vector diagram generation method and device
CN113127125B (en) Page automatic adaptation method, device, equipment and storage medium
CN113703785B (en) Component-based platform deployment method, device, equipment and storage medium
CN108089865A (en) Using method of cutting out, device and storage medium
CN112507260A (en) Webpage loading method and device, electronic equipment and computer readable storage medium
CN113126990A (en) Page development method, device, equipment and storage medium
CN112559453A (en) Data storage method and device, electronic equipment and storage medium
CN109658485B (en) Webpage animation drawing method, device, computer equipment and storage medium
CN114416056A (en) Page generation method, system, computer equipment and readable storage medium
CN105824647A (en) Form page generating method and device
CN114398125B (en) Point nine effect graph generation method and related device thereof
CN111949312B (en) Packaging method and device for data module, computer equipment and storage medium
US8656371B2 (en) System and method of report representation
CN111414107A (en) Scalable vector graphics processing method and system
CN112328298A (en) Code library cutting method and device for mobile terminal
CN107193815B (en) Page code processing method, device and equipment
CN110928540A (en) Page generation method and device
CN115935909A (en) File generation method and device and electronic equipment
CN115061684A (en) Compatible method, system, equipment and storage medium for packaging layu framework
CN113987242A (en) File picture visualization method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant