CN114398125A - 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
CN114398125A
CN114398125A CN202111672857.4A CN202111672857A CN114398125A CN 114398125 A CN114398125 A CN 114398125A CN 202111672857 A CN202111672857 A CN 202111672857A CN 114398125 A CN114398125 A CN 114398125A
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.)
Granted
Application number
CN202111672857.4A
Other languages
Chinese (zh)
Other versions
CN114398125B (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

Images

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 point nine effect graph generation method and a related device thereof. The method comprises the following steps: the method comprises the following steps: receiving a point nine effect graph generating instruction, and reading picture data corresponding to the point nine effect graph generating instruction; based on the BytesUtils component, carrying out byte code size end processing on the picture data to obtain byte code analysis data; based on a PNGParser component, carrying out structuralization processing on the byte code analysis data to obtain PNG structure picture data, and carrying out extension 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 integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect picture 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 point nine effect picture generation method and a related device thereof.
Background
The smart phone has an automatic screen-crossing function, the display direction of the same interface can be changed along with the difference of parameters of a direction sensor in the smart 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 cut files of a plurality of controls can be blurred and distorted after the cut files are enlarged and stretched. Under the android platform, by using the point nine PNG technology, the picture can be stretched transversely and longitudinally at the same time so as to realize the perfect display effect under multiple resolutions. After the point nine-graph technology is used, only one set of interface cutting graph is needed to be adapted to different resolutions, and the size of the installation package is greatly reduced. And the program can realize the stretching without special processing, thereby reducing the code amount and the development workload.
However, in terms of system application, the nine-point graph technology can only be applied under the android platform, 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 dot-nine effect map.
Disclosure of Invention
The invention mainly aims to solve the technical problem that an apple ecosystem cannot generate and display a point nine effect graph.
The invention provides a method for generating a point nine effect graph, which is applied to an apple ecosystem and comprises the following steps:
receiving a point nine effect graph generating instruction, and reading picture data corresponding to the point nine effect graph generating instruction;
based on the BytesUtils component, carrying out byte code size end processing on the picture data to obtain byte code analysis data;
based on a PNGParser component, carrying out structuralization processing on the byte code analysis data to obtain PNG structure picture data, and carrying out extension 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 integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect picture 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 on the PNG structure picture data to obtain picture decoding data includes:
judging whether the head character string identification of the PNG structure picture data is a preset PNG character string identification;
if the head character string is the PNG character string identification, defining the character number of the head character string identification as a preset index character number;
judging whether a character exists behind the last character of the index character number;
if the characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC (cyclic redundancy check) verification code of the PNG structure picture data, and adding the number of the characters of the length code, the number of the characters of the data block type code, the number of the characters of the picture content data block and the number of the check characters of the CRC verification code to the index number of characters;
judging whether the index character number reaches a preset analysis completion threshold value or not;
and if the resolution completion threshold is reached, based on a PNGParser plug-in, performing resolution processing on the length code, the data block type code, the picture content data block and the CRC verification code to obtain picture decoding subdata.
Optionally, in a second implementation manner of the first aspect of the present invention, the parsing, by the pngpa plug-in, the length code, the data block type code, the picture content data block, and the CRC validation code to obtain the picture decoding sub-data includes:
identifying a preset npTc Chunk type code among the data block type codes;
and clearing the index character number, and performing extension processing on the picture content data block corresponding to the npTc Chunk type code according to a preset extension algorithm and the index character number to obtain picture decoding subdata.
Optionally, in a third implementation manner of the first aspect of the present invention, the drawing frame includes: the image fixed proportion area and the image zooming area, wherein the integral pixel placement processing is carried out in the drawing frame according to the image decoding data, and the point nine effect graph in the apple ecosystem is obtained, and the point nine effect graph comprises the following steps:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding subdata, wherein N is an integer;
scaling the picture decoding subdata corresponding to the image scaling area;
and writing the pixel data of the N zoomed picture decoding subdata into the drawing frame to obtain a dot-nine effect picture in the apple ecosystem.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the performing frame calculation processing on the picture decoding data, and calculating to generate a drawing frame includes:
reading the coordinate data of the content margin boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a transverse scaling region and a longitudinal scaling region on the image decoding data according to the coordinate data and the fixed region to generate a drawing frame.
Optionally, in a fifth implementation manner of the first aspect of the present invention, after the performing, according to the picture decoding data, an overall pixel placement process in the drawing frame to obtain a display effect of a point nine effect diagram in an apple ecosystem, the method further includes:
generating self-defining data by the drawing frame through inheriting an Image class of a system;
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 performing, by the BytesUtils-based component, size-end processing on the bytecode of the picture data, and obtaining bytecode parsing data includes:
based on the BytesUtils component, dividing byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
A second aspect of the present invention provides a method and an apparatus for generating a point nine effect graph, where the method and the apparatus for generating a point nine effect graph include:
the receiving module is used for receiving a point nine effect graph generating instruction and reading picture data corresponding to the point nine effect graph generating instruction;
the dividing module is used for carrying out byte code size end processing on the picture data based on the BytesUtils component to obtain byte code analysis data;
the parsing module is used for carrying out structuralization processing on the byte code parsing data based on a PNGParser component to obtain PNG structure picture data, and carrying out extended parsing 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 integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect picture of the picture data in the apple ecosystem.
The third aspect of the present invention provides a method and an apparatus for generating a point nine effect graph, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor calls the instructions in the memory to cause the point nine effect graph generation method device to execute the point nine effect graph generation method.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-described point nine effect map generating method.
In the embodiment of the invention, a data model of the parser is designed according to a PNG picture data structure; the parser can decode the binary data of the PNG file into a data model, and if a special segment structure exists, the data model can be flexibly expanded. Dividing the drawing work of the point nine graph into three parts, namely decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to analyze and convert the data of the point nine graph file into a picture object, and cache some preprocessing information for the drawing stage, and the two stages are only executed once. In the instant drawing stage, the point nine diagram is loaded by a predetermined container, and the container is drawn in real time by combining the actual size of the container. And packaging the dot-nine image rendering Framework into a Framework, wherein the Framework is adapted to AppKit frameworks of apple ecosystems such as macOS, iOS, iPadOS, watchOS, tvOS and the like, and developers can directly use the Framework.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a method for generating a dot-and-ninth effect graph in an embodiment of the present invention;
FIG. 2 is a diagram illustrating a PNG graph data structure according to the embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data structure of a data block in the method for generating a dot-and-ninth effect map according to the embodiment of the present invention;
FIG. 4 is a schematic diagram of a point nine-point diagram scaling frame of the point nine-effect diagram generation method in the embodiment of the present invention;
FIG. 5 is a schematic diagram of an embodiment of a nineteenth effect map generation apparatus in an embodiment of the present invention;
fig. 6 is a schematic diagram of another embodiment of a nineteenth effect map generation 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 device in the 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, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, 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, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a method for generating a nine-point effect diagram in the embodiment of the present invention includes the steps of:
101. receiving a point nine effect graph generation instruction, and reading picture data corresponding to the point nine effect graph generation instruction;
in the present embodiment, the nineteenth effect map generation instruction is activated in the apple ecosystem, and it is necessary to explain the difference between the common PNG map and the nineteenth map. As fig. 2 illustrates specific information of the PNG map, the structure of each PNG map has signature as the identifier of the PNG picture, Chunk is the entity Data of the PNG picture, Length in each Chunk Data has a Length of four bytes as the identifier of the Chunk Data definition Data Length, Chunk Type Code has a Length of four bytes as the Type of the Data block Type Code definition Data, Chunk Data is the actual Data of the PNG map, and CRC is 4 bytes of check Code for calibration. As fig. 3 illustrates specific information of the point nine map, actually, the point nine map differs from the PNG map in the Chunk Data, but only the Chunk Data on the Chunk Data is different, 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 generation process of the point nine graph in the apple ecosystem is actually completely different from that of the common PNG graph, and the generation mode on an android cannot be used.
102. Based on the BytesUtils component, carrying out byte code size end processing on the picture data to obtain byte code analysis data;
in this embodiment, the BytesUtils component is a byte processing tool, and is responsible for reading and intercepting a file byte stream, compatible work of a large end and a small end, local extraction and ordered arrangement of bytes, and the large end and the small end are processes of processing high bytes and low bytes by a computer, and the same process is used for processing the picture data. The treatment process has the following two modes:
big-end mode, meaning that the high bytes of data are stored in the low address of the memory and the low bytes of data are stored in the high address of the memory, is somewhat analogous to processing the data as a string sequence: the address is 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 means that the high byte of data is stored in the high address of the memory, and the low byte of data is stored in the low address of the memory, the storage mode effectively combines the high and low address and data bit weights, the weight of the high address part is high, and the weight of the low address part is low.
Further, at 102, the following steps may be performed:
1021. based on the BytesUtils component, dividing byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
In step 1021, the Bytes Utils component bases the picture data format on a PNG structure diagram by a long string of characters, and the head character string is the identified head character, which is the main identification for defining and classifying data in the process of reading data by a computer in the data recognition processing process. And dividing a head character string identifier and an entity Data block Chunk of the signature, wherein the Chunk has four parts of Length, Chunk Type Code, npTc Chunk Data and CRC in sequence, and has a plurality of chunks, and the Data structures in fig. 2 and fig. 3 can be referred to, which are formats defined by PNG pictures, and the ordered PNG byte Data is obtained after analysis.
103. Based on the PNGParser component, carrying out structuralization processing on the byte code analysis data to obtain PNG structure picture data, and carrying out extension analysis processing on the PNG structure picture data to obtain picture decoding data;
in this embodiment, the PNG Parser is a PNG file Parser, relying on Bytes Util to convert Bytes into PNG data structures. The PNG Parser comprises a registry, and a special Chunk section data structure can be registered for extended resolution by the resolver so as to be compatible with a special PNG data structure such as a dot nine diagram, and the whole dot nine diagram analysis work is completed by the PNG Parser.
Further, the following steps may be performed in the step of "performing extended parsing on the PNG structure picture data to obtain picture decoding data":
1031. judging whether the head character string identification of the PNG structure picture data is a preset PNG character string identification;
1032. if the identifier is a PNG character string identifier, defining the character number of the head character string identifier as a preset index character number;
1033 judging whether there is a character after the last character of the index character number;
1034. if the characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC (cyclic redundancy check) verification code of the PNG structure picture data, and adding the number of the characters of the length code, the number of the characters of the data block type code, the number of the characters of the picture content data block and the number of the check characters of the CRC verification code into the number of index characters;
1035. judging whether the number of the index characters reaches a preset analysis completion threshold value;
1036. and if the resolution completion threshold is reached, performing resolution 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 to obtain picture decoding subdata.
In step 1031-1036, it is first analyzed whether the head string is "89504 e470d0a1a0 a", and if it is determined to be the PNG string id, the structural picture data is continuously processed. And if the identifier is not the PNG character string identifier, the processing procedure is directly ended. When the PNG character string identification is determined, the index character number is determined to be 8, and then whether character strings exist after the PNG character string identification is further judged. And defining the head character string identification as a character numerical value for defining index calculation, and if the number of characters of the defined head character string is determined and characters exist after the last character sequence of the head character string identification, analyzing a length code, a data block type code, a picture content data block and a CRC verification code. And 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 codes are processed differently, and the character number of the verified picture content data block is added to the index character number after the CRC verification codes are analyzed. Whether the expansion of the Chunk Data is finished is judged by the numerical value of the index character number, if the expansion is finished, the PNG Parser plug-in is used for directly analyzing, and after 1036 is finished, the PNG Parser plug-in returns to 1033 for judging, wherein the multiple Chunk Data are mainly read and analyzed in a continuous and circulating mode.
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 subdata.
In the 10361 and 10362 steps, for the point nine graph, because a special chunck segment npTc Chunk structure is included, the processing is performed by implementing a chunck data extension parsing method in the PNG Parser, and if an npTc Chunk type code is identified, the index character number beginnindex is cleared. After beginnindex is 0, beginnindex +1 is executed, the set abscissa length X is read, and beginnindex +1 is executed. Reading the fixed ordinate length Y, and executing beginnindex ═ beginnindex + 1. The color array length is read, beginnindex +1 is executed, 8 bytes are skipped, and beginnindex +8 is executed. The left boundary length of the content is read, and beginnindex is executed as beginnindex + 4. The right margin length of the content is read, and beginnindex is executed as beginnindex + 4. Read the top boundary length and execute beginnindex ═ beginnindex + 4. The bottom border length is read and beginnindex +4 is executed. Skipping 4 bytes, execute beginnindex ═ beginnindex + 4. Defining a counter i, i is 0, judging whether i is smaller than the abscissa length X, if so, assigning a beginnindex to i, executing the beginnindex +4, judging whether i is smaller than the abscissa length X, and circulating until i is not smaller than the abscissa length X to execute the following steps. Defining a counter j, j being 0, judging whether j is smaller than the length Y of the ordinate, if so, assigning a beginnindex to j, executing the beginnindex being +4, judging whether j is smaller than the length Y of the ordinate, and circulating until j is not smaller than the length Y of the ordinate to execute the following steps. Defining a counter m, wherein m is 0, judging whether m is smaller than the length of the color array, if so, assigning a beginnindex to m, and if so, judging whether m is smaller than the length of the color array, and circulating until m is not smaller than the length of the color array, thus 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 point nine-point graph rendering framework at the iOS & macOS end, and the NinePatchKit is responsible for generating a nine-point graph object and providing a nine-point graph container, and can be quickly integrated into project engineering through the CocoaPods command line of the apple. As shown in fig. 4, the black lines on the left and top of the nine-point zoom frame respectively represent horizontal and vertical zoom areas, the zoom area may have multiple segments, and if there are multiple segments on the coordinate axis in the same direction, the zoom area in this direction has multiple segments, and the zoom area in this direction is proportional to the length of the line (for example, the vertical direction of the top diagram is marked with two vertical stretch areas, and the length of the two marked lines is 1:1, which represents that when the vertical direction needs to stretch or compress, the stretch or compress degree of the two areas is the same); the black lines on the right and the bottom represent horizontal and vertical content areas, respectively, and after the black line graphs are compiled, the information coordinates are put into the npTc Chunk segment to obtain a final dot-nine effect graph.
Further, the process executed at 104 may perform the following steps:
1041. taking the coordinate data of the content margin boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
1042. and marking a horizontal scaling region and a vertical scaling region on the image decoding data according to the coordinate data and the fixed region to generate a drawing frame.
In steps 1041 and 1042, we mainly describe the idea of a scalable region outside the margin boundary width and the fixed region, and refer to fig. 4 here. In fig. 4, besides that the four boundary areas required to display the content are fixed and non-zooming areas, the image area required to highlight the deformation is also a fixed area. It should be noted here that the deformed image may be not only in the middle but also at the edge, which varies according to the design process. But the fixed area and the area outside the boundary can be used as the zooming area, and then the zooming area is recorded by two similar projection angles of horizontal and vertical of the area record, so as to obtain the drawing frame. When calculating the horizontal fixed length, xList is a set of x-axis coordinates of the start and end points of the black line, and is arranged in the manner of x0 start end, x0 end, x1 start end, x1 end … xs start end, and xs end, and the horizontal fixed area is the length of the image not in xList, so the horizontal fixed area is the sum of all the lengths of the horizontal length-xList, and the method for calculating the vertical fixed length is the same as the method for calculating the horizontal fixed length.
105. And carrying out integral pixel placement processing in a drawing frame according to the picture decoding data to obtain a point nine effect picture of the picture data in the apple ecosystem.
In this embodiment, the drawing frame is directly filled 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, and in the display process, the effects of direct copying and whole scaling are realized.
Referring to fig. 4, the area whose edge is not zoomed is fixed as the original area, and the horizontal pull-up area and the vertical pull-up area whose center is shaded black are pulled up or zoomed according to the content according to the scale of the display screen, where the pull-up or zoom is a factor, for example, if the zoom scale is greater than 1, the pull-up is performed, and if the zoom scale is less than 1, the zoom is performed.
Further, the drawing frame includes: image fixed-scale region, image zoom region, step 105 may perform the following steps:
1051. based on a drawing frame, cutting the picture decoding data to obtain N picture decoding subdata, wherein N is an integer;
1052. scaling the picture decoding subdata corresponding to the image scaling area;
1053. and writing the pixel data of the N zoomed picture decoding subdata into a drawing frame to obtain a dot nine effect picture in the apple ecosystem.
In the 1051-1053 step, the frame is disassembled based on the structure of the frame, wherein the disassembling is determined according to the number of the frame segments. And respectively carrying out abscissa scaling and then ordinate scaling on the areas needing scaling in the frame, or carrying out ordinate scaling and then abscissa scaling to obtain a plurality of scaled image decryption subdata. The picture decryption subdata is an independent unit, and is 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 self-defining data for the drawing frame through inheriting the Image class of the system;
107. the picture decoded data is stored in the memory database.
In step 106 and 107, generating a custom class by inheriting the system Image class, and expanding the attribute therein, wherein the expanded attribute comprises: the attribute values of the successive class object are calculated and cached in the memory when the successive class object is generated according to the sub-image clipped by the surrounding black line mark.
After the point nine graph object is generated, a point nine graph path and a cache in a key-value form of the point nine graph object are established according to the point nine graph path, and the PNG Parse retrieval cache is directly skipped under the condition that the same address point nine graph is repeatedly read, so that the efficiency is higher.
In the embodiment of the invention, a data model of the parser is designed according to a PNG picture data structure; the parser can decode the binary data of the PNG file into a data model, and if a special segment structure exists, the data model can be flexibly expanded. Dividing the drawing work of the point nine graph into three parts, namely decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to analyze and convert the data of the point nine graph file into a picture object, and cache some preprocessing information for the drawing stage, and the two stages are only executed once. In the instant drawing stage, the point nine diagram is loaded by a predetermined container, and the container is drawn in real time by combining the actual size of the container. And packaging the dot-nine image rendering Framework into a Framework, wherein the Framework is adapted to AppKit frameworks of apple ecosystems such as macOS, iOS, iPadOS, watchOS, tvOS and the like, and developers can directly use the Framework.
The above description describes a method for generating a nineteenth effect diagram in an embodiment of the present invention, and a device for generating a nineteenth effect diagram in an embodiment of the present invention is described below with reference to fig. 5, where an embodiment of the device for generating a nineteenth effect diagram in an embodiment of the present invention includes:
a receiving module 501, configured to receive a point nine effect graph generating instruction, and read picture data corresponding to the point nine effect graph generating instruction;
a dividing module 502, configured to perform byte code size end processing on the picture data based on the BytesUtils component to obtain byte code analysis data;
the parsing module 503 is configured to perform structuring processing on the bytecode parsed data based on the pngpa arser component to obtain PNG structure picture data, and perform extended parsing processing on the PNG structure picture data to obtain picture decoding data;
a frame calculation module 504, configured to perform frame calculation processing on the picture decoding data, and calculate to generate a drawing frame;
and a pixel placement module 505, configured to perform, according to the picture decoding data, whole pixel placement processing in the drawing frame to obtain a dot-nine effect graph of the picture data in the apple ecosystem.
In the embodiment of the invention, a data model of the parser is designed according to a PNG picture data structure; the parser can decode the binary data of the PNG file into a data model, and if a special segment structure exists, the data model can be flexibly expanded. Dividing the drawing work of the point nine graph into three parts, namely decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to analyze and convert the data of the point nine graph file into a picture object, and cache some preprocessing information for the drawing stage, and the two stages are only executed once. In the instant drawing stage, the point nine diagram is loaded by a predetermined container, and the container is drawn in real time by combining the actual size of the container. And packaging the point nine diagram rendering Framework into a Framework, wherein the Framework is adapted to UIkit of the iOS and Appkit Framework of the macOS, and the iOS and the macOS developers can directly use the Framework.
Referring to fig. 6, in another embodiment of a method and an apparatus for generating a dot-nine effect map according to the embodiment of the present invention, the method and the apparatus for generating a dot-nine effect map include:
a receiving module 501, configured to receive a point nine effect graph generating instruction, and read picture data corresponding to the point nine effect graph generating instruction;
a dividing module 502, configured to perform byte code size end processing on the picture data based on the BytesUtils component to obtain byte code analysis data;
the parsing module 503 is configured to perform structuring processing on the bytecode parsed data based on the pngpa arser component to obtain PNG structure picture data, and perform extended parsing processing on the PNG structure picture data to obtain picture decoding data;
a frame calculation module 504, configured to perform frame calculation processing on the picture decoding data, and calculate to generate a drawing frame;
and a pixel placement module 505, configured to perform, according to the picture decoding data, whole pixel placement processing in the drawing frame to obtain a dot-nine effect graph of the picture data in the apple ecosystem. Wherein the dividing module 502 is specifically configured to:
based on the BytesUtils component, dividing 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 identification judgment unit 5031, configured to judge whether a header character string identifier of the PNG structure picture data is a preset PNG character string identifier;
a loop judgment unit 5032, configured to define the number of characters of the head string identifier as a preset index number if the head string identifier is a PNG string identifier
A character existence judging unit 5033 configured to judge whether a character exists after a 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 is a character, 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 number of index characters;
an execution determining unit 5035, configured to determine whether the number of index characters reaches a preset parsing completion threshold;
a decoding unit 5036, configured to, based on the pngpa inserter, perform parsing on the length code, the data block type code, the picture content data block, and the CRC validation code to obtain picture decoding sub-data if the parsing completion threshold is reached.
The decoding unit 5036 is specifically configured to:
identifying a preset npTc Chunk type code among the data block type codes;
and clearing the index character number, and performing extension processing on the picture content data block corresponding to the npTc Chunk type code according to a preset extension algorithm and the index character number to obtain picture decoding subdata.
Wherein the framework calculation module 504 is specifically configured to:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding subdata, wherein N is an integer;
scaling the picture decoding subdata corresponding to the image scaling area;
and writing the pixel data of the N zoomed picture decoding subdata into the drawing frame to obtain a dot-nine effect picture in the apple ecosystem.
Wherein the framework calculation module 504 is specifically configured to:
reading the coordinate data of the content margin boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a transverse scaling region and a longitudinal scaling region on the image decoding data according to the coordinate data and the fixed region to generate a drawing frame.
The method and apparatus for generating a point-nine effect graph further include a storage module 506, where the storage module 506 is specifically configured to:
generating self-defining data by the drawing frame through inheriting an Image class of a system;
storing the picture decoding data in an in-memory database.
In the embodiment of the invention, a data model of the parser is designed according to a PNG picture data structure; the parser can decode the binary data of the PNG file into a data model, and if a special segment structure exists, the data model can be flexibly expanded. Dividing the drawing work of the point nine graph into three parts, namely decoding, preprocessing and instant drawing; the decoding and preprocessing stage is to analyze and convert the data of the point nine graph file into a picture object, and cache some preprocessing information for the drawing stage, and the two stages are only executed once. In the instant drawing stage, the point nine diagram is loaded by a predetermined container, and the container is drawn in real time by combining the actual size of the container. And packaging the point nine diagram rendering Framework into a Framework, wherein the Framework is adapted to UIkit of the iOS and Appkit Framework of the macOS, and the iOS and the macOS developers can directly use the Framework.
Fig. 5 and fig. 6 describe the apparatus for generating a point nine effect diagram in the embodiment of the present invention in detail from the perspective of a modular functional entity, and the apparatus for generating a point nine effect diagram in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 7 is a schematic structural diagram of a nine-point effect diagram generation method apparatus 700 according to an embodiment of the present invention, where the nine-point effect diagram generation method apparatus 700 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 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 an application 733 or data 732. Memory 720 and storage medium 730 may be, among other things, transient storage or persistent storage. The program stored in the storage medium 730 may include one or more modules (not shown), and each module may include a series of instruction operations in the point nine effect diagram generation method apparatus 700. Still further, processor 710 may be configured to communicate with storage medium 730 to execute a series of instruction operations in storage medium 730 on point nine effect map generation method device 700.
The 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. Those skilled in the art will appreciate that the configuration of the point nine effect diagram generation method apparatus illustrated in fig. 7 does not constitute a limitation of the point nine effect diagram generation method apparatus, and may include more or less components than those illustrated, or some components may be combined, or a different arrangement of components may be used.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the point-nine effect map generation method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for generating a point nine effect picture is applied to an apple ecosystem, and comprises the following steps:
receiving a point nine effect graph generating instruction, and reading picture data corresponding to the point nine effect graph generating instruction;
based on the BytesUtils component, carrying out byte code size end processing on the picture data to obtain byte code analysis data;
based on a PNGParser component, carrying out structuralization processing on the byte code analysis data to obtain PNG structure picture data, and carrying out extension 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 integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect picture of the picture data in the apple ecosystem.
2. The method of claim 1, wherein the performing extended parsing on the PNG structure picture data to obtain picture decoding data comprises:
judging whether the head character string identification of the PNG structure picture data is a preset PNG character string identification;
if the head character string is the PNG character string identification, defining the character number of the head character string identification as a preset index character number;
judging whether a character exists behind the last character of the index character number;
if the characters exist, sequentially reading a length code, a data block type code, a picture content data block and a CRC (cyclic redundancy check) verification code of the PNG structure picture data, and adding the number of the characters of the length code, the number of the characters of the data block type code, the number of the characters of the picture content data block and the number of the check characters of the CRC verification code to the index number of characters;
judging whether the index character number reaches a preset analysis completion threshold value or not;
and if the resolution completion threshold is reached, based on a PNGParser plug-in, performing resolution processing on the length code, the data block type code, the picture content data block and the CRC verification code to obtain picture decoding subdata.
3. The method for generating a point-nine effect graph according to claim 2, wherein the parsing the length code, the data block type code, the picture content data block, and the CRC validation code based on a pngpa arser plug-in to obtain the picture decoding sub-data includes:
identifying a preset npTc Chunk type code among the data block type codes;
and clearing the index character number, and performing extension processing on the picture content data block corresponding to the npTc Chunk type code according to a preset extension algorithm and the index character number to obtain picture decoding subdata.
4. The point nine effect map generation method according to claim 1, wherein the drawing frame includes: the image fixed proportion area and the image zooming area, wherein the integral pixel placement processing is carried out in the drawing frame according to the picture decoding data, and the point nine effect graph of the picture data in the apple ecosystem is obtained by the image zooming area, and the image zooming area comprises the following steps:
based on the drawing frame, cutting the picture decoding data to obtain N picture decoding subdata, wherein N is an integer;
scaling the picture decoding subdata corresponding to the image scaling area;
writing the scaled pixel data of the N picture decoding subdata into the drawing frame to obtain the point nine effect diagram of the picture data in the apple ecosystem.
5. The method according to claim 1, wherein the performing frame calculation processing on the picture decoding data to calculate and generate a drawing frame includes:
reading the coordinate data of the content margin boundary in the picture decoding data, and reading a preset fixed area in the picture decoding data;
and marking a transverse scaling region and a longitudinal scaling region on the image decoding data according to the coordinate data and the fixed region to generate a drawing frame.
6. The method of claim 1, wherein after performing an overall pixel placement process 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, the method further comprises:
generating self-defining data by the drawing frame through inheriting an Image class of a system;
storing the picture decoding data in an in-memory database.
7. The method of claim 1, wherein the BytesUtils-based component performs byte-code-size-side processing on the picture data, and obtaining byte-code parsing data comprises:
based on the BytesUtils component, dividing byte data of the picture data into a header character string identifier and an entity data block to obtain byte code analysis data.
8. A point nine effect graph generating device is characterized in that the point nine effect graph generating method device comprises the following steps:
the receiving module is used for receiving a point nine effect graph generating instruction and reading picture data corresponding to the point nine effect graph generating instruction;
the dividing module is used for carrying out byte code size end processing on the picture data based on the BytesUtils component to obtain byte code analysis data;
the parsing module is used for carrying out structuralization processing on the byte code parsing data based on a PNGParser component to obtain PNG structure picture data, and carrying out extended parsing 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 integral pixel placement processing in the drawing frame according to the picture decoding data to obtain a point nine effect picture of the picture data in the apple ecosystem.
9. A point nine effect graph generating device is characterized in that the point nine effect graph generating method comprises the following steps: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor calls the instructions in the memory to cause the point nine effect graph generation method device to perform the point nine effect graph generation method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the point nine effect graph generating method according to any one of claims 1 to 7.
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 true CN114398125A (en) 2022-04-26
CN114398125B 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 (5)

* 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
US20210064747A1 (en) * 2019-08-27 2021-03-04 Trend Micro Incorporated Classification of executable files using a digest of a call graph pattern
CN113096217A (en) * 2021-03-25 2021-07-09 北京达佳互联信息技术有限公司 Picture generation method and device, electronic equipment and storage medium

Patent Citations (5)

* 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
US20210064747A1 (en) * 2019-08-27 2021-03-04 Trend Micro Incorporated Classification of executable files using a digest of a call graph pattern
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
CN114398125B (en) 2024-02-27

Similar Documents

Publication Publication Date Title
US9471550B2 (en) Method and apparatus for document conversion with font metrics adjustment for format compatibility
US6801673B2 (en) Section extraction tool for PDF documents
CN110879937A (en) Method and device for generating webpage from document, computer equipment and storage medium
US8782617B2 (en) Apparatus and method for translating open vector graphic application program interface
KR20150079867A (en) Html5-protocol-based webpage presentation method and device
CN108399172B (en) Vector diagram generation method and device
US10699751B1 (en) Method, system and device for fitting target object in video frame
JP7165272B2 (en) Video data encoding/decoding method, device, program and computer device
CN105513115B (en) Method and device for converting SWF into Canvas animation
CN111159594A (en) Information processing method, information processing device and terminal equipment
US9747385B2 (en) Compression of cascading style sheet files
CN110163866A (en) A kind of image processing method, electronic equipment and computer readable storage medium
CN109389659A (en) The rendering method of mathematical formulae, device, storage medium and terminal device in PPT
CN109658485B (en) Webpage animation drawing method, device, computer equipment and storage medium
CN111741329B (en) Video processing method, device, equipment and storage medium
CN111949312B (en) Packaging method and device for data module, computer equipment and storage medium
CN112328298A (en) Code library cutting method and device for mobile terminal
CN107193815B (en) Page code processing method, device and equipment
US8656371B2 (en) System and method of report representation
US20100077298A1 (en) Multi-platform presentation system
CN114398125A (en) Point nine effect graph generation method and related device thereof
EP3709666A1 (en) Method for fitting target object in video frame, system, 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
CN114398124A (en) Point nine-effect graph rendering method based on iOS system and related device thereof

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