CN112233206A - Character image generation method, device, equipment and storage medium - Google Patents

Character image generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN112233206A
CN112233206A CN201910635735.4A CN201910635735A CN112233206A CN 112233206 A CN112233206 A CN 112233206A CN 201910635735 A CN201910635735 A CN 201910635735A CN 112233206 A CN112233206 A CN 112233206A
Authority
CN
China
Prior art keywords
drawn
character
characters
character image
image
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
CN201910635735.4A
Other languages
Chinese (zh)
Other versions
CN112233206B (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.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies 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 Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201910635735.4A priority Critical patent/CN112233206B/en
Publication of CN112233206A publication Critical patent/CN112233206A/en
Application granted granted Critical
Publication of CN112233206B publication Critical patent/CN112233206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Abstract

The embodiment of the invention discloses a character image generation method, a device, equipment and a storage medium. The method comprises the following steps: through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image; judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area; drawing the candidate characters according to the judgment result, and clearing the cache region until traversal is completed. According to the embodiment of the invention, only the currently traversed character to be drawn is stored in the cache region as the candidate character, so that compared with the method that all characters in the complete character image are stored in the cache region, the required cache space is reduced, and the resource consumption is reduced.

Description

Character image generation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of image generation and display, in particular to a character image generation method, a device, equipment and a storage medium.
Background
OSD (On Screen Display) refers to generating characters, graphics or images On a Screen of a Display, so that a user can obtain information from the Display. Before displaying characters, a character image needs to be generated according to the characters to be displayed, the generation process of the character image comprises the steps of caching all bitmap data of related characters, directly searching corresponding character bitmap data from the cache when the characters need to be displayed, and generating the character image to be displayed according to the character bitmap data.
Because a plurality of characters are often required to be displayed on a screen, the number of characters in a character image required to be generated is large, in addition, the size of bitmap data of the characters may be large, and if bitmap data generated by all the characters to be displayed are cached, the needed cache space is large, so that the storage amount of required system resources is large, and requirements and limitations are generated on the system resources.
Disclosure of Invention
The embodiment of the invention provides a character image generation method, a device, equipment and a storage medium, which aim to solve the problems that the character image generation process has higher requirements on system resources and the processing efficiency of a large number of characters is low.
In a first aspect, an embodiment of the present invention provides a character image generation method, where the method includes:
through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
In a second aspect, an embodiment of the present invention provides a character image generation apparatus, including:
the traversal cache module is used for storing a preset number of characters to be drawn in the complete character image to be drawn in a cache region through traversal operation to serve as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
the judging module is used for judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and the drawing module is used for drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after drawing is finished until traversal is finished.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
a memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the character image generation method according to any one of the embodiments of the present invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the character image generation method according to any one of the embodiments of the present invention.
In the embodiment of the invention, characters to be drawn in a complete character image to be drawn are traversed, a preset number of characters to be drawn are obtained and stored in a cache region to be used as candidate characters, whether the candidate characters are to be drawn in a target drawing region image is judged according to the positions of the candidate characters in the complete character image and the position of the target drawing region, the target region image corresponding to the candidate characters is drawn according to the judgment result, and the cache region is emptied after the drawing is finished until the traversing is finished. By the scheme, only the currently traversed characters to be drawn are stored in the cache region to serve as candidate characters, and compared with the method that all characters in the complete character image are stored in the cache region, the required cache space is reduced, and cache and processing burden for processing all the characters to be drawn are reduced.
Drawings
Fig. 1 is a flowchart of a character image generation method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a character image generation method according to a second embodiment of the present invention;
FIG. 3 is a diagram illustrating a complete character image according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of a target rendering area image according to a second embodiment of the present invention;
fig. 5 is a schematic structural diagram of a character image generating apparatus according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a character image generation method according to a first embodiment of the present invention. The character image generating method provided in this embodiment may be applicable to the case of generating a character image of a designated area by drawing, and the method may be specifically executed by a character image generating apparatus, where the apparatus may be implemented by software and/or hardware, and the apparatus may be integrated in a device, referring to fig. 1, and the method according to the embodiment of the present invention specifically includes:
step 110, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region through traversal operation to serve as candidate characters; and the preset number is smaller than the total number of the characters to be drawn in the complete character image.
The complete character image to be drawn may be a character image that needs to be displayed on the display, and before the character is displayed on the display, the complete character image needs to be drawn to determine the content and the specific position of the character to be displayed. The characters to be drawn refer to characters included in the complete character image, and different characters to be drawn can be displayed in different time periods. The preset number can be set by technicians according to actual conditions, and is less than the total number of characters to be drawn in the complete character image, so that the processor only needs to cache partial characters in the complete character image, and the requirement on the storage capacity of a cache area is reduced.
Specifically, there are often many characters that need to be displayed on the display screen, and the size of each character may be large, and if all characters are stored in the buffer area in the process of generating the character image, a large amount of buffer area space needs to be occupied, so that the memory space of the buffer area needs to be large to sufficiently accommodate all the characters to be drawn. However, some system resources may not meet the buffer space required by the character buffer, so that the system cannot generate the character image, and thus, requirements and limitations are imposed on system resources and equipment for generating the character image. In addition, processing all the characters to be drawn causes great burden to the processor, which results in low processing efficiency. Therefore, in the embodiment of the invention, the characters to be drawn in the complete character image to be drawn are traversed through traversal operation, the characters to be drawn in the complete character image to be drawn in a preset number are stored in the cache region and serve as candidate characters, instead of storing all the characters to be drawn in the cache region, so that the cache region space required by character caching is reduced, and the requirement on system resources is lowered.
And step 120, judging whether the candidate character needs to be drawn in the target drawing area image according to the position of the candidate character in the complete character image and the position of the target drawing area.
The position of the candidate character in the complete character image may be a coordinate of the candidate character in the complete character image, and taking the shape of the complete character image as a rectangle as an example, the origin of the coordinate may be set as a vertex of an upper left corner of the rectangle. The target drawing area may be set according to the size of the display screen, for example, the target drawing area may be set to be a rectangular area having an area smaller than the area of the complete character image, or may be set to be another shape area having another size.
And selecting a target drawing area from the complete character image according to the size and the traversal progress of the display so as to determine which specific characters in the complete character image need to be drawn in the target drawing area image and further display the characters on the display.
Specifically, the position of the candidate character in the complete character image is determined according to a preset character display effect, for example, the position, i.e., the coordinates, of the character "a" in the complete character image is preset in the first few characters in the complete character image, and the position of the character "a" in the complete character image is further determined. Similarly, the position, i.e., the coordinates, of the target drawing region in the complete character image may be set in advance. And determining whether the character "A" is located in the area defined by the target drawing area according to the position of the character "A" in the complete character image and the position of the target drawing area, thereby judging whether the character "A" is to be drawn in the target drawing area image.
Optionally, determining whether the candidate character is to be drawn in the target drawing area before determining whether the candidate character is to be drawn in the target drawing area according to the position of the candidate character in the complete character image and the position of the target drawing area, further includes: and determining the positions of the candidate characters in the complete character image according to the number of the character lines in the complete character image, the number of the characters in each line, the alignment mode and bitmap size data of the single candidate characters. Specifically, the number of character rows in the complete character image to be drawn, the number of characters in each row, and the alignment mode are preset, and the position of each character in the complete character image is further determined by combining the size data of a single candidate character and the specific arrangement sequence of the characters to be drawn in each row in the complete character image.
Optionally, determining the position of the candidate character in the complete character image according to the number of rows of characters in the complete character image, the number of characters in each row, the alignment mode, and the bitmap size data of each candidate character, includes: determining the top left corner vertex position and the bottom right corner vertex position of the candidate character region in the complete character image according to the number of character lines in the complete character image, the number of characters in each line, an alignment mode and bitmap size data of each candidate character; correspondingly, judging whether the candidate character is to be drawn in the target drawing area image according to the position of the candidate character in the complete character image and the position of the target drawing area, including: and judging whether a part of candidate character areas need to be drawn in the target drawing area image or not according to the top left corner vertex position and the bottom right corner vertex position of the area of the character to be drawn in the complete character image and the top left corner vertex position and the bottom right corner vertex position of the target drawing area.
Specifically, if the character to be drawn is located in the cache region, the character is a candidate character. If the abscissa of the top-left vertex position of the candidate character region is greater than or equal to the abscissa of the bottom-right vertex position of the target drawing region position, or the abscissa of the bottom-right vertex position of the candidate character region is less than or equal to the abscissa of the top-left vertex position of the target drawing region position, or the ordinate of the top-left vertex position of the candidate character region is greater than or equal to the ordinate of the bottom-right vertex position of the target drawing region position, or the ordinate of the bottom-right vertex position of the candidate character region is less than or equal to the ordinate of the top-left vertex position of the target drawing region position, it is said that the region of the candidate character is not located in the target drawing region, and the candidate character is not drawn.
If the abscissa of the top-left vertex position of the candidate character region is less than or equal to the abscissa of the top-left vertex position of the target drawing region position, the abscissa of the bottom-right vertex position of the candidate character region is greater than or equal to the abscissa of the bottom-right vertex position of the target drawing region position, the ordinate of the top-left vertex position of the candidate character region is less than or equal to the ordinate of the bottom-right vertex position of the target drawing region position, or the ordinate of the bottom-right vertex position of the candidate character region is less than or equal to the ordinate of the bottom-right vertex position of the target drawing region position, it is said that the partial image or the entire image in the candidate image is completely filled in the target drawing region, and the portion of the candidate character in the target drawing region is drawn.
If the case is other than the above, it is described that there is a portion of the candidate image located within the target rendering area and the target rendering area is not completely filled, and therefore, a portion of the candidate character located in the target rendering area is rendered.
And step 130, drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
Specifically, if the candidate character in the cache region is determined to need to be drawn in the target region image after the judgment, the candidate character is drawn, and if the candidate character in the cache region is determined not to need to be drawn in the target region image after the judgment, the candidate character is not drawn. And after all the candidate characters in the cache region are judged and drawn according to the judgment result, emptying the cache region, continuously storing a preset number of new characters to be drawn in the complete character image obtained through traversal operation as candidate characters, and continuously executing the operation of judging the candidate characters and drawing according to the judgment result until all the characters in the complete character image are traversed. By the scheme, the target area image is drawn, so that a preset number of candidate characters are cached and the target area image is drawn under the condition that less cache area space is needed.
According to the technical scheme of the embodiment of the invention, characters to be drawn in a complete character image to be drawn are traversed, a preset number of characters to be drawn are obtained and stored in a cache region to serve as candidate characters, whether the candidate characters need to be drawn in a target drawing region image or not is judged according to the positions of the candidate characters in the complete character image and the position of the target drawing region, the candidate characters are drawn according to a judgment result, and the cache region is emptied until the traversal is completed. By the scheme, all characters to be drawn in the complete character image to be drawn do not need to be cached, the cache space required in the character image generation process can be reduced, and the requirements and the limitations on system resources are reduced, so that equipment with low configuration can also generate character images with any character quantity and size, and the characters to be drawn in preset quantity are operated instead of all the characters to be drawn, so that the character image generation efficiency is improved, and the cache and the processing burden of processing all the characters to be drawn are reduced.
Example two
Fig. 2 is a flowchart of a character image generation method in the second embodiment of the present invention. The present embodiment is optimized based on the above embodiments, and details not described in detail in the present embodiment are described in the above embodiments. Referring to fig. 2, the character image generation method provided in this embodiment may include:
step 210, determining bitmap data of the character to be drawn in the complete character image to be drawn and bitmap size data through traversal operation.
Specifically, traversing all the characters to be drawn in the complete character image to be drawn, and determining bitmap data of the characters to be drawn, optionally, the bitmap data of the characters to be drawn may be generated according to preset bitmap data parameters, and further determining generated bitmap size data of the characters to be drawn.
Optionally, determining bitmap data of a character to be drawn in the complete character image to be drawn and bitmap size data includes: acquiring vector diagrams of a preset number of characters to be drawn in a complete character image to be drawn from a character database; and determining bitmap data and bitmap size data of the character to be drawn according to the vector diagram of the character to be drawn. Specifically, vector diagrams of a preset number of characters to be drawn are obtained from a database according to the calling mode of the characters to be drawn. Since the vector diagram cannot be directly drawn in the target area image, it is necessary to convert the vector diagram of the character to be drawn into bitmap data and determine bitmap size data. The bitmap size data may be, among others, the width and height of the bitmap data.
Step 220, storing bitmap data of a preset number of characters to be drawn in the complete character image to be drawn in a cache region as candidate characters.
Optionally, in the embodiment of the present invention, the preset number may be set to 1, that is, bitmap data of one character to be drawn in the character image to be drawn is stored in the cache region each time, and then a subsequent operation is performed on the character stored in the cache region, so that the storage space of the cache region only needs a space of one character size, and thus the requirement for generating the character image can be met, system resources are saved, and the requirement and the limitation on the system resources are reduced.
Step 230, determining the position of the pixel point in the complete character image according to the position of each pixel point in the bitmap data of the candidate character and the position of the candidate character in the complete character image.
Exemplarily, as shown in fig. 3, the height of bitmap data of a character to be drawn is preset, the type of the character to be drawn is determined, and further, the relationship between the width and the height of the character to be drawn is determined according to the type of the character to be drawn. For example, it is determined whether the character to be drawn is chinese or english, and if the character to be drawn is chinese, it is determined that the width of the character to be drawn is nine tenths of the height, and if the character to be drawn is english, it is determined that the width of the character to be drawn is nine twenties of the height. Accumulating the widths Char _ w of all characters to be drawn in each Line to obtain Line width information Line _ w [ n ] of each Line, and taking the maximum value MaxLine _ w in the Line width information as the width value Map _ w of the complete character image, namely Map _ w ═ MaxLine _ w. Taking the height Char _ h of each character to be drawn as the Line height Line _ h [ n ], accumulating the Line heights of all the lines to obtain the height Map _ h of the complete character image, i.e. Map _ h ═ Line _ h [1] + Line _ h [2] + … + Line _ h [ n ].
Under different display scenes, different character alignment modes can be set. The embodiment of the present invention will be described in detail with respect to the intermediate alignment method, but the embodiment of the present invention is applicable to various alignment methods, and the alignment method is not limited thereto. In the centered alignment mode, the initial position of the first Line of characters in the complete character image is Line _ x [ n ]]=(Line_w[n]-Char_w*mn)/2,Line_y[n]Charh (n-1), where Line _ x [ n [ ]]Line _ y [ n ] is the abscissa of the starting position of the first Line of characters in the complete character image]In the ordinate, the following coordinates represent the same. m isnThe number of the characters to be drawn in the nth line. The coordinates of the 1 st character in the nth row are nChar _ x [1]]=Line_x[n],nChar_y[1]=Line_y[n]Of the m-th character in the n-th lineThe coordinates are nChar _ x [ m ]]=nChar_x[m-1]+nChar_w[m-1],nChar_y[m]=Line_y[n]And obtaining the position of each character to be drawn in the complete character image.
For the bitmap data of Char _ w _ Char _ h, where the position of the b-th pixel point in the a-th row in the bitmap data is bit _ x ═ b-1, and bit _ y ═ a-1, the position of the pixel point in the complete character image is map _ x ═ bit _ x + nscher _ x [ m ], and map _ y ═ bit _ y + nscher _ y [ m ].
And 240, determining whether the pixel point needs to be drawn in the target drawing area according to the position of the pixel point in the complete character image.
Specifically, it is determined whether the pixel point is located within the range defined by the target rendering region according to the position of the pixel point in the complete character image, as shown in fig. 4, only a part of the image of the character to be rendered may be located within the range defined by the target rendering region, and therefore, it is determined whether the pixel point is located within the target rendering region according to the position of the pixel point of the character to be rendered in the complete character image.
Illustratively, the start position of the target drawing region is set in advance, and when the target drawing region is rectangular, the coordinates of the top left vertex are the start positions (Image _ x, Image _ y), the width of the target drawing region is Image _ w, and the height of the target drawing region is Image _ h. If map _ x belongs to { Image _ x, Image _ x + Image _ w }, and map _ y belongs to { Image _ y, Image _ y + Image _ h }, it is described that the pixel point is located in the range defined by the target rendering region and needs to be rendered in the target region Image.
Optionally, determining whether the pixel point is to be drawn in the target drawing region according to the position of the pixel point in the complete character image, further includes: judging whether the candidate character needs to be drawn in the target drawing area image according to the position of the candidate character in the complete character image and the position of the target drawing area, wherein the judging step comprises the following steps: and judging whether a part of candidate character areas need to be drawn in the target drawing area image or not according to the top left corner vertex position and the bottom right corner vertex position of the area of the character to be drawn in the complete character image and the top left corner vertex position and the bottom right corner vertex position of the target drawing area.
And step 250, if the pixel point is determined to be drawn in the target drawing area image, determining the position of the pixel point in the target drawing area image according to the position of the pixel point in the complete character image and the position of the target drawing area in the complete character image.
Specifically, if the pixel point is judged to be drawn in the target drawing area image, the position of the pixel point in the target drawing area image is determined. Illustratively, the positions of the pixel points in the target drawing area Image are (map _ x-Image _ x, map _ y-Image _ y), and accordingly, the positions of the pixel points in the target area Image are obtained.
And step 260, drawing the pixel point in the target drawing area image according to preset pixel point drawing parameters and the position of the pixel point in the target drawing area image.
Specifically, the positions of the pixel points in the target area image, which are drawn in the target area image according to the needs, are drawn in the corresponding positions in the target area image, and the parameters of the pixel points are set according to preset pixel point drawing parameters, for example, the gray values of the color channels corresponding to the pixel points are drawn to determine the preset colors of the pixel points.
According to the technical scheme of the embodiment of the invention, the bitmap data and the bitmap size data of the characters to be drawn are obtained through traversal operation, and the characters to be drawn in the complete character image in the preset number are stored in the cache region, so that the memory occupied by the cache is reduced, the size data of the complete character image and the positions of the candidate characters in the complete character image are further determined, the positions of the pixel points in the complete character image are determined according to the positions of the pixel points in the bitmap data of the candidate characters, and whether the pixel points need to be drawn in the target drawing region image is further determined according to the positions of the pixel points in the complete character image and the position of the target drawing region, so that the characters in the target drawing region image are efficiently and completely drawn.
EXAMPLE III
Fig. 5 is a schematic structural diagram of a character image generating apparatus according to a third embodiment of the present invention. The device is suitable for generating the character image of the designated area in a drawing mode, can be realized in a software and/or hardware mode, and can be integrated in equipment. Referring to fig. 5, the apparatus specifically includes:
the traversal cache module 310 is configured to store a preset number of characters to be drawn in a complete character image to be drawn in a cache region through traversal operation, and use the characters to be drawn as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
a judging module 320, configured to judge whether the candidate character is to be drawn in a target drawing area image according to a position of the candidate character in the complete character image and a position of the target drawing area;
and the drawing module 330 is configured to draw the target area image corresponding to the candidate character according to the determination result, and empty the cache area after the drawing is completed until the traversal is completed.
Optionally, the traversal cache module 310 includes:
the bitmap data determining unit is used for determining bitmap data of characters to be drawn in the complete character image to be drawn and bitmap size data;
and the candidate character determining unit is used for storing bitmap data of a preset number of characters to be drawn in the complete character image to be drawn in a cache region as candidate characters.
Optionally, the bitmap data determining unit includes:
the vector diagram acquisition subunit is used for acquiring vector diagrams of a preset number of characters to be drawn in the complete character image to be drawn from the character database;
and the bitmap data and size data determining subunit is used for determining bitmap data and bitmap size data of the character to be drawn according to the vector diagram of the character to be drawn.
Optionally, the method further includes:
and the position determining module is used for determining the position of the character to be drawn in the complete character image according to the number of the character lines in the complete character image, the number of the characters in each line, the alignment mode and bitmap size data of a single candidate character.
Optionally, the determining module 320 includes:
a pixel point position determining unit, configured to determine, according to a position of each pixel point in bitmap data of the candidate character and a position of the candidate character in the complete character image, a position of the pixel point in the complete character image;
and the pixel point drawing judgment unit is used for determining whether the pixel point needs to be drawn in the target drawing area image according to the position of the pixel point in the complete character image.
Optionally, the determining module 320 further includes:
a pixel point region position determining unit, configured to determine, if it is determined that the pixel point is to be drawn in the target drawing region image, a position of the pixel point in the target drawing region image according to the position of the pixel point in the complete character image and the position of the target drawing region in the complete character image;
and the target drawing area image drawing unit is used for drawing the pixel point in the target drawing area image according to preset pixel point drawing parameters and the position of the pixel point in the target drawing area image.
According to the technical scheme of the embodiment of the invention, a traversal cache module stores a preset number of characters to be drawn in a complete character image to be drawn in a cache region through traversal operation to serve as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image; the judging module judges whether the candidate character needs to be drawn in the target drawing area image according to the position of the candidate character in the complete character image and the position of the target drawing area; and the drawing module draws the candidate characters according to the judgment result and empties the cache region until traversal is completed. By the scheme, all characters to be drawn in the complete character image to be drawn do not need to be cached, the cache space required in the character image generation process can be reduced, and the requirements and the limitations on system resources are reduced, so that equipment with low configuration can also generate character images with any character quantity and size, and the characters to be drawn in preset quantity are operated instead of all the characters to be drawn, so that the character image generation efficiency is improved, and the cache and the processing burden of processing all the characters to be drawn are reduced.
Example four
Fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. FIG. 6 illustrates a block diagram of an exemplary device 412 suitable for use in implementing embodiments of the present invention. The device 412 shown in fig. 6 is only an example and should not impose any limitation on the functionality or scope of use of embodiments of the present invention.
As shown in fig. 6, the apparatus 412 includes: one or more processors 416; the memory 428 is configured to store one or more programs, and when the one or more programs are executed by the one or more processors 416, the one or more processors 416 implement the character image generation method provided by the embodiment of the present invention, including:
through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
Is expressed in the form of general-purpose equipment. The components of device 412 may include, but are not limited to: one or more processors or processors 416, a system memory 428, and a bus 418 that couples the various system components (including the system memory 428 and the processors 416).
Bus 418 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 412 typically includes a variety of computer system readable storage media. These storage media may be any available storage media that can be accessed by device 412 and includes both volatile and nonvolatile storage media, removable and non-removable storage media.
The system memory 428 may include computer system readable storage media in the form of volatile memory, such as Random Access Memory (RAM)430 and/or cache memory 432. The device 412 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 434 may be used to read from and write to non-removable, nonvolatile magnetic storage media (not shown in FIG. 6, commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical storage medium) may be provided. In these cases, each drive may be connected to bus 418 by one or more data storage media interfaces. Memory 428 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 440 having a set (at least one) of program modules 442 may be stored, for instance, in memory 428, such program modules 462 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 462 generally perform the functions and/or methodologies of the described embodiments of the invention.
The device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 426, etc.), with one or more devices that enable a user to interact with the device 412, and/or with any devices (e.g., network card, modem, etc.) that enable the device 412 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 422. Also, the device 412 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 420. As shown, network adapter 420 communicates with the other modules of device 412 over bus 418. It should be appreciated that although not shown in FIG. 6, other hardware and/or software modules may be used in conjunction with device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 416 executes various functional applications and data processing by executing at least one of other programs stored in the system memory 428, for example, to implement a character image generation method provided by an embodiment of the present invention, including:
through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a character image generation method:
through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
Computer storage media for embodiments of the present invention can take the form of any combination of one or more computer-readable storage media. The computer readable storage medium may be a computer readable signal storage medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the invention, the computer readable storage medium may be any tangible storage medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal storage medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal storage medium may also be any computer readable storage medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable storage medium may be transmitted using any appropriate storage medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or device. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A character image generation method, characterized by comprising:
through traversal operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache region as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and drawing the target area image corresponding to the candidate character according to the judgment result, and emptying the cache area after the drawing is finished until the traversal is finished.
2. The method of claim 1, wherein storing a preset number of characters to be drawn in the complete character image to be drawn in a buffer as candidate characters comprises:
determining bitmap data of characters to be drawn in a complete character image to be drawn and bitmap size data;
storing bitmap data of a preset number of characters to be drawn in the complete character image to be drawn in a cache region as candidate characters.
3. The method of claim 2, wherein determining bitmap data for a character to be rendered in the complete character image to be rendered, and bitmap size data, comprises:
acquiring vector diagrams of a preset number of characters to be drawn in a complete character image to be drawn from a character database;
and determining bitmap data and bitmap size data of the character to be drawn according to the vector diagram of the character to be drawn.
4. The method of claim 2, wherein determining whether the candidate character is to be rendered in the target rendering region image before the candidate character is determined according to the position of the candidate character in the complete character image and the position of the target rendering region, further comprises:
and determining the position of the candidate character in the complete character image according to the number of the character lines in the complete character image, the number of the characters in each line, the alignment mode and the bitmap size data of each candidate character.
5. The method of claim 4, wherein determining the position of the candidate character in the full character image according to the number of rows of characters in the full character image, the number of characters per row, the alignment mode, and the bitmap size data of each candidate character comprises:
determining the top left corner vertex position and the bottom right corner vertex position of the candidate character region in the complete character image according to the number of character lines in the complete character image, the number of characters in each line, an alignment mode and bitmap size data of each candidate character;
correspondingly, judging whether the candidate character is to be drawn in the target drawing area image according to the position of the candidate character in the complete character image and the position of the target drawing area, including:
and judging whether a part of candidate character areas need to be drawn in the target drawing area image or not according to the top left corner vertex position and the bottom right corner vertex position of the candidate character areas in the complete character image and the top left corner vertex position and the bottom right corner vertex position of the target drawing area.
6. The method according to any one of claims 1 to 5, wherein determining whether the candidate character is to be drawn within a target drawing area image according to the position of the candidate character in the complete character image and the target drawing area position comprises:
determining the position of the pixel point in the complete character image according to the position of each pixel point in the bitmap data of the candidate character and the position of the candidate character in the complete character image;
and determining whether the pixel point needs to be drawn in the target drawing area image or not according to the position of the pixel point in the complete character image.
7. The method of claim 6, wherein rendering the candidate characters according to the determination comprises:
if the pixel point is determined to be drawn in the target drawing area image, determining the position of the pixel point in the target drawing area according to the position of the pixel point in the complete character image and the position of the target drawing area in the complete character image;
and drawing the pixel point in the target drawing area image according to preset pixel point drawing parameters and the position of the pixel point in the target drawing area.
8. An apparatus for generating a character image, the apparatus comprising:
the traversal cache module is used for storing a preset number of characters to be drawn in the complete character image to be drawn in a cache region through traversal operation to serve as candidate characters; the preset number is smaller than the total number of characters to be drawn in the complete character image;
the judging module is used for judging whether the candidate character needs to be drawn in the target drawing area image or not according to the position of the candidate character in the complete character image and the position of the target drawing area;
and the drawing module is used for drawing the candidate characters according to the judgment result and emptying the cache region until traversal is completed.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a character image generation method as recited in any one of claims 1-7.
10. A computer-readable storage medium on which a computer program is stored, the program, when being executed by a processor, implementing a character image generation method according to any one of claims 1 to 7.
CN201910635735.4A 2019-07-15 2019-07-15 Character image generation method, device, equipment and storage medium Active CN112233206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910635735.4A CN112233206B (en) 2019-07-15 2019-07-15 Character image generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910635735.4A CN112233206B (en) 2019-07-15 2019-07-15 Character image generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112233206A true CN112233206A (en) 2021-01-15
CN112233206B CN112233206B (en) 2024-03-22

Family

ID=74111524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910635735.4A Active CN112233206B (en) 2019-07-15 2019-07-15 Character image generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112233206B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127035A (en) * 2007-10-11 2008-02-20 金蝶软件(中国)有限公司 Method and device drafting character string at targeted area
CN104462029A (en) * 2013-09-18 2015-03-25 北京新媒传信科技有限公司 Method and system for rich text display in intelligent terminal
CN104536713A (en) * 2014-12-22 2015-04-22 小米科技有限责任公司 Method and device for displaying characters in image
CN106991422A (en) * 2017-05-02 2017-07-28 北京京东金融科技控股有限公司 Character segmentation method, device and computer-readable recording medium and electronic equipment
CN107133615A (en) * 2016-02-26 2017-09-05 佳能株式会社 Message processing device and information processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127035A (en) * 2007-10-11 2008-02-20 金蝶软件(中国)有限公司 Method and device drafting character string at targeted area
CN104462029A (en) * 2013-09-18 2015-03-25 北京新媒传信科技有限公司 Method and system for rich text display in intelligent terminal
CN104536713A (en) * 2014-12-22 2015-04-22 小米科技有限责任公司 Method and device for displaying characters in image
CN107133615A (en) * 2016-02-26 2017-09-05 佳能株式会社 Message processing device and information processing method
CN106991422A (en) * 2017-05-02 2017-07-28 北京京东金融科技控股有限公司 Character segmentation method, device and computer-readable recording medium and electronic equipment

Also Published As

Publication number Publication date
CN112233206B (en) 2024-03-22

Similar Documents

Publication Publication Date Title
US20040222995A1 (en) Reducing information transfer in screen capture series
US7053905B2 (en) Screen display processing apparatus, screen display processing method and computer program
CN109472852B (en) Point cloud image display method and device, equipment and storage medium
WO2021248705A1 (en) Image rendering method and apparatus, computer program and readable medium
US10930040B2 (en) Graphic object modifications
US8044960B2 (en) Character display apparatus
US20010043227A1 (en) Priority methods for texture map storage
CN110727825A (en) Animation playing control method, device, server and storage medium
US20090249205A1 (en) Display position determination apparatus and method thereof
CN111870953A (en) Height map generation method, device, equipment and storage medium
CN112233206B (en) Character image generation method, device, equipment and storage medium
US20220366621A1 (en) Systems for Generating Anti-Aliased Vector Objects
CA1229439A (en) Data display system
CN114463400A (en) Texture sampling method and system based on texture object segmentation
CN112465692A (en) Image processing method, device, equipment and storage medium
US20030214516A1 (en) Method and apparatus for increasing pixel interpretations by implementing a transparent overlay without requiring window identifier support
CN112363778B (en) Dynamic picture loading method and device, electronic equipment and storage medium
CN111870954B (en) Altitude map generation method, device, equipment and storage medium
US6842179B2 (en) Graphics processing system
US6903744B2 (en) Graphics processing system
WO2023273828A1 (en) Interface management method and apparatus, and device and readable storage medium
CN108230537B (en) Image data processing method, device, equipment and storage medium
US6943798B1 (en) Method and system for executing SIMD instructions using graphics technology
US11328383B2 (en) Image provision apparatus, image provision method, and computer readable medium
CN115457180A (en) Three-dimensional terrain gradient rendering method and device, electronic equipment and storage medium

Legal Events

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