A bullet screen drawing method, device and electronic device

By setting a preset cache space in the client and obtaining or generating bitmaps as needed, the problem of reduced drawing efficiency caused by an increase in the number of barrages during video playback is solved, and the drawing efficiency and system performance of barrages are improved.

CN116320648BActive Publication Date: 2024-08-30BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211418859.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-14
Publication Date
2024-08-30
Estimated Expiration
2042-11-14

AI Technical Summary

Technical Problem

As the number of barrages increases during video playback, the efficiency of the client in drawing barrages in each video frame gradually decreases, resulting in low drawing efficiency.

Method used

Set a preset cache space in the client, retrieve the target bitmap for the characters to be displayed, and obtain it if retrieved. Otherwise, obtain the specified bitmap from the preset cache space as the target bitmap, and draw the barrage based on the splicing sequence. If When the cache space capacity reaches the specified amount, less used bitmaps are deleted.

Benefits of technology

By caching the bitmaps of commonly used characters to avoid regeneration, the barrage drawing efficiency is improved, and memory usage and computing burden are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320648B
    Figure CN116320648B
Patent Text Reader

Abstract

The embodiments of the present invention provide a bullet screen drawing method, device and electronic device, which relate to the field of image processing technology. The method comprises: obtaining each character to be displayed included in the bullet screen to be displayed; for each character to be displayed, retrieving the target bitmap of the character to be displayed in the preset cache space of the client; if retrieved, obtaining the target bitmap of the character to be displayed from the preset cache space; otherwise, obtaining a specified bitmap from the preset cache space as the target bitmap of the character to be displayed; determining the splicing order of the target bitmaps of each character to be displayed, and drawing the bullet screen to be displayed based on the splicing order. Compared with the prior art, the solution provided by the embodiment of the present invention can improve the efficiency of bullet screen drawing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a bullet screen drawing method, device and electronic equipment. Background Art

[0002] With the launch of various video playback clients, streaming media service providers have set up a barrage sending function in their clients in order to increase the playback volume of their own clients. Among them, barrage refers to the commentary subtitles that pop up on the video when watching the video on the Internet or video playback client. In this way, through the barrage presented in the video, users can have a sense of interactive chat. When a consistent point of view appears in the barrage, it can strengthen the user's sense of identity with the video. Every time a user watches a video, the barrage presented in the video is drawn by the client at any time based on the text received.

[0003] In the related art, after receiving the text content of the bullet screen to be displayed, the client can draw a bitmap that can be displayed in the video according to the text content, thereby displaying the bullet screen to be displayed in the video. However, as time goes by, the number of bullet screens appearing in each frame becomes larger and larger, that is, the number of bullet screens that the client needs to draw in each frame of the video becomes larger and larger, resulting in low efficiency of drawing bullet screens by the client. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a bullet screen drawing method, device and electronic device to improve the efficiency of bullet screen drawing. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present invention, a bullet screen drawing method is first provided, which is applied to a client, and the method includes:

[0006] Obtaining each character to be displayed included in the bullet comment to be displayed;

[0007] For each character to be displayed, searching a target bitmap of the character to be displayed in a preset cache space of the client;

[0008] If retrieved, the target bitmap of the character to be displayed is obtained from the preset cache space;

[0009] Otherwise, obtaining a specified bitmap from the preset cache space as a target bitmap of the character to be displayed;

[0010] Determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet screen to be displayed based on the splicing order.

[0011] Optionally, in a specific implementation, before obtaining a specified bitmap from the preset cache space as a target bitmap of the character to be displayed, the method further includes:

[0012] Retrieving the target bitmap of the character to be displayed from the target character bitmap created for the client;

[0013] If retrieved, the target bitmap of the character to be displayed is obtained from the target character bitmap;

[0014] Otherwise, a designated bitmap is obtained from the preset cache space as a target bitmap of the character to be displayed.

[0015] Optionally, in a specific implementation, before obtaining a specified bitmap from the preset cache space as a target bitmap of the character to be displayed, the method further includes:

[0016] Retrieving a target bitmap of the character to be displayed from a system character bitmap of an electronic device on which the client is installed;

[0017] If retrieved, the target bitmap of the character to be displayed is obtained from the system character bitmap;

[0018] Otherwise, a designated bitmap is obtained from the preset cache space as a target bitmap of the character to be displayed.

[0019] Optionally, in a specific implementation, the method further includes:

[0020] For each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space does not reach the specified capacity, the obtained target bitmap of the character to be displayed is stored in the preset cache space.

[0021] Optionally, in a specific implementation, the method further includes:

[0022] For each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space, and the capacity of the storage space used in the preset cache space reaches the specified capacity, the bitmap to be deleted in the preset cache space is determined; the bitmap to be deleted in the preset cache space is deleted, and the obtained target bitmap of the character to be displayed is stored in the preset cache space.

[0023] Optionally, in a specific implementation, the determining the bitmap to be deleted in the preset cache space includes:

[0024] Based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space, the bitmap to be deleted in the preset cache space is determined.

[0025] Optionally, in a specific implementation, the method further includes:

[0026] The usage count and / or the most recent usage time of each bitmap of the to-be-displayed character stored in the preset cache space is updated.

[0027] In a second aspect of an embodiment of the present invention, a bullet screen drawing device is provided, which is applied to a client, and the device includes:

[0028] A character acquisition module, used to acquire each character to be displayed included in the bullet screen to be displayed;

[0029] A bitmap retrieval module, for retrieving a target bitmap of each character to be displayed in a preset cache space of the client; if the target bitmap is found, the bitmap acquisition module is triggered; otherwise, the bitmap generation module is triggered;

[0030] The bitmap acquisition module is used to acquire the target bitmap of the character to be displayed from the preset cache space;

[0031] The bitmap generation module is used to obtain a specified bitmap from the preset cache space as a target bitmap of the character to be displayed;

[0032] The bullet screen drawing module is used to determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet screen to be displayed based on the splicing order.

[0033] Optionally, in a specific implementation, the device further includes:

[0034] The first generation module is used to retrieve the target bitmap of the character to be displayed from the target character bitmap created for the client before obtaining the specified bitmap from the preset cache space as the target bitmap of the character to be displayed; if retrieved, obtain the target bitmap of the character to be displayed from the target character bitmap; otherwise, trigger the bitmap generation module.

[0035] Optionally, in a specific implementation, the device further includes:

[0036] The second generating module is used to retrieve the target bitmap of the character to be displayed in the system character bitmap of the electronic device installed with the client before obtaining the specified bitmap from the preset cache space as the target bitmap of the character to be displayed; if retrieved, obtain the target bitmap of the character to be displayed from the system character bitmap; otherwise, trigger the bitmap generating module.

[0037] Optionally, in a specific implementation, the device further includes:

[0038] The bitmap storage module is used to store the obtained target bitmap of the character to be displayed in the preset cache space for each character to be displayed if the target bitmap of the character to be displayed is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space does not reach the specified capacity.

[0039] Optionally, in a specific implementation, the device further includes:

[0040] a to-be-deleted bitmap determination module, configured to, for each to-be-displayed character, if a target bitmap of the to-be-displayed character is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space reaches a specified capacity, determine the to-be-deleted bitmap in the preset cache space;

[0041] The bitmap deletion module is used to delete the bitmap to be deleted in the preset cache space, and store the obtained target bitmap of the character to be displayed in the preset cache space.

[0042] Optionally, in a specific implementation, the module for determining the bitmap to be deleted is specifically used to:

[0043] Based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space, the bitmap to be deleted in the preset cache space is determined.

[0044] Optionally, in a specific implementation, the device further includes:

[0045] The updating module is used to update the usage count and / or the most recent usage time of each bitmap of the to-be-displayed character stored in the preset cache space.

[0046] In the third aspect of the embodiments of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; the processor is used to implement any of the barrage drawing methods provided in the first aspect when executing the program stored in the memory.

[0047] In another aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the above-mentioned bullet screen drawing methods is implemented.

[0048] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned bullet screen drawing methods.

[0049] It can be seen from the above that by applying the solution provided by the embodiment of the present invention, when drawing the barrage, the client can obtain the various characters to be displayed included in the barrage to be displayed, so that for each character to be displayed, the target bitmap of the character to be displayed can be retrieved in the preset cache space of the above client. If the above bitmap is retrieved, the target bitmap of the character to be displayed can be obtained from the above preset cache space. If the above bitmap is not retrieved, the specified bitmap can be obtained from the preset cache space as the target bitmap of the character to be displayed. In this way, after determining the splicing order of the target bitmaps of each character to be displayed, the above barrage to be displayed is drawn based on the above splicing order.

[0050] Based on this, by applying the solution provided by the embodiment of the invention, a preset cache space for caching bitmaps of commonly used characters can be set in the client. In this way, if there are bitmaps of each character to be displayed included in the barrage to be displayed in the above-mentioned preset cache space, the bitmaps of each character to be displayed can be directly obtained without regenerating each bitmap, thereby improving the drawing efficiency of the barrage. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0052] Figure 1 A schematic diagram of a flow chart of a first bullet screen drawing method provided by an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of a flow chart of a second bullet screen drawing method provided by an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of a flow chart of a third bullet screen drawing method provided by an embodiment of the present invention;

[0055] Figure 4 A schematic diagram of a specific embodiment of the present invention;

[0056] Figure 5 A schematic diagram of a fourth bullet screen drawing method provided by an embodiment of the present invention;

[0057] Figure 6 A schematic diagram of a fifth bullet screen drawing method provided by an embodiment of the present invention;

[0058] Figure 7 A flowchart of another specific embodiment provided for an embodiment of the present invention;

[0059] Figure 8 A schematic diagram of the structure of a bullet screen drawing device provided by an embodiment of the present invention;

[0060] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0062] In the related art, after receiving the text content of the bullet screen to be displayed, the client can draw a bitmap that can be displayed in the video according to the text content, thereby displaying the bullet screen to be displayed in the video. However, as time goes by, the number of bullet screens appearing in each frame becomes larger and larger, that is, the number of bullet screens that the client needs to draw in each frame of the video becomes larger and larger, resulting in low efficiency of drawing bullet screens by the client.

[0063] In order to solve the above technical problem, an embodiment of the present invention provides a bullet screen drawing method.

[0064] Among them, the method can be applied to various application scenarios where barrage displays exist, such as barrages displayed in video software, barrages displayed in audio websites, etc. In addition, the method can be applied to various electronic devices such as laptops, tablet computers, desktop computers, etc., hereinafter referred to as electronic devices. Among them, the above-mentioned electronic devices are equipped with a client with a barrage display function. Based on this, the embodiment of the present invention does not limit the application scenario and execution subject of the method.

[0065] A bullet screen drawing method provided by an embodiment of the present invention is applied to a client and may include the following steps:

[0066] Obtaining each character to be displayed included in the bullet comment to be displayed;

[0067] For each character to be displayed, searching a target bitmap of the character to be displayed in a preset cache space of the client;

[0068] When retrieved, obtaining a target bitmap of the character to be displayed from the preset cache space;

[0069] Otherwise, obtaining a specified bitmap from the preset cache space as a target bitmap of the character to be displayed;

[0070] Determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet screen to be displayed based on the splicing order.

[0071] It can be seen from the above that by applying the solution provided by the embodiment of the present invention, when drawing the barrage, the client can obtain the various characters to be displayed included in the barrage to be displayed, so that for each character to be displayed, the target bitmap of the character to be displayed can be retrieved in the preset cache space of the above client. If the above bitmap is retrieved, the target bitmap of the character to be displayed can be obtained from the above preset cache space. If the above bitmap is not retrieved, the specified bitmap can be obtained from the preset cache space as the target bitmap of the character to be displayed. In this way, after determining the splicing order of the target bitmaps of each character to be displayed, the above barrage to be displayed is drawn based on the above splicing order.

[0072] Based on this, by applying the solution provided by the embodiment of the invention, a preset cache space for caching bitmaps of commonly used characters can be set in the client. In this way, if there are bitmaps of each character to be displayed included in the barrage to be displayed in the above-mentioned preset cache space, the bitmaps of each character to be displayed can be directly obtained without regenerating each bitmap, thereby improving the drawing efficiency of the barrage.

[0073] A bullet screen drawing method provided by an embodiment of the present invention is described in detail below with reference to the accompanying drawings.

[0074] Figure 1 A schematic diagram of a method for drawing a bullet screen provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method may include the following steps S101-S105.

[0075] S101: Acquire each character to be displayed included in the bullet screen to be displayed.

[0076] The bullet screen may generally include at least one character of various types such as text, numbers, etc. Therefore, when the client is playing a video or audio file waiting to be played, it can obtain the bullet screen to be displayed of the file to be played, thereby further obtaining each character to be displayed included in the bullet screen to be displayed.

[0077] Optionally, the bullet screen displayed in the client may be a bullet screen input by a user. Therefore, when receiving the bullet screen sent by the user, the client may divide the bullet screen to obtain the characters to be displayed included in the bullet screen.

[0078] Optionally, the barrage displayed in the client may include barrages sent by different users at different times, and the server providing services to the client may store the above barrages. Thus, when displaying each barrage, for the barrages sent by the user between the current moments, the above server can determine the stored barrages and send them to the client, so that the client divides the barrages and obtains the characters to be displayed included in the barrages.

[0079] S102: For each character to be displayed, retrieve the target bitmap of the character to be displayed in the preset cache space of the client; if retrieved, execute step S103; otherwise, execute step S104;

[0080] S103: Obtain the target bitmap of the character to be displayed from the preset cache space;

[0081] S104: Obtain a specified bitmap from the preset cache space as the target bitmap of the character to be displayed.

[0082] Since the text to be displayed in the bullet screen has strong repetitiveness, that is, commonly used characters may be displayed multiple times in a short period. Therefore, in order to improve the drawing efficiency of the bullet screen, a preset cache space can be set in advance in the client to store the bitmaps of commonly used characters of the user.

[0083] Among them, the commonly used characters of different users can be the same or different. Therefore, the bitmaps of the characters stored in the preset storage spaces of different clients can be the same or different. The embodiments of the present invention do not make specific limitations on this.

[0084] In this way, after the client obtains each character to be displayed included in the bullet screen to be displayed, it can retrieve the target bitmap of the character to be displayed in the preset cache space of the client for each character to be displayed.

[0085] Among them, if the target bitmap of the character to be displayed is retrieved, the client can obtain the target bitmap of the character to be displayed from the above-mentioned preset cache space;

[0086] On the contrary, if the target bitmap of the character to be displayed is not retrieved, the client can obtain a specified bitmap from the preset cache space as the target bitmap of the character to be displayed.

[0087] Among them, the above-mentioned specified bitmap can include bitmaps of symbols such as question marks and punctuation marks. The embodiments of the present invention do not make specific limitations on this.

[0088] For example, the preset cache space of the client stores bitmap A of the character "ha", bitmap B of the character "hao", bitmap C of the character "xiao", and specified bitmap Z. The text content of the bullet screen to be displayed is: "hahaha so funny", then each character to be displayed included in the bullet screen to be displayed includes "ha", "ha", "ha", "ha", "tai", "hao", "xiao", and "le".

[0089] For the character to be displayed "ha", retrieve the target bitmap of the character to be displayed "ha" in the preset cache space of the client. Since the target bitmap A of the character to be displayed "ha" is stored in the above-mentioned preset cache space, the above-mentioned target bitmap A can be directly obtained from the above-mentioned preset cache space.

[0090] Since the text content of the bullet screen to be displayed includes 4 characters "ha" to be displayed, for each character "ha" to be displayed, the target bitmap A can be obtained from the above-mentioned preset cache space, and thus, 4 target bitmaps A can be obtained.

[0091] For the character "tai" to be displayed, retrieve the target bitmap of the character "tai" to be displayed in the preset cache space of the client. Since the target bitmap of the character "tai" to be displayed is not stored in the above-mentioned preset cache space, the specified bitmap Z can be obtained from the preset cache space as the target bitmap of the character "tai" to be displayed.

[0092] For the character "hao" to be displayed, retrieve the target bitmap of the character "hao" to be displayed in the preset cache space of the client. Since the target bitmap B of the character "hao" to be displayed is stored in the above-mentioned preset cache space, the target bitmap B can be directly obtained from the above-mentioned preset cache space.

[0093] For the character "xiao" to be displayed, retrieve the target bitmap of the character "xiao" to be displayed in the preset cache space of the client. Since the target bitmap C of the character "xiao" to be displayed is stored in the above-mentioned preset cache space, the target bitmap C can be directly obtained from the above-mentioned preset cache space.

[0094] For the character "le" to be displayed, retrieve the target bitmap of the character "le" to be displayed in the preset cache space of the client. Since the target bitmap of the character "le" to be displayed is not stored in the above-mentioned preset cache space, the specified bitmap Z can be obtained from the preset cache space as the target bitmap of the character "le" to be displayed.

[0095] S105: Determine the splicing order of the target bitmaps of each character to be displayed, and draw the bullet screen to be displayed based on the splicing order.

[0096] After the client obtains the target bitmap of each character to be displayed, it can determine the order of each character to be displayed in the bullet screen to be displayed as the splicing order of the target bitmaps of each character to be displayed. Thus, the bullet screen to be displayed can be drawn based on the above splicing order.

[0097] For example, the text content of the barrage to be displayed is "It's so funny", wherein the characters to be displayed included in the barrage to be displayed include: the characters to be displayed "too", "good", "laugh" and "le". Therefore, it is determined that the target bitmap of the character "too" to be displayed is bitmap a, the target bitmap of the character "good" to be displayed is bitmap b, the target bitmap of the character "laugh" to be displayed is bitmap c and the target bitmap of the character "le" to be displayed is bitmap d. According to the above text content, the order of the above characters to be displayed can be determined as: "too", "good", "laugh", "le". Therefore, the splicing order of the above bitmap a, bitmap b, bitmap c and bitmap d can be determined as: bitmap a, bitmap b, bitmap c and bitmap d. In this way, the client can draw the barrage to be displayed "It's so funny" according to the above splicing order.

[0098] For another example, the designated bitmap z corresponds to a question mark, and the text content of the barrage to be displayed is "It's so funny, isn't it?" The characters to be displayed in the barrage to be displayed include: the characters to be displayed "too", the characters to be displayed "good", the characters to be displayed "laugh", the characters to be displayed "le" and the characters to be displayed "bar". Among them, it can be determined that the target bitmap of the character "too" to be displayed is bitmap a, the target bitmap of the character "good" to be displayed is the designated bitmap z, the target bitmap of the character "laugh" to be displayed is bitmap b, the target bitmap of the character "le" to be displayed is bitmap c, and the target bitmap of the character "bar" to be displayed is bitmap d. Therefore, it can be determined that the splicing order of the above bitmaps a, b, c, d and z is: bitmap a, bitmap z, bitmap b, bitmap c and bitmap d. In this way, the client can draw the barrage to be displayed "Too? It's funny, isn't it" according to the above splicing order.

[0099] Optionally, the drawn bullet screen to be displayed may be output for display.

[0100] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, when drawing the barrage, the client can obtain the various characters to be displayed included in the barrage to be displayed, so that for each character to be displayed, the target bitmap of the character to be displayed can be retrieved in the preset cache space of the above client. If the above bitmap is retrieved, the target bitmap of the character to be displayed can be obtained from the above preset cache space. If the above bitmap is not retrieved, a bitmap of the specified character can be generated as the target bitmap of the character to be displayed. In this way, after determining the splicing order of the target bitmaps of the characters to be displayed, the above barrage to be displayed is drawn based on the above splicing order.

[0101] Based on this, by applying the solution provided by the embodiment of the invention, a preset cache space for caching bitmaps of commonly used characters can be set in the client. In this way, if there are bitmaps of each character to be displayed included in the barrage to be displayed in the above-mentioned preset cache space, the bitmaps of each character to be displayed can be directly obtained without regenerating each bitmap, thereby improving the drawing efficiency of the barrage.

[0102] In order to improve the display effect of the barrage, specified modification information can be added to the drawn target bitmap, for example, additional information such as stroke information and special effect information. However, the additional information added to the target bitmap may affect the display effect of the barrage to be displayed. For example, the strokes of the characters will overlap each other, resulting in the characters to be displayed being blurred when displayed, resulting in poor display effect of the barrage. Therefore, in order to ensure that most characters have the same display effect in different electronic devices, a target character bitmap for storing preset language character bitmaps can be set in the client. In this way, when the target bitmap of the characters to be displayed of the barrage to be displayed is not retrieved in the preset cache space of the client, the target bitmap of the characters to be displayed can be retrieved from the above-mentioned target character bitmap.

[0103] Based on this, optionally, in a specific implementation, such as Figure 2 As shown, it is a flow chart of a bullet screen drawing method provided by an embodiment of the present invention. In a bullet screen drawing method provided by an embodiment of the present invention, before the above step S104, generating a bitmap of a specified character as a target bitmap of the character to be displayed, the following steps S201-S203 may be further included:

[0104] S201: Retrieving the target bitmap of the character to be displayed from the target character bitmap created for the client; if the target bitmap is found, executing step S202; otherwise, executing step S203;

[0105] S202: Acquire a target bitmap of the character to be displayed from the target character bitmap;

[0106] S203: Obtain a designated bitmap from a preset buffer space as a target bitmap of the character to be displayed.

[0107] In this specific implementation, for each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space of the client, the target bitmap of the character to be displayed can be retrieved from the target character bitmap created for the client.

[0108] If the character to be displayed is retrieved in the target character bitmap, the target bitmap for displaying the character can be obtained from the target character bitmap.

[0109] If the character to be displayed is not found in the target character bitmap, a designated bitmap may be obtained from a preset cache space as the target bitmap of the character to be displayed.

[0110] The specific implementation of step S203 is the same as that of step S104, which will not be described again.

[0111] In addition, in order to reduce the memory occupation of the target character bitmap on the client, the target character bitmap may store a Chinese character bitmap and / or an English character bitmap.

[0112] The embodiment of the present invention does not specifically limit the language type of the preset language character bitmap stored in the target character bitmap.

[0113] Optionally, the target character bitmap may store a Chinese character bitmap.

[0114] Optionally, the target character bitmap may store an English character bitmap.

[0115] Optionally, the target character bitmap may store Chinese character bitmaps and English character bitmaps.

[0116] Since the electronic devices installed on the client are different, the system character bitmaps of the electronic devices that can be read by the client are different.

[0117] Based on this, optionally, in a specific implementation, such as Figure 3 As shown, it is a flow chart of a bullet screen drawing method provided by an embodiment of the present invention. In a bullet screen drawing method provided by an embodiment of the present invention, before the above step S203, obtaining a specified bitmap from a preset cache space as a target bitmap of the character to be displayed, the following steps S301-S303 may be further included:

[0118] S301: searching the target bitmap of the character to be displayed in the system character bitmap of the electronic device installed with the client; if the target bitmap is found, executing step S302; otherwise, executing step S303;

[0119] S302: Obtaining a target bitmap of the character to be displayed from a system character bitmap;

[0120] S303: Obtain a designated bitmap from a preset buffer space as a target bitmap for the character to be displayed.

[0121] In this specific implementation, for each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space of the above-mentioned client, and the target bitmap of the character to be displayed is not retrieved in the target character bitmap created for the above-mentioned client, then the target bitmap of the character to be displayed can be retrieved in the system character bitmap of the electronic device on which the above-mentioned client is installed.

[0122] If the character to be displayed is retrieved in the system character bitmap, the target bitmap for displaying the character can be obtained from the system character bitmap.

[0123] If the character to be displayed is not found in the system character bitmap, a designated bitmap may be obtained from a preset buffer space as a target bitmap for the character to be displayed.

[0124] The system character bitmap may store various character bitmaps other than the target character bitmap, or may store various character bitmaps including the target character bitmap. This is not specifically limited in the embodiment of the present invention.

[0125] In addition, the specific implementation of the above step S303 is the same as that of the above step S203, which will not be repeated here.

[0126] Optionally, you can use the FreeType tool library to perform the above Figure 2 The steps S201-S203 shown and the above Figure 3 Steps S301-S303 are shown.

[0127] Among them, the so-called FreeType tool library is a completely free (open source), high-quality and portable font engine. It provides a unified interface to access multiple font format files, including TrueType, OpenType, Type1, CID, CFF, Windows FON / FNT, X11 PCF, etc.

[0128] For example, Figure 4 The figure is a flow chart of a specific embodiment provided by the embodiment of the present invention.

[0129] in, Figure 4 The unified font library in is the target character bitmap of the embodiment of the present invention; Figure 4 The system universal font library in is the system character bitmap in the embodiment of the present invention.

[0130] If the target bitmap of the character to be displayed is not retrieved in the preset cache space of the client, the FreeType tool library can be used to retrieve the target bitmap of the character to be displayed in the unified font library. If the target bitmap of the character to be displayed is not retrieved in the above-mentioned unified font library, the target bitmap of the character to be displayed can be retrieved in the system character bitmap of the electronic device on which the client is installed.

[0131] After retrieving the target bitmap of the character to be displayed, the FreeType tool library can obtain the target bitmap. After obtaining the target bitmap, it can also add specified modification information to the target bitmap, such as additional information such as stroke information and special effect information.

[0132] In some cases, the target bitmap of the character to be displayed is not stored in the above-mentioned preset cache space. Therefore, after obtaining the target bitmap of the character to be displayed, in order to avoid repeatedly drawing the same character in a short period of time, the obtained target bitmap of the character to be displayed can be stored in the above-mentioned preset cache space.

[0133] Based on this, optionally, in a specific implementation, such as Figure 5 FIG. 5 is a flow chart of a bullet screen drawing method provided by an embodiment of the present invention. The bullet screen drawing method provided by an embodiment of the present invention may further include the following step S501:

[0134] S501: For each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space does not reach the specified capacity, the obtained target bitmap of the character to be displayed is stored in the preset cache space.

[0135] In this specific implementation, for each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the above preset cache space, it can be determined whether the capacity of the storage space used in the above preset cache space reaches the specified capacity of the preset cache space.

[0136] If the capacity of the storage space used in the preset cache space does not reach the specified capacity, the obtained target bitmap of the character to be displayed may be stored in the preset cache space.

[0137] If the capacity of the storage space used in the preset cache space reaches the specified capacity, a bitmap to be deleted may be selected from each bitmap stored in the preset cache space for deletion.

[0138] Based on this, optionally, in a specific implementation, such as Figure 6As shown, it is a flowchart of a bullet screen drawing method provided by an embodiment of the present invention. The bullet screen drawing method provided by an embodiment of the present invention may also include the following steps S601-S602:

[0139] S601: for each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space, and the capacity of the storage space used in the preset cache space reaches the specified capacity, then determine the bitmap to be deleted in the preset cache space;

[0140] S602: deleting the bitmap to be deleted in the preset cache space, and storing the obtained target bitmap of the character to be displayed in the preset cache space.

[0141] In this specific implementation, for each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the above-mentioned preset cache space, and the capacity of the storage space used in the preset cache space reaches the specified capacity, then the bitmap to be deleted can be determined in the above-mentioned preset cache space. Thus, after deleting the bitmap to be deleted in the above-mentioned preset cache space, the client can store the obtained target bitmap of the character to be displayed in the preset cache space, so as to facilitate reading the target bitmap of the character to be displayed again.

[0142] When reading and using a bitmap in a preset cache space, the client may record the number of times the bitmap is used and the most recent time the bitmap is used, so as to subsequently determine a bitmap to be deleted in the preset cache space.

[0143] Based on this, optionally, in a specific implementation, in the above step S601, the step of determining the bitmap to be deleted in the preset cache space may include the following step 6011:

[0144] Step 6011: Determine the bitmap to be deleted in the preset cache space based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space.

[0145] In this specific implementation, when the client reads and uses a bitmap in a preset cache space, it can record the number of times the bitmap is used and the last time the bitmap was used. Thus, based on the number of times each bitmap in the preset cache space recorded by the client, and / or the last time of use, the bitmap with the least number of uses and / or the last time of use with the longest time interval from the current time of use can be determined as the bitmap to be deleted.

[0146] For example, based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space, the bitmap to be deleted in the preset cache space is determined using an LRU (Least Recently Used) algorithm.

[0147] Optionally, the client determines the bitmap with the least usage times as the bitmap to be deleted in the preset cache space based on the recorded usage times of each bitmap in the preset cache space.

[0148] Optionally, based on the recorded most recent use time of each bitmap in the preset cache space, the client determines the bitmap with the most recent use time having the longest time interval from the current use time as the bitmap to be deleted in the preset cache space.

[0149] Optionally, the client determines the bitmap to be deleted in the preset cache space based on the recorded usage counts and most recent usage time of each bitmap in the preset cache space and comprehensively considers the usage counts and most recent usage time.

[0150] Optionally, in a specific implementation, a bullet screen drawing method provided by an embodiment of the present invention may further include the following step 11:

[0151] Step 11: updating the usage count and / or the most recent usage time of each bitmap of the character to be displayed stored in the preset cache space.

[0152] In this specific implementation, after the target bitmap is determined, the usage count and / or the most recent usage time of each bitmap of the to-be-displayed character in the preset cache space may be updated.

[0153] Optionally, the usage count of each bitmap of the to-be-displayed character stored in the preset cache space is updated.

[0154] Optionally, the most recent usage time of each bitmap of the character to be displayed stored in the preset cache space is updated.

[0155] Optionally, the usage count and the most recent usage time of each bitmap of the to-be-displayed character stored in the preset cache space are updated.

[0156] For example, the preset cache space stores bits Figure 1 ,Bit Figure 2 and position Figure 3 , where Figure 1 The number of times it has been used is 5, and the last time it was used was 13:10:05 on October 31, 2022; Figure 2 The number of times it has been used is 2, and the last time it was used was 10:11:11 on October 31, 2022; Figure 3 The number of times it has been used is 2, and the last time it was used was on October 29, 2022 at 13:10:05.

[0157] If at 14:10:05 on October 29, 2022, Figure 3is determined as the target bitmap of the character to be displayed. Figure 3 The usage count of is increased by 1, and after the usage count is updated, the position Figure 3 The number of times used is 3. At the same time, Figure 3 The last usage time was updated to October 29, 2022 at 14:10:05.

[0158] In order to improve the display effect of the bullet screen, specified modification information may be added to the drawn target bitmap, for example, additional information such as stroke information and special effect information.

[0159] Therefore, optionally, in a specific implementation, a bullet screen drawing method provided by an embodiment of the present invention may further include the following step 22:

[0160] Step 22: Perform a specified modification operation on the drawn bullet comment to be displayed, obtain a target bullet comment, and output the target bullet comment.

[0161] In this specific implementation, after drawing the barrage to be displayed, in order to improve the display effect of the barrage, a specified modification operation can be performed on each target bitmap of the barrage to be displayed, thereby obtaining the target barrage, and then outputting the target barrage for display.

[0162] The specified modification operation may include an operation for adding a stroke to the target bitmap, or may include an operation for adding a fluorescent effect to the target bitmap. This is not specifically limited in the embodiment of the present invention.

[0163] For example, after drawing the bullet screen P to be displayed, based on the user operation, a stroke operation can be performed on each target bitmap of the bullet screen P to be displayed to obtain the target bullet screen P, and the target bullet screen P is output and displayed.

[0164] The above user operation may include a user's point selection operation or a user's input operation, which is not specifically limited in the embodiment of the present invention.

[0165] In order to facilitate understanding of the embodiments of the present invention, for example, Figure 7 The figure is a flow chart of another specific embodiment provided by the embodiment of the present invention.

[0166] in, Figure 7 The buffer pool shown is the preset buffer space of the embodiment of the present invention. Figure 7 The read character texture is the target bitmap for obtaining the characters to be displayed in the embodiment of the present invention.

[0167] When drawing a bullet screen, the client can determine whether the character texture of the character to be displayed is stored in the cache pool. If so, the character texture of the character to be displayed is read from the cache pool; otherwise, the character texture of the character to be displayed can be read using the cache pool. Figure 2 The steps shown in steps S201-S203, and / or the above Figure 3 In the step flow shown in steps S301 - S303 , the character texture of the character to be displayed is obtained.

[0168] It is determined whether the capacity of the storage space used in the buffer pool does not reach the specified capacity.

[0169] If the capacity of the storage space used in the buffer pool does not reach the specified capacity, the character texture of the character to be displayed is stored in the buffer pool.

[0170] If the capacity of the storage space used in the above-mentioned cache pool reaches the above-mentioned specified capacity, the LRU algorithm can be used to determine the bitmap to be deleted. After deleting the determined bitmap to be deleted, the character texture of the character to be displayed that does not exist in the above-mentioned cache pool can be stored in the above-mentioned cache pool, and the character texture of the character to be displayed can be read to complete the drawing of the barrage to be displayed.

[0171] Corresponding to the bullet screen drawing method provided by the above-mentioned embodiment of the present invention, the embodiment of the present invention further provides a bullet screen drawing device, which is applied to a client.

[0172] Figure 8 A structural diagram of a bullet screen drawing device provided by an embodiment of the present invention is shown in FIG. Figure 8 As shown, the device includes the following modules:

[0173] The character acquisition module 810 is used to acquire each character to be displayed included in the bullet screen to be displayed;

[0174] The bitmap retrieval module 820 is used to retrieve the target bitmap of each character to be displayed in the preset cache space of the client; if the target bitmap is found, the bitmap acquisition module 830 is triggered; otherwise, the bitmap generation module 840 is triggered;

[0175] The bitmap acquisition module 830 is used to acquire the target bitmap of the character to be displayed from the preset cache space;

[0176] The bitmap generation module 840 is used to generate a bitmap of a specified character as a target bitmap of the character to be displayed;

[0177] The bullet-screen drawing module 850 is used to determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet-screen to be displayed based on the splicing order.

[0178] As can be seen from the above, by applying the solution provided by the embodiment of the present invention, when drawing the barrage, the client can obtain the various characters to be displayed included in the barrage to be displayed, so that for each character to be displayed, the target bitmap of the character to be displayed can be retrieved in the preset cache space of the above client. If the above bitmap is retrieved, the target bitmap of the character to be displayed can be obtained from the above preset cache space. If the above bitmap is not retrieved, a bitmap of the specified character can be generated as the target bitmap of the character to be displayed. In this way, after determining the splicing order of the target bitmaps of the characters to be displayed, the above barrage to be displayed is drawn based on the above splicing order.

[0179] Based on this, by applying the solution provided by the embodiment of the invention, a preset cache space for caching bitmaps of commonly used characters can be set in the client. In this way, if there are bitmaps of each character to be displayed included in the barrage to be displayed in the above-mentioned preset cache space, the bitmaps of each character to be displayed can be directly obtained without regenerating each bitmap, thereby improving the drawing efficiency of the barrage.

[0180] Optionally, in a specific implementation, the device further includes:

[0181] The first generating module is used to retrieve the target bitmap of the character to be displayed in the target character bitmap created for the client before generating the bitmap of the specified character as the target bitmap of the character to be displayed; if retrieved, obtain the target bitmap of the character to be displayed from the target character bitmap; otherwise, trigger the bitmap generating module 840.

[0182] Optionally, in a specific implementation, the device further includes:

[0183] The second generating module is used to retrieve the target bitmap of the character to be displayed from the system character bitmap of the electronic device installed with the client before generating the bitmap of the specified character as the target bitmap of the character to be displayed; if retrieved, obtain the target bitmap of the character to be displayed from the system character bitmap; otherwise, trigger the bitmap generating module 840.

[0184] Optionally, in a specific implementation, the device further includes:

[0185] The bitmap storage module is used to store the obtained target bitmap of the character to be displayed in the preset cache space for each character to be displayed if the target bitmap of the character to be displayed is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space does not reach the specified capacity.

[0186] Optionally, in a specific implementation, the device further includes:

[0187] a to-be-deleted bitmap determination module, configured to, for each to-be-displayed character, if a target bitmap of the to-be-displayed character is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space reaches a specified capacity, determine the to-be-deleted bitmap in the preset cache space;

[0188] The bitmap deletion module is used to delete the bitmap to be deleted in the preset cache space, and store the obtained target bitmap of the character to be displayed in the preset cache space.

[0189] Optionally, in a specific implementation, the module for determining the bitmap to be deleted is specifically used to:

[0190] Based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space, the bitmap to be deleted in the preset cache space is determined.

[0191] Optionally, in a specific implementation, the device further includes:

[0192] The updating module is used to update the usage count and / or the most recent usage time of each bitmap of the to-be-displayed character stored in the preset cache space.

[0193] Corresponding to the bullet screen drawing method provided by the above embodiment of the present invention, the embodiment of the present invention also provides an electronic device, such as Fig. 9 As shown, it includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.

[0194] Memory 903, used for storing computer programs;

[0195] The processor 901 is used to implement the steps of any bullet screen drawing method provided by the above-mentioned embodiments of the present invention when executing the program stored in the memory 903.

[0196] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0197] The communication interface is used for communication between the above terminal and other devices.

[0198] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0199] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0200] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the bullet screen drawing method described in any of the above embodiments is implemented.

[0201] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute the bullet screen drawing method described in any one of the above embodiments.

[0202] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0203] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0204] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0205] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A bullet screen drawing method, characterized in that: Applied to a client, the method comprises: Obtaining each character to be displayed included in the bullet comment to be displayed; For each character to be displayed, searching a target bitmap of the character to be displayed in a preset cache space of the client; If retrieved, the target bitmap of the character to be displayed is obtained from the preset cache space; Otherwise, obtaining a specified bitmap from the preset cache space as a target bitmap of the character to be displayed; Determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet screen to be displayed based on the splicing order; The designated bitmap is a bitmap of designated symbols, and the designated symbols include question marks or commas.

2. The method according to claim 1, characterized in that Before obtaining a designated bitmap from the preset cache space as a target bitmap of the character to be displayed, the method further includes: Retrieving the target bitmap of the character to be displayed from the target character bitmap created for the client; If retrieved, the target bitmap of the character to be displayed is obtained from the target character bitmap; Otherwise, a designated bitmap is obtained from the preset cache space as a target bitmap of the character to be displayed.

3. The method according to claim 2, characterized in that Before obtaining a designated bitmap from the preset cache space as a target bitmap of the character to be displayed, the method further includes: Retrieving a target bitmap of the character to be displayed from a system character bitmap of an electronic device on which the client is installed; If retrieved, the target bitmap of the character to be displayed is obtained from the system character bitmap; Otherwise, a designated bitmap is obtained from the preset cache space as a target bitmap of the character to be displayed.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: For each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space and the capacity of the storage space used in the preset cache space does not reach the specified capacity, the obtained target bitmap of the character to be displayed is stored in the preset cache space.

5. The method according to claim 4, characterized in that The method further comprises: For each character to be displayed, if the target bitmap of the character to be displayed is not retrieved in the preset cache space, and the capacity of the storage space used in the preset cache space reaches the specified capacity, the bitmap to be deleted in the preset cache space is determined; the bitmap to be deleted in the preset cache space is deleted, and the obtained target bitmap of the character to be displayed is stored in the preset cache space.

6. The method according to claim 5, characterized in that The determining the bitmap to be deleted in the preset cache space includes: Based on the recorded usage count and / or most recent usage time of each bitmap in the preset cache space, the bitmap to be deleted in the preset cache space is determined.

7. The method according to claim 6, characterized in that The method further comprises: The usage count and / or the most recent usage time of each bitmap of the to-be-displayed character stored in the preset cache space is updated.

8. A bullet screen drawing device, characterized in that: Applied to a client, the device comprises: A character acquisition module, used to acquire each character to be displayed included in the bullet screen to be displayed; A bitmap retrieval module, for retrieving a target bitmap of each character to be displayed in a preset cache space of the client; if the target bitmap is found, the bitmap acquisition module is triggered; otherwise, the bitmap generation module is triggered; The bitmap acquisition module is used to acquire the target bitmap of the character to be displayed from the preset cache space; The bitmap generation module is used to obtain a specified bitmap from the preset cache space as a target bitmap of the character to be displayed; A bullet screen drawing module, used to determine the splicing order of the target bitmaps of the characters to be displayed, and draw the bullet screen to be displayed based on the splicing order; The designated bitmap is a bitmap of designated symbols, and the designated symbols include question marks or commas.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Bullet screen generation method and device, electronic equipment and storage medium

    CN110784773A

  • Image output apparatus

    JP1997001875A