Disclosure of Invention
In view of this, embodiments of the present specification provide a text display method, a text display apparatus, a computing device, and a storage medium, so as to solve technical defects in the prior art.
According to a first aspect of embodiments of the present specification, there is provided a text display method including:
creating a background layer and a character layer for character data to be displayed, wherein the background layer comprises a background display area and a background preparation area outside the background display area, the character layer comprises a character display area for displaying the character data, and the background display area and the character display area are overlapped;
and the character display area and the background display area are overlapped and then stored as a frame of overlapped data, and the frame of overlapped data is output to the display equipment for displaying, wherein the character data of the character display area is displayed in a transparent mode, and the part of the background display area corresponding to the character data is displayed in the character display area.
Optionally, the text display method further includes:
controlling the background layer to move relative to the character layer, overlapping the background display area with the character display area to obtain another frame of overlapped data, and outputting the overlapped data to the display equipment for displaying;
continuously and circularly moving the background display area and the background preparation area relative to the character layer, and acquiring a frame of superposed data generated by superposing the background display area and the character display area each time;
and outputting the superposed data to the display equipment for display.
Optionally, the controlling the background layer to move relative to the text layer includes:
and controlling the background layer to move according to a preset moving speed or a preset moving mode.
Optionally, the outputting the overlay data to the display device for display includes:
adjusting the style and layout of the character data in the superimposed data on the display equipment by using a cascading style sheet;
and displaying the adjusted text data on the display equipment.
Optionally, the creating a background layer for the text data to be displayed includes:
creating a background layer for the character data to be displayed according to a preset color change rule;
the preset color change rule comprises: and (5) color gradient rules.
Optionally, the color gradient rule comprises a change in color from dark to light or a change in color from light to dark.
According to a second aspect of embodiments herein, there is provided a text display device including:
the text display device comprises a creating module, a display module and a display module, wherein the creating module is configured to create a background layer and a text layer for text data to be displayed, the background layer comprises a background display area and a background preparation area outside the background display area, the text layer comprises a text display area for displaying the text data, and the background display area and the text display area are overlapped;
the first display module is configured to store the character display area and a background display area as a frame of superimposed data after being superimposed, and output the frame of superimposed data to the display device for display, wherein the character data of the character display area is displayed in a transparent manner, and a part of the background display area corresponding to the character data is displayed in the character display area.
Optionally, the text display device further comprises:
the moving module is configured to control the background layer to move relative to the character layer, the background display area is overlapped with the character display area, another frame of overlapped data is obtained, and the overlapped data is output to the display equipment to be displayed;
the control module is configured to move the background display area and the background preparation area relative to the character layer continuously and circularly, and acquire a frame of superposed data generated by superposing the background display area and the character display area each time;
a second display module configured to output the overlay data to the display device for display.
Optionally, the moving module is further configured to:
and controlling the background layer to move according to a preset moving speed or a preset moving mode.
Optionally, the second display module comprises:
the adjustment sub-module is configured to adjust the style and the layout of the character data in the overlapped data on the display device by using a cascading style sheet;
and the display sub-module is configured to display the adjusted text data on the display device.
Optionally, the creation module is further configured to:
creating a background layer for the character data to be displayed according to a preset color change rule;
the preset color change rule comprises: and (5) color gradient rules.
Optionally, the color gradient rule comprises a change in color from dark to light or a change in color from light to dark.
According to a third aspect of embodiments herein, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the text display method when executing the instructions.
According to a fourth aspect of embodiments herein, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the text display method.
In the embodiment of the specification, a background layer and a text layer are created for text data to be displayed, the background layer comprises a background display area and a background preparation area outside the background display area, the text layer comprises a text display area for displaying the text data, the background display area and the text display area are overlapped, the text display area and the background display area are overlapped and then stored as a frame of overlapped data, the frame of overlapped data is output to the display equipment for displaying, the text data in the text display area is displayed in a transparent mode, and the background display area and the text data corresponding part are displayed in the text display area; the background layer is arranged, so that the desired character visual effect can be obtained, simplicity and practicability are realized, the finally obtained character display effect of continuous cyclic color change is excellent, and the application scene is wide.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit and scope of this application, and thus this application is not limited to the specific implementations disclosed below.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can be termed a second and, similarly, a second can be termed a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at" \8230; "or" when 8230; \8230; "or" in response to a determination ", depending on the context.
First, the noun terms to which one or more embodiments of the present invention relate are explained.
Cascading Style Sheets (CSS: cascading Style Sheets): is a computer language used to represent file styles such as HTML (an application of standard universal markup language) or XML (a subset of standard universal markup language). The cascading style sheet not only can statically modify the webpage, but also can dynamically format each element of the webpage in cooperation with various scripting languages; the cascading style sheet can accurately control the typesetting of element positions in the webpage in a pixel level, supports almost all font and size styles and has the capability of editing webpage objects and model styles.
In the present application, a text display method, a text display apparatus, a computing device and a storage medium are provided, which are described in detail in the following embodiments one by one.
Fig. 1 is a block diagram illustrating a configuration of a computing device 100 according to an embodiment of the present specification. The components of the computing device 100 include, but are not limited to, memory 110 and processor 120. The processor 120 is coupled to the memory 110 via a bus 130 and a database 150 is used to store data.
Computing device 100 also includes access device 140, access device 140 enabling computing device 100 to communicate via one or more networks 160. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 140 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 100 and other components not shown in FIG. 1 may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 1 is for purposes of example only and is not limiting as to the scope of the description. Those skilled in the art may add or replace other components as desired.
Computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 100 may also be a mobile or stationary server.
The processor 120 may execute the steps in the text display method shown in fig. 2. Fig. 2 is a flowchart illustrating a text display method according to an embodiment of the present disclosure, including step 202 to step 204.
Step 202: the method comprises the steps of creating a background layer and a character layer for character data to be displayed, wherein the background layer comprises a background display area and a background preparation area outside the background display area, the character layer comprises a character display area for displaying the character data, and the background display area and the character display area are overlapped.
In one or more embodiments of the present specification, the creating a background layer for the text data to be displayed includes:
creating a background layer for the character data to be displayed according to a preset color change rule;
the preset color change rule comprises: and (5) color gradient rules.
In one or more embodiments of the present disclosure, the color gradient rule includes a change in color from dark to light or a change in color from light to dark.
Specifically, the background layer includes a background display area and a background preparation area, where the background preparation area may be an area to be overlapped with the text display area, the background layer may be created by changing according to a preset rule, and may be created by gradually changing a color from a dark color to a light color, or gradually changing a color from a light color to a dark color, and a change rule of the color may be set according to an actual application, which is not limited herein.
In practical application, the text display area may be a text picture with a hollowed target text, and the background display area is a gradient picture with a color from a dark color to a light color, wherein the gradient picture of the background display area is provided with an initial position, the initial position of the gradient picture of the background display area is overlapped with the text picture of the text display area, and the overlapped part is an area to be displayed.
Step 204: and overlapping the text display area and the background display area, storing the overlapped text display area and the background display area as a frame of overlapped data, and outputting the frame of overlapped data to the display equipment for displaying, wherein the text data in the text display area is displayed in a transparent mode, and the part of the background display area corresponding to the text data is displayed in the text display area.
In one or more embodiments of the present specification, the text display method further includes:
controlling the background layer to move relative to the character layer, overlapping the background display area with the character display area to obtain another frame of overlapped data, and outputting the overlapped data to the display equipment for displaying;
continuously and circularly moving the background display area and the background preparation area relative to the character layer, and acquiring a frame of superposed data generated by superposing the background display area and the character display area each time;
and outputting the superposed data to the display equipment for display.
Specifically, the background display area may be provided with a position complex value, after the background display area and the text display area are superimposed, superimposed data of each frame is output to a display device for display, when the background display area moves relative to the text layer to reach the position complex value, the background display area will not have a superimposed portion with the text display area, the background display area is superimposed with the text display area again from an initial position according to the set position complex value, a frame of superimposed data is output to the display device for display, and the text in the text display area keeps changing color all the time, and the situation that the text in the middle does not display color does not occur.
It should be noted that, the color of the background display area may be set at will according to the needs of the actual application, and this specification is not limited at all.
In one or more embodiments of the present specification, the controlling the background layer to move relative to the text layer includes:
and controlling the background layer to move according to a preset moving speed or a preset moving mode.
Specifically, the moving speed of the background layer may be set according to a requirement, the moving mode of the background layer may be moving from left to right relative to the text layer, or moving from top to bottom, and the moving mode may be set according to a display effect required in an actual application, which is not limited herein.
In one or more embodiments of the present specification, the outputting the overlay data to the display device for displaying includes:
adjusting the style and layout of the character data in the superimposed data on the display equipment by using a cascading style sheet;
and displaying the adjusted text data on the display equipment.
In practical application, the text display area and the background display area are overlapped to output one frame of data to a display device, the background display area further comprises a partial area outside the background display area, the partial area outside the background display area cannot appear on the display device, the partial area outside the background display area is adjusted through a cascading style sheet, the partial area outside the adjusted background display area is hidden, and the display device cannot display other data information except text data in the overlapped data.
It should be noted that the style and distribution of the cascading style sheet when adjusting the text data in the stacked data are adjusted according to the set requirement, and the text data can be adjusted according to the required style, for example, only the text data is displayed or the text data is surrounded by a frame can be adjusted by the cascading style sheet.
In one or more embodiments of the present specification, a background layer and a text layer are created for text data to be displayed, where the background layer includes a background display area and a background preparation area outside the background display area, the text layer includes a text display area for displaying the text data, an area where the background display area overlaps with the text display area is present, the text display area and the background display area are overlapped and stored as a frame of overlapped data, and the frame of overlapped data is output to the display device for display, where the text data in the text display area is displayed in a transparent manner, and a portion of the background display area corresponding to the text data is displayed in the text display area; the background layer is arranged, the desired visual effect of the characters can be obtained, the color of the character display area can be slowly and continuously changed, the method is simple and feasible, the finally obtained continuous and cyclic color change characters have excellent display effect, the colors of the characters can be periodically circulated, and the application scene is wide.
Fig. 3 is a diagram illustrating a text display method according to an embodiment of the present specification, which is described by exemplifying text color gradient, and includes steps 302 to 312.
Step 302: and creating a background layer and a text layer for the target text data to be displayed.
Specifically, a background layer and a character layer are created for target character data to be displayed, the background layer comprises a background display area and a background preparation area outside the background display area, the character layer comprises a character display area, the background display area and the character display area are overlapped, color bars of the background display area are set according to the sequence from dark color to light color, and the target characters in the character display area are hollow non-colored characters.
Referring to fig. 4 (a), it is a schematic diagram of a text layer created for a target text to be displayed, which includes a text display area of the target text to be displayed.
Referring to fig. 4 (b), it is a schematic diagram of a background layer created for the target text to be displayed, which includes a background display area and a background preparation area.
Referring to fig. 4 (c), it is a schematic diagram of the background display area overlapping with the text display area, wherein the target text has not yet started to change color.
Step 304: and setting the moving mode of the background layer.
Specifically, the background layer is set to move leftwards relative to the text layer according to the requirement, and the moving speed is slow.
Step 306: and acquiring a frame of superposed data after the background display area and the character display area are superposed.
Referring to fig. 5 (a), the background display area is moved to the left relative to the text display area of the target text data according to a set moving mode, the color of the text display area of the target text data changes according to the color of the background display area, and the color of the target text gradually changes from dark color to light color.
Step 308: the background display area continuously moves, and each frame of superposed data generated in the moving process is obtained.
Referring to fig. 5 (a), the background display area continuously moves to the left relative to the target text, wherein when the position change is a, the target text and the background display area start to be overlapped to generate first overlapped data of the current frame, and according to the preset moving speed of the background display area, after a set time t, the background display area moves to the left, when the position change is B, the target text and the background display area are overlapped to generate second overlapped data of the current frame, after the time t, the background display area moves to the left, and when the position change is C, the target text and the background display area are overlapped to generate third overlapped data of the current frame.
The color of the target character gradually changes to light color according to the color of a background display area, wherein the background display area is provided with a position complex value, the background display area reaches the position complex value when the background display area moves to the position with respect to the target character and changes to C, if the background display area moves, the target character loses color, the background display area is overlapped with the target character from the initial position again according to the set position complex value, the positions of the background display area and the target character change to A again, overlapped data are obtained again, the background display area can continuously move relative to the target character, and when the background display area moves to the position complex value, the background display area starts to move again from the initial position again to enable the color of the target character to continuously change.
Step 310: and adjusting the pattern and distribution of each frame of superposed data on the display device by using the cascading pattern table.
Step 312: and outputting each frame of the adjusted superposed data to display equipment for displaying.
Referring to fig. 5 (B), the background display area continuously moves to the left relative to the target text, wherein when the position change is a, the target text and the background display area start to be overlapped to generate first overlapped data of the current frame, after a preset time t according to the moving speed of the background display area, the background display area moves to the left, when the position change is B, the target text and the background display area are overlapped to generate second overlapped data of the current frame, after the time t, the background display area moves to the left, and when the position change is C, the target text and the background display area are overlapped to generate third overlapped data of the current frame. And adjusting the first superposition data, the second superposition data and the third superposition data according to a cascading style sheet to hide a background preparation area in a background layer, wherein only the color of the characters displayed on display equipment is gradually changed, the rest parts are hidden through the cascading style sheet, and the display effect of the target characters is that the color is gradually changed from deep color to light color, and the color of the target characters is periodically and circularly changed.
In one or more embodiments of the present specification, a background layer and a text layer are created for text data to be displayed, where the background layer includes a background display area and a background preparation area outside the background display area, the text layer includes a text display area for displaying the text data, and there is an overlapping area between the background display area and the text display area, the text display area and the background display area are overlapped and then stored as a frame of overlapped data, and the frame of overlapped data is output to the display device for display, where the text data in the text display area is displayed in a transparent manner, and a part of the background display area corresponding to the text data is displayed in the text display area; the background layer is arranged, a desired character visual effect can be obtained, the color of the character display area can be changed slowly and continuously, the method is simple and easy to implement, the finally obtained character with continuous color change in a circulating mode has an excellent display effect, the character color can be periodically circulated, and the application scene is wide.
Corresponding to the above method embodiment, this specification further provides a text display device embodiment, and fig. 6 shows a schematic structural diagram of the text display device according to an embodiment of this specification. As shown in fig. 6, the apparatus 600 includes:
a creating module 602 configured to create a background layer and a text layer for text data to be displayed, where the background layer includes a background display area and a background preparation area outside the background display area, the text layer includes a text display area for displaying the text data, and there is an overlapping area between the background display area and the text display area;
a first display module 604, configured to store the text display area and a background display area as a frame of superimposed data after superimposing them, and output the frame of superimposed data to the display device for displaying, where the text data in the text display area is displayed in a transparent manner, and a portion of the background display area corresponding to the text data is displayed in the text display area.
In an optional embodiment, the text display device further comprises:
the moving module is configured to control the background layer to move relative to the character layer, the background display area is overlapped with the character display area, another frame of overlapped data is obtained, and the overlapped data is output to the display equipment to be displayed;
the control module is configured to move the background display area and the background preparation area relative to the character layer continuously and circularly, and acquire a frame of superposed data generated by superposing the background display area and the character display area each time;
a second display module configured to output the overlay data to the display device for display.
In an optional embodiment, the moving module is further configured to:
and controlling the background layer to move according to a preset moving speed or a preset moving mode.
In an alternative embodiment, the second display module includes:
the adjustment sub-module is configured to adjust the style and the layout of the character data in the overlapped data on the display device by using a cascading style sheet;
and the display sub-module is configured to display the adjusted text data on the display device.
In an optional embodiment, the creating module 602 is further configured to:
creating a background layer for the character data to be displayed according to a preset color change rule;
the preset color change rule comprises: and (5) color gradient rules.
In an alternative embodiment, the color gradient rule comprises a change in color from dark to light or a change in color from light to dark.
In the embodiment of the specification, a background layer and a text layer are created for text data to be displayed, the background layer comprises a background display area and a background preparation area outside the background display area, the text layer comprises a text display area for displaying the text data, the background display area and the text display area are overlapped, the text display area and the background display area are overlapped and then stored as a frame of overlapped data, the frame of overlapped data is output to the display equipment for displaying, the text data in the text display area is displayed in a transparent mode, and the background display area and the text data corresponding part are displayed in the text display area; the background layer is arranged, the desired character visual effect can be obtained, the method is simple and easy to implement, the finally obtained character display effect of continuous cyclic color change is excellent, and the application scene is wide.
One or more embodiments of the present specification also provide a computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the text display method when executing the instructions.
An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the instructions, when executed by a processor, implement the steps of the text display method as described above.
The above is an illustrative scheme of a computer-readable storage medium of the embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the above-mentioned text display method, and for details that are not described in detail in the technical solution of the storage medium, reference may be made to the description of the technical solution of the above-mentioned text display method.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art will appreciate that the embodiments described in this specification are presently considered to be preferred embodiments and that acts and modules are not required in the present application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical application, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.