Character filtering processing method, system, electronic device and storage medium
By cutting resources into image blocks and building character filter components, the problem of inefficiency of traditional character filters is solved, and efficient character filtering processing for resources in different formats is achieved.
Patent Information
- Application Number
- CN202011117974.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-19
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2040-10-19
AI Technical Summary
Traditional character filters are inefficient, cannot perform batch character filtering on resources of different formats, and fixed formats limit their application scope.
By cutting the resource to be filtered into an image block and building a character filter component, multiple character filters are used to batch filter the image blocks, and each character filter filters one character, improving the character filtering efficiency.
It realizes batch character filtering processing for resources in different formats, improves character filtering efficiency, and is suitable for various resources such as pictures and videos.
Smart Images

Figure CN114445819B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of character processing, and in particular to a character filtering processing method, system, electronic device and storage medium. Background Art
[0002] Character filtering is the basis for many image, video, and file processing, and even the basis for sending barrages. Many displays of character pixels require character filtering. Character filtering can achieve a variety of effects such as more text, video, audio files, etc.
[0003] Character filtering is usually done using character filters. Traditional character filters rely on third parties and are a black box operation. They can only filter one character at a time, which is inefficient. Once the program in the black box is fixed, character filtering can only be performed on resources in a specific format. Summary of the invention
[0004] The embodiments of the present application provide a character filtering processing method, system, electronic device and storage medium for performing batch character filtering processing on resources of different formats to improve character filtering efficiency.
[0005] A first aspect of an embodiment of the present application provides a character filtering processing method, comprising:
[0006] Cut the resources to be filtered and processed to obtain each image block after cutting;
[0007] Constructing a character filter component, and defining a plurality of character filters included in the character filter component;
[0008] The image blocks are subjected to batch filtering processing by the character filter component, wherein each character filter can perform filtering processing on one character.
[0009] In a possible embodiment, the resource to be filtered is cut to obtain each image block after cutting, including: setting the area size of each image block; and cutting the resource to be filtered into multiple image blocks of equal size according to the set area size of each image block.
[0010] In a possible embodiment, setting the area size of each image block includes: setting a variable to define a width value, the width value is a floating point type, wherein the height value is the same as the width value, constituting the area size of the image block; cutting the resource to be filtered into multiple image blocks of equal size according to the set area size of each image block includes: obtaining the coordinate value of each pixel point of the resource to be filtered; obtaining the texture two-dimensional coordinate value of each image block after cutting according to the coordinate value and width value of each pixel point, wherein the texture two-dimensional coordinate value represents the corresponding image block, wherein one image block is one character.
[0011] In a possible embodiment, the method further includes: for each image block, obtaining the coordinates of the central pixel point of the image block; obtaining the brightness value of the central pixel point of the image block, and using the brightness value of the central pixel point of the image block area as the brightness value of the image block.
[0012] In a possible embodiment, the constructing of the character filter component and the defining of the multiple character filters contained in the character filter component include: constructing the character filter component using the CharFilterGroup class, and constructing each character filter in the character filter component using the CharFilter class.
[0013] In a possible embodiment, each of the character filters filters each character in the following manner: defining an initialization init method in the CharFilter class, creating a synchronous processing queue SynchronousQueue in the initialization init method; performing filtering processing on the characters in the synchronous processing queue SynchronousQueue: wherein, performing filtering processing on the characters in the synchronous processing queue SynchronousQueue includes: obtaining a relevant folder through the NSBundle mainBundle method, wherein the relevant folder stores character textures, using the pathForResource method to load the character texture, and obtaining the character texture path textPath; using the textLoader function to call the txtWithContentsOfFile function to load the character texture data according to the character texture path; calling the render function to render the loaded character texture data, wherein the texture two-dimensional coordinates of the character are passed into the render function.
[0014] In a possible embodiment, calling the render function to render the loaded character texture data includes: determining the display variable of the character texture, and if the display variable is yes, setting the filter property of the character texture; calling the buffForSize method to obtain the cache of the character texture, calling the color cleaning function clearColor, passing the RGBA channel data of the character texture data to the color cleaning function clearColor, and completing the cleaning of the character texture data; calling the bgCear function to clean the background.
[0015] In a possible embodiment, the method of constructing a character filter component using the CharFilterGroup class and constructing each character filter in the character filter component using the CharFilter class includes: creating an initialization init method in the CharFilterGroup class, calling the super init method in the initialization init method to obtain the character filter CharFilter; calling the memory allocation function alloc of CharFilter, and then calling the init method to initialize the character filter, and creating a string filter charImgFilter; using the addFil function to add each created string filter charImgFilter to the current CharFilterGroup class; after the addition is completed, using initialFilters to initialize the string filter, packaging the string filter charImgFilter into an array, and putting it into the initialFilters function to complete the construction of the character filter component.
[0016] The second aspect of the present application provides a character filtering processing system, comprising:
[0017] A cutting module, used for cutting the resources to be filtered and processed to obtain each image block after cutting;
[0018] A construction module, used for constructing a character filter component and defining a plurality of character filters included in the character filter component;
[0019] The filtering module is used to perform batch filtering processing on the image blocks through the character filter component, wherein each character filter can filter a character.
[0020] A third aspect of the present application provides an electronic device, including a memory and a processor, wherein the processor is used to implement the steps of any one of the character filtering processing methods described above when executing a computer management program stored in the memory.
[0021] A fourth aspect of the present application provides a computer-readable storage medium on which a computer management program is stored. When the computer management program is executed by a processor, the steps of the character filtering processing method as described in any one of the above are implemented.
[0022] It can be seen from the above technical scheme that the embodiments of the present application have the following advantages: cutting the resources to be filtered and processing to obtain each image block after cutting; constructing a character filter component, and defining multiple character filters contained in the character filter component; batch filtering the image blocks through the character filter component, wherein each character filter can filter a character. For different resources, such as pictures, videos, GIF images, etc., the embodiments of the present application cut them into image blocks, filter the resources with image blocks as units, and use the character filter component to batch filter the characters, thereby improving the efficiency of character filtering. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flowchart of a possible character filtering processing method provided in an embodiment of the present application;
[0024] Figure 2 A structural diagram of a possible character filtering processing system provided in an embodiment of the present application;
[0025] Figure 3 A schematic diagram of a possible hardware structure of an electronic device provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the hardware structure of a possible computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application provide a method and a related device for displaying a view object, which are used to make the display of the view object more flexible and automatic.
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0029] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] See also Figure 1 , is a flow chart of a character filtering processing method provided in an embodiment of the present application, specifically comprising:
[0031] 101. Cut the resource to be filtered and obtain each image block after cutting.
[0032] It is understandable that in the traditional technical solution, character filtering of resources can only process characters for a specific resource, and in the character filtering process, only a single character can be processed, and the processing efficiency is relatively slow. Based on this, the embodiment of the present application provides a character filtering processing method that can quickly filter and process various different resources in batches.
[0033] For resources to be filtered in different formats, such as pictures, videos, gif pictures and other resources in different formats, the resources to be filtered are cut into multiple image blocks. The unit of subsequent filtering is the image block, and an image block can also be called a character. Cutting resources of various formats into image block units and performing character filtering on the image blocks can achieve character filtering processing of different resources.
[0034] 102. Construct a character filter component, and define multiple character filters included in the character filter component.
[0035] It is understandable that when filtering the resources to be filtered, a character filter component is defined, wherein a character filter component includes multiple character filters. In the embodiment of the present application, the character filter component is constructed using the CharFilterGroup class, and each character filter in the character filter component is constructed using the CharFilter class.
[0036] A character filter can filter one character, so each character filter component can filter each character at a time, thereby improving the efficiency of character filtering.
[0037] 103. Perform batch filtering processing on the image blocks through the character filter component, wherein each character filter can filter one character.
[0038] It is understandable that the character filter component includes multiple character filters, and one character filter can filter and process one character. Therefore, the character filter component can be used to perform batch filtering on multiple image blocks, thereby improving the efficiency of processing various resource characters.
[0039] In a possible implementation manner, the resource to be filtered is cut to obtain each image block after cutting, including: setting the area size of each image block; and cutting the resource to be filtered into multiple image blocks of equal size according to the set area size of each image block.
[0040] It is understandable that, for the resources to be filtered, the resources to be filtered can be cut into different small image blocks. The sizes of the cut image blocks can be the same or different. The embodiment of the present application cuts the resources to be filtered into image blocks of the same size. A variable can be set, and a width value can be defined in the variable. The width value is set to a floating point number width=10, and the height value is set to be the same as the width value. The width value and the height value are used as an area to cut the resources to be filtered, and each image block is formed after cutting, wherein an image block after cutting is a character, and the resources to be filtered are subsequently filtered in units of characters.
[0041] In a possible implementation manner, according to the set area size of each image block, the resource to be filtered is cut into multiple image blocks of equal size, including: obtaining the coordinate value of each pixel point of the resource to be filtered; according to the coordinate value and width value of each pixel point, obtaining the texture two-dimensional coordinate value of each image block after cutting, the texture two-dimensional coordinate value represents the corresponding image block, wherein one image block is one character.
[0042] It can be understood that the coordinate value of each pixel point of the resource to be filtered is first obtained, and then the texture two-dimensional coordinate value of each image block is obtained through the mod function. Among them, the mod function is mod: (CGPoint) coordinate, mod is the name of the function, the CGPoint function parameter coordinate type, and coordinate is the coordinate value of each pixel point in the image block.
[0043] By inputting the coordinate value of each pixel point into the mod function, you can get the texture two-dimensional coordinate value of each image block. The texture two-dimensional coordinate value represents the position of the image block in the resource to be filtered, that is, cutting the image block out from the resource to be filtered, thus completing the cutting process of the resource to be filtered.
[0044] In a possible implementation, the method further includes: for each image block, obtaining the coordinates of a central pixel of the image block; obtaining a brightness value of the central pixel of the image block, and using the brightness value of the central pixel of the image block area as the brightness value of the image block.
[0045] It can be understood that for the image blocks cut by the mod function, that is, the characters, for each image block area, the texture method is used to obtain the coordinates of the center pixel point midCo of the image block area, and the text2 method is used to obtain the brightness value of the center pixel point, and the brightness value of the center pixel point of the image block area is used as the brightness value of the entire image block. Among them, the texture and text2 methods are both functional functions, the texture function is to obtain the coordinates of the center pixel point, and the text2 function is to obtain the brightness value of the center pixel point.
[0046] texture:(CGPoint)coordinate, textture is the function name, the type of CGPoint function parameter, coordinate is the function parameter; text2(CGPoint)coordinate, text2 is the function name, the type of CGPoint function parameter, coordinate is the function parameter.
[0047] Among them, the mod function is used to complete the cutting of the image block of the resource to be filtered and processed, the texture method is used to obtain the coordinates of the central pixel point of each image block, and the text2 method is used to obtain the brightness value of the central pixel point. In the embodiment of this application, only the function method needs to be written and the corresponding parameters are input into the written function method to output the target value. There is no need to care about various processes, only the parameters need to be output into the function method, which reduces the professional requirements for operators and is more universal.
[0048] In a possible implementation, each character filter performs filtering processing on each character in the following manner: defining an initialization init method in the CharFilter class, creating a synchronous processing queue SynchronousQueue in the initialization init method; and performing filtering processing on the characters in the synchronous processing queue SynchronousQueue.
[0049] The filtering process of characters in the synchronous processing queue SynchronousQueue includes: obtaining the relevant folder through the NSBundle mainBundle method, storing the character texture in the relevant folder, using the pathForResource method to load the character texture, and obtaining the character texture path textPath; using the textLoader function to call the txtWithContentsOfFile function to load the character texture data according to the character texture path; calling the render function to render the loaded character texture data, wherein the texture two-dimensional coordinates of the character are passed into the render function. The render function is render:(CGPoint)coordinate, render is the function name, mainly realizing the rendering of the character texture data, CGPoint is the type of the function parameter, and coordinate is the function parameter.
[0050] It can be understood that the process of designing a character filter is to design a class CharFilter, which has an initialization init method. In this initialization method, a synchronous processing queue SynchronousQueue is created. Subsequent initialization operations are performed in this synchronous processing queue. The steps for performing character filtering processing in this synchronous processing queue are as follows:
[0051] Get the relevant folder of the application through the NSBundle mainBundle method. The relevant folder stores the character texture, that is, the above-mentioned image blocks. After getting the relevant folder, you can use the pathForResource method to load the character texture. After loading the character texture, you can get the path textPath of the character texture. If this textPath exists, use the textLoader function to call the txtWithContentsOfFile function to load the character texture data, that is, the specific content of the character texture.
[0052] The rendering of character texture data will call the render function, which has one parameter, which is the texture two-dimensional coordinate value. Calling the render function can render the character texture data, that is, filter the characters.
[0053] In a possible implementation, calling the render function to render the loaded character texture data includes: determining the display variable of the character texture, if the display variable is yes, setting the filter property of the character texture; calling the buffForSize method to obtain the cache of the character texture, calling the color cleaning function clearColor, passing the RGBA channel data of the character texture data to the color cleaning function clearColor, and completing the cleaning of the character texture data; calling the bgCear function to clean the background.
[0054] It can be understood that the internal implementation process of the rend function is as follows: first, the display variable of the texture is determined. If the value of this display variable is YES, then the character texture is obtained and the filter attribute of the character texture is set.
[0055] Create a cache, call the buffForSize method to get the cache frameBuff of the character texture, and after getting the cache frameBuff, call the lock function to lock the frameBuff. Call the color cleaning function clearColor, which needs to pass in multiple parameters. The multiple parameters are the RGBA channels corresponding to the character texture, namely red, green, color, and transparent channels. After completing the channel cleaning, the background needs to be cleaned. The function for cleaning the background is the bgCear function. The parameter passed in is the background bitmap information, and then the cache frameBuff of the character texture is unlocked. Among them, the clearColor function is clearColor:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha, red is the red channel data, green is the green channel data, blue is the blue channel data, and alpha is the transparent channel data.
[0056] The embodiment of the present application constructs a character filter through the above steps. The character filter can effectively filter and process characters and can process color channels. Character filtering will be performed every time a resource is displayed. The character processing in this step can load resources in various formats, such as pictures, videos, or GIF animations, etc. It only needs to cut the resources into image blocks, and then filter each image block, that is, the character, in units of image blocks.
[0057] In a possible implementation, a character filter component is constructed using the CharFilterGroup class, and the character filter component includes multiple character filters, including: creating an initialization init method in the CharFilterGroup class, calling the super init method in the initialization init method to obtain the character filter CharFilter; calling the memory allocation function alloc of CharFilter, and then calling the init method to initialize the character filter, and creating a string filter charImgFilter; using the addFil function to add each created string filter charImgFilter to the current CharFilterGroup class; after adding, using initialFilters to initialize the string filter, packaging the string filter charImgFilter into an array, and putting it into the initialFilters function to complete the construction of the character filter component.
[0058] It is understandable that to construct a character filter component charFilterGroup, this character filter component needs an initialization method init. In this initialization init method, the super init method needs to be called. By calling the super init method, the character filter CharFilter is obtained, and the memory allocation function alloc of CharFilter is called to allocate memory for each character filter CharFilter. Then the init method is called to initialize the character filter, thus creating a string filter charImgFilter. The addFil function is used to add each string filter charImgFilter to the current character filter component charFilterGroup class, thus completing the addition of the string filter charImgFilter. After adding, each string filter needs to be initialized. The initialization function is initialFilters. The string filter charImgFilter is packaged into an array and put into the initialFilters function to complete the construction of the character filter component.
[0059] Among them, a string filter can filter one character, and a character filter component includes multiple string filters. Then a character filter component can filter multiple characters at the same time, which can realize batch filtering of characters and improve the efficiency of character filtering.
[0060] Finally, the character filter component is used to perform batch filtering on the characters. The specific process is to first load the resources that need to be processed. The file or video is loaded through the imageNamed method. After loading, a UIImage type resource can be obtained.
[0061] Create a GPUPicture class, use the GPUPicture class to call the memory allocation method alloc to allocate memory for resources, and then call the initialization init method to initialize the object. In this way, a character filter component filterG is constructed, and a character filter is added to the character filter component filterG. The character filtering can be completed by calling the processmage method of the character filter component. With the character filtering, other processing can be performed, and the characters can be further assembled and processed to achieve other effects.
[0062] The embodiment of the present application constructs a character filter component, and constructs multiple character filters in the character filter component. One character filter can filter one character, so one character filter component can filter multiple characters in batches, thereby improving the efficiency of character filtering.
[0063] The above describes the embodiment of the present application from the perspective of the character filtering processing method, and the following describes the embodiment of the present application from the perspective of the character filtering processing system.
[0064] See also Figure 2 , Figure 2 A schematic diagram of an embodiment of a character filtering processing system provided in an embodiment of the present application, wherein the system specifically includes:
[0065] A cutting module 201 is used to cut the resources to be filtered and processed to obtain each image block after cutting;
[0066] A construction module 202, used to construct a character filter component and define a plurality of character filters included in the character filter component;
[0067] The filtering module 203 is used to perform batch filtering processing on the image blocks through the character filter component, wherein each character filter can filter a character.
[0068] See also Figure 3 , Figure 3 A schematic diagram of an embodiment of an electronic device provided in an embodiment of the present application.
[0069] like Figure 3As shown, an embodiment of the present application provides an electronic device, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following steps are implemented: cutting the resources to be filtered and processing to obtain each image block after cutting; constructing a character filter component, and defining multiple character filters included in the character filter component; and batch filtering the image blocks through the character filter component, wherein each character filter can filter a character.
[0070] Optionally, in a possible embodiment, the processor 320 is specifically used to: set the area size of each image block; and cut the resource to be filtered into multiple image blocks of equal size according to the set area size of each image block.
[0071] Optionally, in a possible embodiment, the processor 320 is specifically used to: set a variable to define a width value, the width value is a floating point type, wherein the height value is the same as the width value, and constitutes the area size of the image block; and is also used to obtain the coordinate value of each pixel point of the resource to be filtered; according to the coordinate value and width value of each pixel point, obtain the texture two-dimensional coordinate value of each image block after cutting, the texture two-dimensional coordinate value represents the corresponding image block, wherein one image block is one character.
[0072] Optionally, in a possible embodiment, the processor 320 is specifically used to: for each image block, obtain the coordinates of the central pixel point of the image block; obtain the brightness value of the central pixel point of the image block, and use the brightness value of the central pixel point of the image block area as the brightness value of the image block.
[0073] Optionally, in a possible embodiment, the processor 320 is specifically configured to: construct a character filter component using the CharFilterGroup class, and construct each character filter in the character filter component using the CharFilter class.
[0074] Optionally, in a possible embodiment, the processor 320 is specifically used to: define an initialization init method in the CharFilter class, create a synchronous processing queue SynchronousQueue in the initialization init method; perform filtering processing on characters in the synchronous processing queue SynchronousQueue;
[0075] The filtering process of characters in the synchronous processing queue SynchronousQueue includes: obtaining a related folder through the NSBundle mainBundle method, in which the character texture is stored, and loading the character texture using the pathForResource method to obtain the character texture path textPath;
[0076] Use the textLoader function to call the txtWithContentsOfFile function to load the character texture data according to the character texture path; call the render function to render the loaded character texture data, wherein the texture two-dimensional coordinates of the character are passed into the render function.
[0077] Optionally, in a possible embodiment, the processor 320 is specifically used to: determine the display variable of the character texture, if the display variable is yes, set the filtering property of the character texture; call the buffForSize method to obtain the cache of the character texture, call the color cleaning function clearColor, pass the RGBA channel data of the character texture data to the color cleaning function clearColor, and complete the cleaning of the character texture data; call the bgCear function to clean the background.
[0078] In a possible embodiment, the processor 320 is specifically used to: create an initialization init method in the CharFilterGroup class, call the super init method in the initialization init method to obtain the character filter CharFilter; call the memory allocation function alloc of CharFilter, and then call the init method to initialize the character filter, and create a string filter charImgFilter; use the addFil function to add each created string filter charImgFilter to the current CharFilterGroup class; after adding, use initialFilters to initialize the string filter, package the string filter charImgFilter into an array, and put it into the initialFilters function to complete the construction of the character filter component.
[0079] See also Figure 4 , Figure 4 A schematic diagram of an embodiment of a computer-readable storage medium provided in an embodiment of the present application.
[0080] like Figure 4As shown, this embodiment provides a computer-readable storage medium 400 on which a computer program 411 is stored. When the computer program 411 is executed by a processor, the following steps are implemented: cutting the resources to be filtered to obtain each image block after cutting; constructing a character filter component, and defining multiple character filters included in the character filter component; batch filtering the image blocks through the character filter component, wherein each character filter can filter one character.
[0081] Optionally, in a possible embodiment, the computer program 411 is specifically used to implement the following steps when executed by a processor: setting the area size of each image block; and cutting the resource to be filtered into multiple image blocks of equal size according to the set area size of each image block.
[0082] Optionally, in a possible embodiment, the computer program 411 is also used to implement the following steps when executed by the processor: setting a variable to define a width value, wherein the width value is a floating point type, wherein the height value is the same as the width value, and constitutes the area size of the image block; according to the set area size of each image block, cutting the resource to be filtered into multiple image blocks of equal size, including: obtaining the coordinate value of each pixel point of the resource to be filtered; obtaining the texture two-dimensional coordinate value of each image block after cutting according to the coordinate value and width value of each pixel point, wherein the texture two-dimensional coordinate value represents the corresponding image block, wherein one image block is one character.
[0083] Optionally, in a possible embodiment, the computer program 411 is specifically used to implement the following steps when executed by a processor: for each image block, obtain the coordinates of the central pixel point of the image block; obtain the brightness value of the central pixel point of the image block, and use the brightness value of the central pixel point of the image block area as the brightness value of the image block.
[0084] Optionally, in a possible embodiment, when the computer program 411 is executed by a processor, it is specifically used to implement the following steps: construct a character filter component using the CharFilterGroup class, and construct each character filter in the character filter component using the CharFilter class.
[0085] Optionally, in a possible embodiment, the computer program 411 is specifically used to implement the following steps when executed by the processor: define an initialization init method in the class CharFilter, and create a synchronous processing queue SynchronousQueue in the initialization init method; perform filtering processing on characters in the synchronous processing queue SynchronousQueue: wherein, the filtering processing on characters in the synchronous processing queue SynchronousQueue includes: obtaining a relevant folder through the NSBundle mainBundle method, wherein the relevant folder stores character textures, and uses the pathForResource method to load the character texture to obtain the character texture path textPath; uses the textLoader function to call the txtWithContentsOfFile function to load the character texture data according to the character texture path; and calls the render function to render the loaded character texture data, wherein the texture two-dimensional coordinates of the character are passed into the render function.
[0086] Optionally, in a possible embodiment, the computer program 411 is specifically used to implement the following steps when executed by the processor: determine the display variable of the character texture, and if the display variable is yes, set the filter property of the character texture; call the buffForSize method to obtain the cache of the character texture, call the color cleaning function clearColor, pass the RGBA channel data of the character texture data to the color cleaning function clearColor, and complete the cleaning of the character texture data; call the bgCear function to clean the background.
[0087] Optionally, in a possible embodiment, the computer program 411 is specifically used to implement the following steps when executed by the processor: create an initialization init method in the CharFilterGroup class, and call the super init method in the initialization init method to obtain the character filter CharFilter; call the memory allocation function alloc of CharFilter, and then call the init method to initialize the character filter, and create the string filter charImgFilter; use the addFil function to add each created string filter charImgFilter to the current CharFilterGroup class; after adding, use initialFilters to initialize the string filter, package the string filter charImgFilter into an array, and put it into the initialFilters function to complete the construction of the character filter component.
[0088] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0089] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0090] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0093] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0094] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A character filtering processing method, characterized in that: include: Cut the resources to be filtered and processed to obtain each image block after cutting; Constructing a character filter component, and defining a plurality of character filters included in the character filter component; Performing batch filtering processing on the image blocks through the character filter component, wherein each character filter can filter one character; The step of constructing a character filter component and defining a plurality of character filters contained in the character filter component comprises: constructing the character filter component using the CharFilterGroup class, and constructing each character filter in the character filter component using the CharFilter class; Each of the character filters filters each character in the following manner: defining an initialization init method in the CharFilter class, creating a synchronous processing queue SynchronousQueue in the initialization init method; performing filtering processing on the characters in the synchronous processing queue SynchronousQueue: wherein, performing filtering processing on the characters in the synchronous processing queue SynchronousQueue includes: obtaining a related folder through the NSBundle mainBundle method, wherein the related folder stores character textures, using the pathForResource method to load the character texture, and obtaining the character texture path textPath; using the textLoader function to call the txtWithContentsOfFile function to load the character texture data according to the character texture path; calling the render function to render the loaded character texture data, wherein the texture two-dimensional coordinates of the character are passed into the render function.
2. The character filtering processing method according to claim 1, characterized in that: The step of cutting the resource to be filtered to obtain each image block after cutting comprises: Set the area size of each image block; According to the set area size of each image block, the resource to be filtered is cut into a plurality of image blocks of equal size.
3. The character filtering processing method according to claim 2, characterized in that: The setting of the area size of each image block includes: Set a variable to define a width value, the width value is a floating point type, wherein the height value of the image block is the same as the width value, constituting the area size of the image block; The step of cutting the resource to be filtered into a plurality of image blocks of equal size according to the set area size of each image block comprises: Obtaining the coordinate value of each pixel of the resource to be filtered; According to the coordinate value and width value of each pixel point, the texture two-dimensional coordinate value of each image block after cutting is obtained, and the texture two-dimensional coordinate value represents the corresponding image block, wherein one image block is one character.
4. The character filtering method according to any one of claims 1 to 3, characterized in that: Also includes: For each image block, obtaining the coordinates of the central pixel point of the image block; The brightness value of the central pixel of the image block is obtained, and the brightness value of the central pixel of the image block area is used as the brightness value of the image block.
5. The character filtering method according to claim 1, characterized in that: The calling of the render function to render the loaded character texture data comprises: Determine the display variable of the character texture, and if the display variable is yes, set the filter attribute of the character texture; Call the buffForSize method to obtain the cache of the character texture, call the color cleaning function clearColor, pass the RGBA channel data of the character texture data to the color cleaning function clearColor, and complete the cleaning of the character texture data; Call the bgCear function to clean the background.
6. The character filtering processing method according to claim 1, characterized in that: The method of using the CharFilterGroup class to construct a character filter component and using the CharFilter class to construct each character filter in the character filter component includes: Create an initialization init method in the CharFilterGroup class, and call the superinit method in the initialization init method to obtain the character filter CharFilter; Call the memory allocation function alloc of CharFilter, then call the init method to initialize the character filter and create the string filter charImgFilter; Use the addFil function to add each created string filter charImgFilter to the current CharFilterGroup class; After adding, use initialFilters to initialize the string filter, wrap the string filter charImgFilter into an array, put it into the initialFilters function, and complete the construction of the character filter component.
