CN112233206B - 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
CN112233206B
CN112233206B CN201910635735.4A CN201910635735A CN112233206B CN 112233206 B CN112233206 B CN 112233206B CN 201910635735 A CN201910635735 A CN 201910635735A CN 112233206 B CN112233206 B CN 112233206B
Authority
CN
China
Prior art keywords
drawn
character
character image
image
characters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910635735.4A
Other languages
Chinese (zh)
Other versions
CN112233206A (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

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

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Controls And Circuits For Display Device (AREA)

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 traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 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; and drawing the candidate characters according to the judging result, and clearing the buffer area until the traversal is completed. According to the embodiment of the invention, only the character to be drawn which is traversed currently is stored in the cache area to serve as the candidate character, so that compared with the method that all characters in the complete character image are stored in the cache area, 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 the creation of characters, graphics or images in the screen of a display that allows a user to obtain information from the display. Before character display is performed at present, a character image is required to be generated according to characters to be displayed, the generating process of the character image comprises caching all bitmap data of related characters, corresponding character bitmap data are directly searched from the cache when the corresponding character bitmap data are required to be displayed, and the character image to be displayed is generated according to the character bitmap data.
Since a plurality of characters are often required to be displayed on the screen, at this time, the number of characters in the character image to be generated is large, in addition, the size of bitmap data of the characters may be relatively large, and if bitmap data generated by all the characters to be displayed are cached, the required cache space is relatively large, so that the memory capacity of system resources is relatively large, and requirements and restrictions on the system resources are generated.
Disclosure of Invention
The embodiment of the invention provides a character image generation method, a device, equipment and a storage medium, which are used for solving the problems that the character image generation process has higher requirements on system resources and the processing efficiency on a large number of characters is low.
In a first aspect, an embodiment of the present invention provides a character image generating method, including:
through traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 is 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 clearing the buffer area after drawing is completed until traversing is completed.
In a second aspect, an embodiment of the present invention provides a character image generating apparatus, including:
the traversal caching module is used for storing a preset number of characters to be drawn in the complete character image to be drawn into a caching area through traversal operation, and the characters to be drawn are used 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 is 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 clearing the buffer area after drawing is completed until traversing is completed.
In a third aspect, an embodiment of the present invention further provides an apparatus, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the character image generation method according to any one of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the character image generating method according to any one of the embodiments of the present invention.
According to the embodiment of the invention, the characters to be drawn in the complete character image to be drawn are traversed, the preset number of the characters to be drawn are acquired and stored in the buffer area to serve as candidate characters, whether the candidate characters are to be drawn in the target drawing area image or not is judged according to the positions of the candidate characters in the complete character image and the positions of the target drawing areas, the target area image corresponding to the candidate characters is drawn according to the judgment result, and the buffer area is emptied after the drawing is completed. According to the scheme, only the characters to be drawn which are traversed currently are stored in the buffer area to serve as candidate characters, so that compared with the situation that all characters in a complete character image are stored in the buffer area, the required buffer space is reduced, and the buffer and processing burden of processing all the characters to be drawn are reduced.
Drawings
Fig. 1 is a flowchart of a character image generating method in a first embodiment of the present invention;
FIG. 2 is a flow chart of a character image generating method in a second embodiment of the present invention;
FIG. 3 is a schematic diagram of a complete character image in a second embodiment of the invention;
fig. 4 is a schematic diagram of an image of a target drawing area in the second embodiment of the present invention;
fig. 5 is a schematic diagram of a character image generating apparatus according to a third embodiment of the present invention;
fig. 6 is a schematic structural view of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a character image generating method in a first embodiment of the present invention. The method for generating a character image provided in this embodiment may be suitable for a case of drawing and generating a character image of a specified area, and the method may be specifically performed 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, and referring to fig. 1, the method in an embodiment of the present invention specifically includes:
step 110, storing a preset number of characters to be drawn in the complete character image to be drawn in a cache area through traversal operation, and taking 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.
The complete character image to be drawn may be a character image to be displayed on the display, and before the characters are displayed on the display, the complete character image needs to be drawn to determine the content and specific position of the characters to be displayed. The character to be drawn refers to a character included in the complete character image, and different characters to be drawn can be displayed in a time-sharing manner. The preset number can be set by a technician according to actual conditions and is smaller than the total number of characters to be drawn in the complete character image, so that the processor only needs to cache part of characters in the complete character image, and the requirement on the storage amount of a cache area is reduced.
Specifically, there are many characters to be displayed on the display screen, and the size of each character may be large, and if all the characters are stored in the buffer area in the process of generating the character image, a large amount of buffer area space is required, so that the memory space of the buffer area is required to be large, so that all the characters to be drawn can be accommodated sufficiently. However, some system resources may not meet the buffer space required for character buffer, so that the system cannot generate character images, and thus requirements and limitations are imposed on the system resources and devices for character image generation. In addition, processing all characters to be drawn places a great burden on the processor, resulting in lower 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 the traversing operation, and the preset number of the characters to be drawn in the complete character image to be drawn are stored in the cache area to serve as candidate characters instead of storing all the characters to be drawn in the cache area, so that the space of the cache area required by character cache is reduced, and the requirement on system resources is reduced.
And step 120, 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.
The position of the candidate character in the complete character image may be coordinates of the candidate character in the complete character image, taking the shape of the complete character image as a rectangle as an example, and the origin of coordinates may be set as a vertex of the upper left corner of the rectangle. The target drawing area may be set according to the size of the display screen, for example, may be set as a rectangular area with an area smaller than the area of the complete character image, or may be set as other shape areas with other sizes, and in the embodiment of the present invention, the size, shape and position of the target drawing area are not specifically limited.
And selecting a target drawing area from the complete character image according to the size and the traversing 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 specific characters on the display.
Specifically, according to the preset character display effect, the position of the candidate character in the complete character image is determined, for example, the line of the character "a" in the complete character image is preset, and the position, that is, the coordinate, of the character "a" in the complete character image is further determined. Similarly, the position, i.e., coordinates, of the target drawing area in the complete character image may be set in advance. And determining whether the character 'A' is positioned in the area outlined 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, so as to judge whether the character 'A' is to be drawn in the target drawing area image.
Optionally, 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, the method further includes: and determining the position of the candidate character in the complete character image according to the number of character lines, the number of characters in each line, the alignment mode and bitmap size data of the single candidate character in the complete character image. Specifically, the number of character lines, the number of characters in each line and an alignment mode in the complete character image to be drawn are preset, and the position of each character in the complete character image is determined by further combining the size data of single candidate characters and the specific arrangement sequence of each line of the characters to be drawn in the complete character image.
Optionally, determining the position of the candidate character in the complete character image according to the number of character lines, the number of characters in each line, the alignment mode and bitmap size data of each candidate character in the complete character image includes: determining the position of the top left corner vertex and the position of the bottom right corner vertex of the region of each candidate character in the complete character image according to the number of character lines, the number of characters in each line, the alignment mode and bitmap size data of each candidate character in the complete character image; correspondingly, according to the position of the candidate character in the complete character image and the position of the target drawing area, judging whether the candidate character is to be drawn in the target drawing area image or not comprises the following steps: and judging whether a part of the candidate character area is to be drawn in the target drawing area image according to the position of the left upper corner vertex and the position of the right lower corner vertex of the character area to be drawn in the complete character image and the position of the left upper corner vertex and the position of the right lower corner vertex of the target drawing area.
Specifically, if the character to be drawn is located in the buffer area, the character is a candidate character. And if the abscissa of the left upper corner vertex position of the candidate character area is greater than or equal to the abscissa of the right lower corner vertex position of the target drawing area position, or the abscissa of the right lower corner vertex position of the candidate character area is less than or equal to the abscissa of the left upper corner fixed point position of the target drawing area position, or the ordinate of the left upper corner vertex position of the candidate character area is greater than or equal to the ordinate of the right lower corner vertex position of the target drawing area position, or the ordinate of the right lower corner vertex position of the candidate character area is less than or equal to the ordinate of the left upper corner vertex position of the target drawing area position, the area which indicates the candidate character is not positioned in the target drawing area, and the candidate character is not drawn.
And if the abscissa of the left upper corner vertex position of the candidate character area is smaller than or equal to the abscissa of the left upper corner fixed point position of the target drawing area position, and the abscissa of the right lower corner vertex position of the candidate character area is larger than or equal to the abscissa of the right lower corner vertex position of the target drawing area position, and the ordinate of the left upper corner vertex position of the candidate character area is smaller than or equal to the ordinate of the right lower corner vertex position of the target drawing area position, or the ordinate of the right lower corner vertex position of the candidate character area is smaller than or equal to the ordinate of the right lower corner vertex position of the target drawing area position, the part of the target drawing area, which is completely filled by the part of the image or the whole image in the candidate image, is indicated, and the part of the candidate character, which is located in the target drawing area, is drawn.
If the case other than the above is described, it is explained that there is a part of the candidate image located within the target drawing area and the target drawing area is not completely filled, and therefore, the part of the candidate character located within the target drawing area is drawn.
And 130, drawing the target area image corresponding to the candidate character according to the judgment result, and clearing the buffer area after drawing is completed until traversing is completed.
Specifically, if the candidate characters in the buffer area are determined to be required to be drawn in the target area image through judgment, the candidate characters are drawn, and if the candidate characters in the buffer area are determined not to be drawn in the target area image through judgment, the candidate characters are not drawn. After judging all candidate characters in the buffer area and drawing according to the judging result, emptying the buffer area, continuously storing a preset number of new characters to be drawn in the complete character image obtained through traversing operation as candidate characters, and continuously executing the operation of judging the candidate characters and drawing according to the judging result until all characters in the complete character image are traversed. By the scheme, the drawing of the target area image is realized, so that the preset number of candidate characters are cached and the drawing of the target area image is performed under the condition that less cache area space is required.
According to the technical scheme, the characters to be drawn in the complete character image to be drawn are traversed, a preset number of the characters to be drawn are obtained and stored in the buffer area to serve as candidate characters, whether the candidate characters are to be drawn in the target drawing area image or not is judged according to the positions of the candidate characters in the complete character image and the positions of the target drawing areas, the candidate characters are drawn according to the judgment result, and the buffer area is emptied until the traversal is completed. According to the scheme, all the characters to be drawn in the complete character image to be drawn are not required to be cached, the cache space required in the character image generation process can be reduced, and the requirements and the limits on system resources are reduced, so that equipment with lower configuration can also generate character images with arbitrary character numbers and sizes, and the efficiency of character image generation is improved, and the cache and processing burden of processing all the characters to be drawn are reduced by operating the preset number of the characters to be drawn instead of operating all the characters to be drawn.
Example two
Fig. 2 is a flowchart of a character image generating method in the second embodiment of the present invention. The present embodiment is optimized on the basis of the above-described embodiment, and details not described in detail in the present embodiment are detailed in the above-described embodiment. Referring to fig. 2, the character image generating method provided in the present 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 traversing operation.
Specifically, all characters to be drawn in the complete character image to be drawn are traversed, bitmap data of the characters to be drawn are determined, optionally, the bitmap data of the characters to be drawn can be generated according to preset bitmap data parameters, and bitmap size data of the generated characters to be drawn are further determined.
Optionally, determining bitmap data of the character to be drawn in the complete character image to be drawn and bitmap size data includes: obtaining 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, according to the calling mode of the characters to be drawn, vector diagrams of a preset number of the characters to be drawn are obtained from a database. Since the vector image cannot be directly drawn in the target area image, it is necessary to convert the vector image of the character to be drawn into bitmap data and determine bitmap size data. Wherein the bitmap size data may be a width and a 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 the buffer area 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 buffer area at a time, and then a subsequent operation is performed for one character stored in the buffer area, so that a storage space of the buffer area only needs a space of one character size, which can meet a requirement of character image generation, save system resources, and reduce requirements and limitations on system resources.
Step 230, determining the position of the pixel in the complete character image according to the position of each pixel in the bitmap data of the candidate character and the position of the candidate character in the complete character image.
For example, as shown in fig. 3, the height of the bitmap data of the character to be drawn is preset, the type of the character to be drawn is judged, and the relation between the width and the height of the character to be drawn is further determined according to the type of the character to be drawn. For example, whether the character to be drawn is Chinese or English is judged, if the character to be drawn is Chinese, nine tenths of the width of the character to be drawn is determined, and if the character to be drawn is English, nine tenths of the width of the character to be drawn is determined. And accumulating the widths Char_w of all the 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 a width value map_w of the complete character image, namely map_w=Maxline_w. And taking the high Char_h of each character to be drawn as a Line line_h [ n ], and accumulating the lines of all lines to obtain a high map_h of the complete character image, namely, map_h=line_h [1] +line_h [2] + … +line_h [ n ].
Different character alignment modes can be set in different display scenes. The embodiment of the invention is used for describing the scheme in detail in a centered alignment mode, but the scheme of the embodiment of the invention is applicable to various alignment modes and is not limited to the alignment modes. In the centered alignment, the first Line of characters starts at a position of line_x [ n ] in the complete character image]=(Line_w[n]-Char_w*m n )/2,Line_y[n]=char_h (n-1), where line_x [ n ]]Line_y [ n ] is the abscissa of the starting position of the first Line character in the complete character image]The ordinate is the same as the following. m is m n The number of characters to be drawn for the nth row. The coordinates of the 1 st character of the nth row are nChar_x1]=Line_x[n],nChar_y[1]=Line_y[n]The coordinates of the mth character in the nth row 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, where the position of the b-th pixel point of 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+ncare_x [ m ], and map_y=bit_y+ncare_y [ m ].
Step 240, determining whether the pixel point is to be drawn in the target drawing area according to the position of the pixel point in the complete character image.
Specifically, according to the position of the pixel point in the complete character image, whether the pixel point is located in the range defined by the target drawing area is determined, as shown in fig. 4, only a part of the image in the character to be drawn may be located in the range defined by the target drawing area, so that whether the pixel point is located in the target drawing area is determined according to the position of the pixel point of the character to be drawn in the complete character image.
For example, the starting position of the target drawing area is preset, and for example, when the target drawing area is a rectangle, the coordinates of the top left corner vertex are the starting positions (image_x, image_y), the width of the target drawing area is image_w, and the height of the target drawing area is image_h. If map_x_e { image_x, image_x+image_w }, map_y_e { image_y, image_y+image_h }, it is indicated that the pixel point is located within the range outlined by the target rendering area and is required to be rendered in the target area Image.
Optionally, before determining whether the pixel point is to be drawn in the target drawing area according to the position of the pixel point in the complete character image, the method further includes: judging whether the candidate character is 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 target drawing area position, comprising: and judging whether a part of the candidate character area is to be drawn in the target drawing area image according to the position of the left upper corner vertex and the position of the right lower corner vertex of the character area to be drawn in the complete character image and the position of the left upper corner vertex and the position of the right lower corner vertex of the target drawing area.
Step 250, if it is determined that the pixel point is 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 it is determined that the pixel point should be drawn in the target drawing area image, the position of the pixel point in the target drawing area image is determined. For example, the position of the pixel point in the target drawing area Image is (map_x-image_x, map_y-image_y), so as to obtain the position of each pixel point in the target area Image.
And 260, drawing the pixel point in the target drawing area image according to the preset pixel point drawing parameters and the position of the pixel point in the target drawing area image.
Specifically, according to the position of each pixel point in the target area image to be drawn in the target area image, the pixel point is drawn in the corresponding position in the target area image, and parameters of each pixel point are set according to preset pixel point drawing parameters, for example, gray values of each color channel corresponding to each pixel point are drawn, so as to determine preset colors of each pixel point.
According to the technical scheme, bitmap data and bitmap size data of characters to be drawn are obtained through traversing operation, and a preset number of characters to be drawn in a complete character image are stored in a buffer area, so that memory occupied by buffer is reduced, the size data of the complete character image and the positions of 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 candidate character bitmap data, and therefore whether the pixel points need to be drawn in the target drawing area image is judged according to the positions of the pixel points in the complete character image and the positions of the target drawing areas, and accordingly drawing of characters in the target drawing area image is completed efficiently.
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 the situation of drawing and generating the character image of the designated area, can be realized by software and/or hardware, and can be integrated in the equipment. Referring to fig. 5, the apparatus specifically includes:
the traversal caching module 310 is configured to store a preset number of characters to be drawn in the complete character image to be drawn in a cache area through traversal operation, and the characters to be drawn are used 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 the target drawing area image according to the position of the candidate character in the complete character image and the target drawing area position;
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 buffer area after drawing is completed until traversing is completed.
Optionally, the traversal caching module 310 includes:
a bitmap data determining unit for determining bitmap data of the character 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 the buffer area to serve 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 the bitmap data and the bitmap size data of the character to be drawn according to the vector diagram of the character to be drawn.
Optionally, the method further comprises:
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 character lines, the number of characters in each line, the alignment mode and bitmap size data of single candidate characters in the complete character image.
Optionally, the determining module 320 includes:
a pixel position determining unit, configured to determine a position of the pixel in the complete character image according to a position of each pixel in the bitmap data of the candidate character and a position of the candidate character in the complete character image;
and the pixel point drawing judging unit is used for determining whether the pixel point is 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 a position of the pixel point in the complete character image and a 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 the preset pixel point drawing parameter and the position of the pixel point in the target drawing area image.
According to the technical scheme, the traversal caching module stores a preset number of characters to be drawn in a complete character image to be drawn into a caching area through traversal operation, and the characters to be drawn are used 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 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; and the drawing module draws the candidate characters according to the judging result, and empties the buffer area until the traversal is completed. According to the scheme, all the characters to be drawn in the complete character image to be drawn are not required to be cached, the cache space required in the character image generation process can be reduced, and the requirements and the limits on system resources are reduced, so that equipment with lower configuration can also generate character images with arbitrary character numbers and sizes, and the efficiency of character image generation is improved, and the cache and processing burden of processing all the characters to be drawn are reduced by operating the preset number of the characters to be drawn instead of operating all the characters to be drawn.
Example IV
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 invention. The device 412 shown in fig. 6 is only an example and should not be construed as limiting the functionality and scope of use of embodiments of the invention.
As shown in fig. 6, the apparatus 412 includes: one or more processors 416; a memory 428 for storing one or more programs that, when executed by the one or more processors 416, cause the one or more processors 416 to implement the character image generation method provided by the embodiments of the present invention, includes:
through traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 is 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 clearing the buffer area after drawing is completed until traversing is completed.
In the form of a general-purpose device. 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 connects the various system components (including the system memory 428 and the processor 416).
Bus 418 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include 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. Such storage media can 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. 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 or write to a non-removable, nonvolatile magnetic storage medium (not shown in FIG. 6, commonly referred to as a "hard disk drive"). Although not shown in fig. 6, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical storage medium), may be provided. In such cases, each drive may be coupled to bus 418 via one or more data storage medium interfaces. Memory 428 may include at least one program product having a set (e.g., at least one) of program modules 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 in, for example, memory 428, such program modules 462 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 462 generally perform the functions and/or methods of the embodiments described herein.
The device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 426, etc.), one or more devices that enable a user to interact with the device 412, and/or 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 through an input/output (I/O) interface 422. Also, device 412 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 420. As shown, network adapter 420 communicates with 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 connection with device 412, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processor 416 performs various functional applications and data processing by executing at least one of other programs among a plurality of programs stored in the system memory 428, for example, implements a character image generating method provided by an embodiment of the present invention, including:
through traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 is 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 clearing the buffer area after drawing is completed until traversing is completed.
Example five
A fifth embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a character image generating method of:
through traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 is 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 clearing the buffer area after drawing is completed until traversing is completed.
The computer storage media of embodiments of the present invention may 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. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 present invention, a 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.
The computer readable signal storage medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 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 ++ 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. 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, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (10)

1. A character image generation method, characterized in that the method comprises:
through traversing operation, storing a preset number of characters to be drawn in a complete character image to be drawn in a cache area to serve 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 is 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; the position of the candidate character in the complete character image is the coordinate of the candidate character in the complete character image; the target drawing area is selected from the complete character image;
and drawing the target area image corresponding to the candidate character according to the judgment result, and clearing the buffer area after drawing is completed until traversing is completed.
2. The method according to claim 1, wherein storing a predetermined number of characters to be drawn in the complete character image to be drawn in the buffer as candidate characters includes:
determining bitmap data of characters to be drawn in a complete character image to be drawn and bitmap size data;
and storing bitmap data of a preset number of characters to be drawn in the complete character image to be drawn in a buffer area to serve as candidate characters.
3. The method of claim 2, wherein determining bitmap data of the character to be drawn in the complete character image to be drawn, and bitmap size data, comprises:
obtaining 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 according to claim 2, wherein determining whether the candidate character is to be drawn within the target drawing area image based on the position of the candidate character in the complete character image and the target drawing area position, further comprises:
and determining the position of the candidate character in the complete character image according to the number of character lines, the number of characters in each line, the alignment mode and the bitmap size data of each candidate character in the complete character image.
5. The method of claim 4, wherein determining the position of the candidate character in the complete character image based on the number of character lines, the number of characters per line, the alignment, and the bitmap size data for each candidate character in the complete character image comprises:
determining the position of the top left corner vertex and the position of the bottom right corner vertex of the region of each candidate character in the complete character image according to the number of character lines, the number of characters in each line, the alignment mode and bitmap size data of each candidate character in the complete character image;
correspondingly, according to the position of the candidate character in the complete character image and the position of the target drawing area, judging whether the candidate character is to be drawn in the target drawing area image or not comprises the following steps:
and judging whether a part of the candidate character area is to be drawn in the target drawing area image according to the position of the left upper corner vertex and the position of the right lower corner vertex of the candidate character area in the complete character image and the position of the left upper corner vertex and the position of the right lower corner vertex 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 in the target drawing area image based on the position of the candidate character in the complete character image and the target drawing area position, comprises:
determining the position of each 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 is to be drawn in the target drawing area image according to the position of the pixel point in the complete character image.
7. The method of claim 6, wherein the drawing the candidate character according to the determination result 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 image of the target drawing area according to the preset pixel point drawing parameters and the position of the pixel point in the target drawing area.
8. A character image generating apparatus, characterized in that the apparatus comprises:
the traversal caching module is used for storing a preset number of characters to be drawn in the complete character image to be drawn into a caching area through traversal operation, and the characters to be drawn are used 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 is 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; the position of the candidate character in the complete character image is the coordinate of the candidate character in the complete character image; the target drawing area is selected from the complete character image;
and the drawing module is used for drawing the candidate characters according to the judgment result, and clearing the buffer area until the traversal is completed.
9. An electronic device, the device comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, causes 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, characterized in that the program, when being executed by a processor, implements a character image generating method as claimed in 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 CN112233206A (en) 2021-01-15
CN112233206B true 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
CN112233206A (en) 2021-01-15

Similar Documents

Publication Publication Date Title
CN111882634B (en) Image rendering method, device, equipment and storage medium
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
JPH10105361A (en) Method and system for specifying object
US10825129B2 (en) Eliminating off screen passes using memoryless render target
US10930040B2 (en) Graphic object modifications
US8044960B2 (en) Character display apparatus
CN110727825A (en) Animation playing control method, device, server and storage medium
US20090249205A1 (en) Display position determination apparatus and method thereof
CN111054072B (en) Method, device, equipment and storage medium for role model tailing
CN112581568A (en) Dynamic poster generation method, device, server and storage medium
CN112233206B (en) Character image generation method, device, equipment and storage medium
CN112465692A (en) Image processing method, device, equipment and storage medium
CN114356475B (en) Display processing method, device, equipment and storage medium
CN114296852B (en) Method and device for displaying target page, electronic equipment and storage medium
US12026809B2 (en) Systems for generating anti-aliased vector objects
CN111870954B (en) Altitude map generation method, device, equipment and storage medium
CN114090817A (en) Dynamic construction method and device of face feature database and storage medium
CN111198858A (en) File processing method and device, computer storage medium and terminal
CN114820878B (en) Image editing method and device
US11907649B2 (en) Method and apparatus for managing interface, device and readable storage medium
CN112363778B (en) Dynamic picture loading method and device, electronic equipment and storage medium
US20230119741A1 (en) Picture annotation method, apparatus, electronic device, and storage medium
US20230195288A1 (en) Method and apparatus for detecting a click on an icon, device, and storage medium
US11328383B2 (en) Image provision apparatus, image provision method, and computer readable 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