[go: up one dir, main page]

CN114820874B - A text shadow effect processing method, device, equipment and storage medium - Google Patents

A text shadow effect processing method, device, equipment and storage medium

Info

Publication number
CN114820874B
CN114820874B CN202110118989.6A CN202110118989A CN114820874B CN 114820874 B CN114820874 B CN 114820874B CN 202110118989 A CN202110118989 A CN 202110118989A CN 114820874 B CN114820874 B CN 114820874B
Authority
CN
China
Prior art keywords
distance field
offset
field image
pixel point
target
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
CN202110118989.6A
Other languages
Chinese (zh)
Other versions
CN114820874A (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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202110118989.6A priority Critical patent/CN114820874B/en
Priority to PCT/CN2021/135953 priority patent/WO2022160946A1/en
Publication of CN114820874A publication Critical patent/CN114820874A/en
Priority to US18/357,651 priority patent/US12417567B2/en
Application granted granted Critical
Publication of CN114820874B publication Critical patent/CN114820874B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • Character Input (AREA)

Abstract

The disclosure provides a method, a device, equipment and a storage medium for processing a shadow effect of a character, wherein the method comprises the following steps: and performing position offset on pixel points in the directed distance field image of the target text to obtain a first distance field image, wherein the first distance field image comprises original pixel points and offset pixel points corresponding to the original pixel points. And then, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image, determining a target area formed by offset pixel points with the distance field value larger than a preset value in the first distance field image, and obtaining an inner shadow effect image of the target text from the area in the initial inner shadow effect image. According to the method and the device, the characteristic that the pixel points with the distance field value larger than the preset value in the directed distance field image of the target text are located in the outer area of the target text is utilized, the target area formed by the pixel points located in the outer area of the target text is removed, and the drawing of the inner shadow effect of the target text is achieved.

Description

Method, device, equipment and storage medium for processing shadow effect of characters
Technical Field
The disclosure relates to the field of data processing, and in particular relates to a method, a device, equipment and a storage medium for processing a shadow effect of a text.
Background
Currently, the drawing of text effects is applied in more and more fields, such as the scene drawing of network games, the subtitle display of a variety of programs, the text display in video, and so on.
The shadow effect of the characters is a common character effect, and how to draw the shadow effect of the characters is a problem which is paid attention to at present.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, an apparatus, a device, and a storage medium for processing a shadow effect of a text, which can draw the shadow effect of the text based on a directed distance field image of the text.
In a first aspect, the present disclosure provides a method for processing a shadow effect of a text, the method including:
The method comprises the steps of performing position deviation on pixel points in a directed distance field image of target characters to obtain a first distance field image, wherein the first distance field image comprises original pixel points and offset pixel points obtained by the original pixel points after the position deviation;
Drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image;
Determining a target area formed by the offset pixel points with the distance field value larger than a preset value in the first distance field image;
and removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text.
In an optional implementation manner, the drawing the initial inner shadow effect image corresponding to the target text based on the first distance field image includes:
drawing a character body of the target character based on the original pixel points in the first distance field image;
and drawing the inner shadow of the target text based on the offset pixel points in the first distance field image to obtain an initial inner shadow effect image corresponding to the target text.
In an optional implementation manner, the drawing the inner shadow of the target text based on the offset pixel point in the first distance field image includes:
determining a gradient value of the offset pixel point based on a dot product operation result between an offset coordinate and a gradient direction vector of the offset pixel point in the first distance field image, wherein the offset coordinate is a difference value between a position coordinate of the offset pixel point and a gradient origin;
determining the color value of the offset pixel point according to the gradient value and the target gradient color;
and drawing the inner shadow of the target text based on the color value of the offset pixel point.
In an alternative embodiment, the method further comprises:
and drawing an vulva shadow effect image corresponding to the target text based on the first distance field image.
In an optional implementation manner, the drawing the vulvar effect image corresponding to the target text based on the first distance field image includes:
Drawing a vulva shadow of the target text based on the offset pixel points in the first distance field image;
and drawing the character body of the target character based on the original pixel points in the first distance field image to obtain an vulva shadow effect image corresponding to the target character.
In an optional implementation manner, the drawing the text body of the target text based on the original pixel point in the first distance field image includes:
Determining a color transparency value of the original pixel point based on a distance field value of the original pixel point in the first distance field image, wherein an absolute value of the distance field value of the original pixel point is inversely proportional to the color transparency value of the original pixel point;
and drawing the character body of the target character based on the color transparency value of the original pixel point.
In an optional implementation manner, the drawing the vulva shadow of the target text based on the offset pixel point in the first distance field image includes:
determining a gradient value of the offset pixel point based on a dot product operation result between an offset coordinate and a gradient direction vector of the offset pixel point in the first distance field image, wherein the offset coordinate is a difference value between a position coordinate of the offset pixel point and a gradient origin;
determining the color value of the offset pixel point according to the gradient value and the target gradient color;
and drawing the vulva shadow of the target text based on the color value of the offset pixel point.
In an optional implementation manner, before the drawing of the initial inner shadow effect image corresponding to the target text based on the first distance field image, the method further includes:
and based on the color transparency value, performing color mixing on the original pixel point and the offset pixel point with the same position information in the first distance field image.
In a second aspect, the present disclosure provides a device for processing a shadow effect of a text, the device comprising:
The system comprises an offset module, a first distance field image and a second distance field image, wherein the offset module is used for carrying out position offset on pixel points in a directional distance field image of a target character to obtain the first distance field image, and the first distance field image comprises original pixel points and offset pixel points obtained by the original pixel points after position offset;
The first drawing module is used for drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image;
The first determining module is used for determining a target area formed by the offset pixel points with the distance field value larger than a preset value in the first distance field image;
And the removing module is used for removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text.
In a third aspect, the present disclosure provides a computer readable storage medium having instructions stored therein, which when run on a terminal device, cause the terminal device to implement the above-described method.
In a fourth aspect, the present disclosure provides an apparatus comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method described above when executing the computer program.
In a fifth aspect, the present disclosure provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the above-mentioned method.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has at least the following advantages:
In the method for processing the shadow effect of the text, first, after the pixel points in the directed distance field image of the target text are subjected to position offset, a first distance field image is obtained, wherein the first distance field image comprises original pixel points and offset pixel points obtained after the original pixel points are subjected to position offset. And then, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image, further determining a target area formed by offset pixel points with the distance field value larger than a preset value in the first distance field image, and removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text. According to the method and the device, the characteristic that the pixel points with the distance field value larger than the preset value in the directed distance field image of the target text are located in the outer area of the target text is utilized, the target area formed by the pixel points located in the outer area of the target text is removed, and the drawing of the inner shadow effect of the target text is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, the drawings that are required for the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a method for processing a shadow effect of a text according to an embodiment of the disclosure;
FIG. 2 is a schematic illustration of an initial internal shadow effect image provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of an inner shadow effect image of a target text according to an embodiment of the disclosure;
fig. 4 is a schematic diagram of an vulva shadow effect image corresponding to a target text according to an embodiment of the disclosure;
Fig. 5 is a schematic structural diagram of a device for processing a shadow effect of a text according to an embodiment of the disclosure;
Fig. 6 is a schematic structural diagram of a text shadow effect processing device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, a further description of aspects of the present disclosure will be provided below. It should be noted that, without conflict, the embodiments of the present disclosure and features in the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced otherwise than as described herein, and it is apparent that the embodiments in the specification are only some, rather than all, of the embodiments of the present disclosure.
Currently, the shadow effect of a text is usually drawn based on bitmap text, and a directed distance field image records the shortest distance value, also called distance field value, of each pixel point inside and outside the text from the text outline (also called boundary). Wherein, the distance field value of the pixel points in the inner area of the characters is set as a negative number, and the distance field value of the pixel points in the outer area around the characters is set as a positive number. The inventor finds that the directed distance field image based on the characters can be more convenient for drawing the shadow effect of the characters.
Therefore, the present disclosure provides a method for processing shadow effect of a text, first, after performing position offset on a pixel point in a directional distance field image of a target text, a first distance field image is obtained, where the first distance field image includes an original pixel point and an offset pixel point obtained after the original pixel point is subjected to position offset. And then, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image, further determining a target area formed by offset pixel points with the distance field value larger than a preset value in the first distance field image, and removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text. According to the method and the device, the characteristic that the pixel points with the distance field value larger than the preset value in the directed distance field image of the target text are located in the outer area of the target text is utilized, the target area formed by the pixel points located in the outer area of the target text is removed, and the drawing of the inner shadow effect of the target text is achieved.
Based on this, an embodiment of the present disclosure provides a method for processing a shadow effect of a text, and referring to fig. 1, a flowchart of the method for processing a shadow effect of a text provided by an embodiment of the present disclosure is provided, where the method includes:
s101, performing position deviation on pixel points in a directed distance field image of a target character to obtain a first distance field image, wherein the first distance field image comprises original pixel points and offset pixel points obtained by the original pixel points after the position deviation.
In the embodiment of the present disclosure, an offset vector of a shadow effect is predetermined for representing an offset direction, an offset distance, and the like of the shadow effect. For example, the offset vector may be (shadowOffsetX, shadowOffsetY), where shadowOffsetX is used to represent the offset distance of the shadow effect relative to the text body in the X-axis direction and shadowOffsetY is used to represent the offset distance of the shadow effect relative to the text body in the Y-axis direction.
In practical application, for any pixel point (x, y) in the directed distance field image of the target text, after the position deviation is performed based on the deviation vector (shadowOffsetX, shadowOffsetY), the obtained pixel point after the deviation is (x-shadowOffsetX, y-shadowOffsetY). The pixel points (x, y) are called original pixel points, and the pixel points (x-shadowOffsetX, y-shadowOffsetY) are offset pixel points corresponding to the original pixel points (x, y). And after each pixel point in the directed distance field image of the target text finishes position offset, obtaining a first distance field image comprising the original pixel point and the offset pixel point.
And S102, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image.
In the embodiment of the disclosure, after the first distance field image is determined, an initial shadow effect image corresponding to the target text is drawn based on distance field values of an original pixel point and an offset pixel point on the first distance field image.
In an alternative embodiment, first, the text body of the target text may be drawn based on the original pixel point in the first distance field image. After the drawing of the text body is completed, the initial internal shadow of the text body of the target text is primarily drawn based on the offset pixel points in the first distance field image, and an initial internal shadow effect image corresponding to the target text is obtained. By controlling the sequence of the drawing layers, the text body is drawn below the shadow, so that the text body is shielded by the shadow, and the drawing effect of the text body with the internal shadow is achieved.
In practical application, before the text body is drawn, the color value of each original pixel point can be determined, and then the text body of the target text is drawn based on the original pixel point with the color value. In addition, before the internal shadow of the text body of the target text is drawn, the color value of the offset pixel point can be determined first, and then the internal shadow of the text body of the target text is drawn based on the offset pixel point with the color value, so that an initial internal shadow effect image corresponding to the target text is obtained. Based on the above mode, the colored text body and the inner shadow can be drawn.
In addition, if the original pixel point and the offset pixel point with the same position information in the first distance field image have color transparency values, color mixing can be performed on the original pixel point and the offset pixel point with the same position information based on the color transparency values. The manner in which color mixing is performed based on the color transparency values is not limiting in the embodiments of the present disclosure.
In an alternative embodiment, the text body in the initial inner shadow effect image corresponding to the target text may be drawn as a lighting effect. Specifically, before the text body is drawn, the color transparency value of the original pixel point in the first distance field image is determined based on the distance field value of the original pixel point, wherein the distance field value is inversely proportional to the color transparency value, i.e. the color transparency of the pixel point far from the text body is lower, so that the text light-emitting effect is realized. And then, drawing the character body of the target character based on the color transparency value of the original pixel point.
In another alternative embodiment, the inner shadow effect in the initial inner shadow effect image corresponding to the target text may be drawn as a gradient color effect. Specifically, before the inner shadow of the target character is drawn, the gradient value of the offset pixel point is determined based on the dot product operation result between the offset coordinate and the gradient direction vector of the offset pixel point in the first distance field image. The offset coordinate is the difference between the position coordinate of the offset pixel point and the gradual change origin. And then, combining the gradient value and the target gradient color, determining the color value of the offset pixel point, and drawing the inner shadow of the target text based on the color value of the offset pixel point.
The target gradient color is usually two colors, such as white and black, and the gradient color effect is an effect of changing from black to white or from black to white. The fade origin is typically the center point of the text body, and is specifically used to determine the point at which one of the target fade colors transitions to the other.
S103, determining a target area formed by the offset pixel points with the distance field value larger than a preset value in the first distance field image.
The preset threshold may be set based on the requirement for the inner shadow effect, and specifically, the preset threshold may be 0, or may also be a value between 0 and 0.5.
In the embodiment of the disclosure, in the inner shadow effect drawn based on the offset pixel points in the first distance field image, there is a region that is not overlapped with the text body, as shown in fig. 2, which is a schematic diagram of an initial inner shadow effect image provided in the embodiment of the disclosure. In order to ensure the internal shadow rendering effect of the target text, the embodiments of the present disclosure need to cut out the region that does not overlap with the text body.
For this reason, the embodiments of the present disclosure determine a target area composed of shifted pixels having a distance field value greater than a preset value (e.g., 0) in a first distance field image based on a feature that the distance field value of the pixels located in an area outside the text in the directed distance field image is negative.
S104, removing the target area from the initial inner shadow effect image to obtain the inner shadow effect image of the target text.
In the embodiment of the disclosure, the target region is formed by offset pixel points with a distance field value greater than a preset value, wherein the offset pixel points with the distance field value greater than the preset value are located in the surrounding outer region of the target text. In order to achieve the inner shadow effect of the target text, offset pixel points with a distance field value larger than a preset value in the peripheral outer area of the target text need to be removed.
Therefore, after determining the target area, the embodiment of the disclosure removes the target area from the initial inner shadow effect image, so as to ensure that no area which is not overlapped with the text body exists in the finally obtained inner shadow effect image, and ensure the inner shadow effect of the target text. Fig. 3 is a schematic diagram of an inner shadow effect image of a target text according to an embodiment of the disclosure.
In the method for processing the shadow effect of the text provided by the embodiment of the disclosure, first, after the pixel points in the directed distance field image of the target text are subjected to position offset, a first distance field image is obtained, wherein the first distance field image comprises original pixel points and offset pixel points obtained after the original pixel points are subjected to position offset. And then, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image, further determining a target area formed by offset pixel points with the distance field value larger than a preset value in the first distance field image, and obtaining an inner shadow effect image of the target text from the area in the initial inner shadow effect image. According to the embodiment of the disclosure, the characteristic that the pixel points with the distance field value larger than the preset value in the directed distance field image of the target text are located in the outer area of the target text is utilized to remove the target area formed by the pixel points located in the outer area of the target text, so that the drawing of the inner shadow effect of the target text is realized.
The embodiment of the disclosure also provides a method for processing the vulva shadow effect of the target text, specifically, drawing a vulva shadow effect image corresponding to the target text based on the first distance field image, wherein the drawing of the external shadow effect can be drawing the external shadow, and then drawing the text body.
In an alternative implementation manner, firstly, drawing the vulva shadow of the target text based on the offset pixel points in a first distance field image, and then drawing the text body of the target text based on the original pixel points in the first distance field image to obtain an vulva shadow effect image corresponding to the target text. Fig. 4 is a schematic diagram of an vulva shadow effect image corresponding to a target text according to an embodiment of the disclosure.
By controlling the sequence of the drawing layers, the text body is drawn above the shadow, the shadow is shielded by the text body, and the drawing effect that the text body has external shadows is achieved.
It is noted that, in the first distance field image used for drawing the vulva shadow effect image corresponding to the target character, the offset vector and the offset distance used for performing the position offset on the pixel point may be different from the internal shadow effect drawing.
In an alternative embodiment, when the vulva shadow effect of the target text is drawn, the text body in the initial external shadow effect image corresponding to the target text can be drawn as a luminous effect. Specifically, before the text body is drawn, the color transparency value of the original pixel point in the first distance field image is determined based on the distance field value of the original pixel point, wherein the distance field value is inversely proportional to the color transparency value, i.e. the color transparency of the pixel point far from the text body is lower, so that the text light-emitting effect is realized. And then, drawing the character body of the target character based on the color transparency value of the original pixel point.
In another alternative embodiment, the vulva shadow effect in the initial external shadow effect image corresponding to the target text may be drawn as a gradient color effect. Specifically, before drawing the vulva shadow of the target character, the gradient value of the offset pixel point is determined based on the dot product operation result between the offset coordinate and the gradient direction vector of the offset pixel point in the first distance field image. The offset coordinate is the difference between the position coordinate of the offset pixel point and the gradual change origin. And then, combining the gradient value and the target gradient color, determining the color value of the offset pixel point, and finally, drawing the vulva shadow of the target text based on the color value of the offset pixel point.
According to the shadow effect processing method for the characters, provided by the embodiment of the disclosure, the internal shadow effect of the target characters can be drawn based on the directed distance field images of the target characters, and the vulva shadow effect of the target characters can be drawn based on the directed distance field images of the target characters, so that the processing requirements of users on the shadow effect of the characters are met.
Based on the same inventive concept as the above embodiment of the method, the present disclosure further provides a text shadow effect processing apparatus, and referring to fig. 5, a schematic structural diagram of the text shadow effect processing apparatus provided in the embodiment of the present disclosure is provided, where the apparatus includes:
The offset module 501 is configured to obtain a first distance field image after performing position offset on a pixel point in a directional distance field image of a target text, where the first distance field image includes an original pixel point and an offset pixel point obtained by performing position offset on the original pixel point;
A first drawing module 502, configured to draw an initial inner shadow effect image corresponding to the target text based on the first distance field image;
A first determining module 503, configured to determine a target area formed by the shifted pixel points in the first distance field image, where a distance field value is greater than a preset value;
and a removing module 504, configured to remove the target area from the initial inner shadow effect image, so as to obtain an inner shadow effect diagram of the target text.
In an alternative embodiment, the first drawing module includes:
The first drawing sub-module is used for drawing the character body of the target character based on the original pixel points in the first distance field image;
And the second drawing sub-module is used for drawing the inner shadow of the target text based on the offset pixel points in the first distance field image to obtain an initial inner shadow effect image corresponding to the target text.
In an alternative embodiment, the apparatus further comprises:
And the second drawing module is used for drawing the vulva shadow effect image corresponding to the target text based on the first distance field image.
In an alternative embodiment, the second drawing module includes:
The third drawing sub-module is used for drawing the vulva shadow of the target text based on the offset pixel points in the first distance field image;
And the fourth drawing sub-module is used for drawing the character body of the target character based on the original pixel points in the first distance field image to obtain an vulva shadow effect image corresponding to the target character.
In an alternative embodiment, the first drawing sub-module or the fourth drawing sub-module includes:
The first determining submodule is used for determining a color transparency value of the original pixel point based on the distance field value of the original pixel point in the first distance field image, wherein the distance field value of the original pixel point is inversely proportional to the color transparency value of the original pixel point;
And the fifth drawing submodule is used for drawing the character body of the target character based on the color transparency value of the original pixel point.
In an alternative embodiment, the second drawing sub-module includes:
The second determining submodule is used for determining a gradient value of the offset pixel point based on a dot product operation result between the offset coordinate of the offset pixel point and a gradient direction vector in the first distance field image, wherein the offset coordinate is a difference value between the position coordinate of the offset pixel point and a gradient origin;
A third determining submodule, configured to determine a color value of the offset pixel point according to the gradient value and the target gradient color;
and a sixth drawing submodule, configured to draw an inner shadow of the target text based on the color value of the shifted pixel point.
In an alternative embodiment, the third drawing sub-module includes:
a fourth determining submodule, configured to determine a gradient value of the shifted pixel point based on a dot product operation result between an offset coordinate of the shifted pixel point in the first distance field image and a gradient direction vector, where the offset coordinate is a difference value between a position coordinate of the shifted pixel point and a gradient origin;
a fifth determining submodule, configured to determine a color value of the shifted pixel point according to the gradient value and the target gradient color;
And a seventh drawing sub-module, configured to draw a vulva shadow of the target text based on the color value of the shifted pixel point.
In an alternative embodiment, the apparatus further comprises:
And the mixing module is used for carrying out color mixing on the original pixel point and the offset pixel point with the same position information in the first distance field image based on the color transparency value.
In the device for processing the shadow effect of the text provided by the embodiment of the disclosure, first, after the pixel points in the directed distance field image of the target text are subjected to position offset, a first distance field image is obtained, wherein the first distance field image comprises original pixel points and offset pixel points obtained after the original pixel points are subjected to position offset. And then, drawing an initial inner shadow effect image corresponding to the target text based on the first distance field image, further determining a target area formed by offset pixel points with the distance field value larger than a preset value in the first distance field image, and obtaining an inner shadow effect image of the target text from the area in the initial inner shadow effect image. According to the embodiment of the disclosure, the characteristic that the pixel points with the distance field value larger than the preset value in the directed distance field image of the target text are located in the outer area of the target text is utilized to remove the target area formed by the pixel points located in the outer area of the target text, so that the drawing of the inner shadow effect of the target text is realized.
In addition to the above method and apparatus, the embodiments of the present disclosure further provide a computer readable storage medium, where instructions are stored in the computer readable storage medium, when the instructions run on a terminal device, cause the terminal device to implement the method for processing a shadow effect of a text according to the embodiments of the present disclosure.
The embodiment of the disclosure also provides a computer program product, which comprises a computer program/instruction, wherein the computer program/instruction realizes the shadow effect processing method of the text in the embodiment of the disclosure when being executed by a processor.
In addition, the embodiment of the present disclosure further provides a text shadow effect processing device, as shown in fig. 6, which may include:
A processor 601, a memory 602, an input device 603 and an output device 604. The number of processors 601 in the text shadow effect processing device may be one or more, one processor being exemplified in fig. 6. In some embodiments of the present disclosure, the processor 601, memory 602, input device 603, and output device 604 may be connected by a bus or other means, with the bus connection being exemplified in fig. 6.
The memory 602 may be used to store software programs and modules, and the processor 601 executes the software programs and modules stored in the memory 602 to perform various functional applications and data processing of the word shadow effect processing apparatus as shown in the present disclosure. The memory 602 may primarily include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function, and the like. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. The input means 603 may be used to receive input numeric or character information and to generate signal inputs related to user settings and function control of the word shading effect processing device.
In particular, in this embodiment, the processor 601 loads executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 runs the application programs stored in the memory 602, so as to implement the various functions of the above-mentioned text shadow effect processing device.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing is merely a specific embodiment of the disclosure to enable one skilled in the art to understand or practice the disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown and described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A method for processing a shadow effect of a character, the method comprising:
The method comprises the steps of performing position deviation on pixel points in a directed distance field image of target characters to obtain a first distance field image, wherein the first distance field image comprises original pixel points and offset pixel points obtained by the original pixel points after the position deviation;
drawing an initial inner shadow effect image corresponding to the target text based on the original pixel point and the offset pixel point in the first distance field image;
Determining a target area formed by the offset pixel points with the distance field value larger than a preset value in the first distance field image;
and removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text.
2. The method of claim 1, wherein the rendering the initial inner shadow effect image corresponding to the target text based on the original pixel point and the shifted pixel point in the first distance field image comprises:
drawing a character body of the target character based on the original pixel points in the first distance field image;
and drawing the inner shadow of the target text based on the offset pixel points in the first distance field image to obtain an initial inner shadow effect image corresponding to the target text.
3. The method of claim 2, wherein the rendering the inner shadow of the target text based on the shifted pixel points in the first distance field image comprises:
determining a gradient value of the offset pixel point based on a dot product operation result between an offset coordinate and a gradient direction vector of the offset pixel point in the first distance field image, wherein the offset coordinate is a difference value between a position coordinate of the offset pixel point and a gradient origin;
determining the color value of the offset pixel point according to the gradient value and the target gradient color;
and drawing the inner shadow of the target text based on the color value of the offset pixel point.
4. The method according to claim 1, wherein the method further comprises:
and drawing an vulva shadow effect image corresponding to the target text based on the first distance field image.
5. The method of claim 4, wherein the rendering the vulvar effect image corresponding to the target text based on the first distance field image comprises:
Drawing a vulva shadow of the target text based on the offset pixel points in the first distance field image;
and drawing the character body of the target character based on the original pixel points in the first distance field image to obtain an vulva shadow effect image corresponding to the target character.
6. The method according to claim 2 or 5, wherein the rendering the text body of the target text based on the original pixel point in the first distance field image comprises:
Determining a color transparency value of the original pixel point based on a distance field value of the original pixel point in the first distance field image, wherein an absolute value of the distance field value of the original pixel point is inversely proportional to the color transparency value of the original pixel point;
and drawing the character body of the target character based on the color transparency value of the original pixel point.
7. The method of claim 5, wherein the rendering the vulva shadow of the target text based on the shifted pixel points in the first distance field image comprises:
determining a gradient value of the offset pixel point based on a dot product operation result between an offset coordinate and a gradient direction vector of the offset pixel point in the first distance field image, wherein the offset coordinate is a difference value between a position coordinate of the offset pixel point and a gradient origin;
determining the color value of the offset pixel point according to the gradient value and the target gradient color;
and drawing the vulva shadow of the target text based on the color value of the offset pixel point.
8. The method of claim 1, wherein prior to rendering the initial inner shadow effect image corresponding to the target text based on the first distance field image, further comprising:
and based on the color transparency value, performing color mixing on the original pixel point and the offset pixel point with the same position information in the first distance field image.
9. A device for processing a shadow effect of a character, the device comprising:
The system comprises an offset module, a first distance field image and a second distance field image, wherein the offset module is used for carrying out position offset on pixel points in a directional distance field image of a target character to obtain the first distance field image, and the first distance field image comprises original pixel points and offset pixel points obtained by the original pixel points after position offset;
The first drawing module is used for drawing an initial inner shadow effect image corresponding to the target text based on the original pixel point and the offset pixel point in the first distance field image;
The first determining module is used for determining a target area formed by the offset pixel points with the distance field value larger than a preset value in the first distance field image;
And the removing module is used for removing the target area from the initial inner shadow effect image to obtain an inner shadow effect image of the target text.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein instructions, which when run on a terminal device, cause the terminal device to implement the method according to any of claims 1-8.
11. An apparatus comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of claims 1-8 when the computer program is executed.
12. A computer program product, characterized in that it comprises a computer program/instruction which, when executed by a processor, implements the method according to any of claims 1-8.
CN202110118989.6A 2021-01-28 2021-01-28 A text shadow effect processing method, device, equipment and storage medium Active CN114820874B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202110118989.6A CN114820874B (en) 2021-01-28 2021-01-28 A text shadow effect processing method, device, equipment and storage medium
PCT/CN2021/135953 WO2022160946A1 (en) 2021-01-28 2021-12-07 Text shadow effect processing method and apparatus, device and storage medium
US18/357,651 US12417567B2 (en) 2021-01-28 2023-07-24 Method for generating signed distance field image, method for generating text effect image, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110118989.6A CN114820874B (en) 2021-01-28 2021-01-28 A text shadow effect processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114820874A CN114820874A (en) 2022-07-29
CN114820874B true CN114820874B (en) 2025-09-23

Family

ID=82525455

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110118989.6A Active CN114820874B (en) 2021-01-28 2021-01-28 A text shadow effect processing method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN114820874B (en)
WO (1) WO2022160946A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116483359B (en) * 2023-04-25 2024-03-12 重庆赛力斯凤凰智创科技有限公司 New mimicry drawing method and device, electronic equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010147610A (en) * 2008-12-16 2010-07-01 Ricoh Co Ltd Image processing apparatus and method, and computer executable program
CN111292405A (en) * 2020-02-06 2020-06-16 腾讯科技(深圳)有限公司 An image rendering method and related device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102103614B1 (en) * 2014-09-15 2020-04-23 한국과학기술원 A method for shadow removal in front projection systems
CN105957125B (en) * 2016-05-20 2019-02-22 Oppo广东移动通信有限公司 Icon and character processing method and mobile terminal
CN109410300A (en) * 2018-10-10 2019-03-01 苏州好玩友网络科技有限公司 Shadows Processing method and device and terminal device in a kind of scene of game
US11074724B2 (en) * 2018-12-07 2021-07-27 Microsoft Technology Licensing Llc GPU calculation of signed distance fields
CN111311724B (en) * 2020-01-20 2022-08-09 稿定(厦门)科技有限公司 Shadow adding method, medium, device and apparatus for 3D characters
CN111803942B (en) * 2020-07-20 2024-07-30 网易(杭州)网络有限公司 Soft shadow generation method and device, electronic equipment and storage medium
CN112256367A (en) * 2020-10-19 2021-01-22 北京字节跳动网络技术有限公司 Graphical user interface display method, device, terminal and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010147610A (en) * 2008-12-16 2010-07-01 Ricoh Co Ltd Image processing apparatus and method, and computer executable program
CN111292405A (en) * 2020-02-06 2020-06-16 腾讯科技(深圳)有限公司 An image rendering method and related device

Also Published As

Publication number Publication date
WO2022160946A1 (en) 2022-08-04
CN114820874A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN112861560A (en) Two-dimensional code positioning method and device
EP3163423A1 (en) Method and device for setting background of ui control and terminal
WO2022160914A1 (en) Effect processing method and apparatus, and device and storage medium
CN110971839A (en) Video fusion method, electronic device and storage medium
CN113391779B (en) Parameter adjusting method, device and equipment for paper-like screen
CN111736941A (en) Picture processing method and device
CN117611703B (en) Method, device, equipment, storage medium and program product for rendering bullet screen characters
CN114820874B (en) A text shadow effect processing method, device, equipment and storage medium
CN110806847A (en) Distributed multi-screen display method, device, equipment and system
CN111932571B (en) Image boundary identification method and device and computer readable storage medium
WO2022160915A1 (en) Text illumination effect processing method, apparatus, device, and storage medium
WO2022161237A1 (en) Text contour effect processing method and apparatus, device, and storage medium
US9459819B2 (en) Method, apparatus and system for associating an intermediate fill with a plurality of objects
CN109509237B (en) Filter processing method and device and electronic equipment
CN114820837A (en) Gradient color effect processing method, device, equipment and storage medium
US9361855B2 (en) Computer-implemented methods and systems for a color generator
CN114399430A (en) Method and device for realizing dissolving effect based on cocos2dx
CN114882126A (en) Image processing method, device, equipment and storage medium
CN114286088A (en) Video screen splash detection method, device and storage medium applied to graphic processor
CN112580638A (en) Text detection method and device, storage medium and electronic equipment
CN111951367B (en) Character rendering method, character processing method and device
CN118747900A (en) Color verification code recognition method, system, electronic device and storage medium
CN112053277B (en) Method, device, equipment and storage medium for changing image skin
CN116560958B (en) Implementation method, device, terminal and storage medium for judging event occurrence position
US9361555B2 (en) Method, apparatus and system for rendering an object on a page

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