CN115842906A - Picture block display method and device, electronic equipment and storage medium - Google Patents

Picture block display method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115842906A
CN115842906A CN202211502969.XA CN202211502969A CN115842906A CN 115842906 A CN115842906 A CN 115842906A CN 202211502969 A CN202211502969 A CN 202211502969A CN 115842906 A CN115842906 A CN 115842906A
Authority
CN
China
Prior art keywords
color information
target
tile
storage space
displayed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211502969.XA
Other languages
Chinese (zh)
Inventor
王睿宇
杜帧帧
赵佳慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongyuan Network Co ltd
Original Assignee
Shanghai Zhongyuan Network Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongyuan Network Co ltd filed Critical Shanghai Zhongyuan Network Co ltd
Priority to CN202211502969.XA priority Critical patent/CN115842906A/en
Publication of CN115842906A publication Critical patent/CN115842906A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the disclosure relates to a method and a device for displaying image blocks, electronic equipment and a storage medium, wherein the method comprises the following steps: detecting a tile display operation; under the condition that the image block display operation is detected, determining whether target first color information of a target image block displayed by the image block display operation instruction is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed; under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space; and displaying the target image block according to the color indicated by the target first color information. By the method, the color richness of the image blocks can be improved.

Description

Picture block display method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for displaying a graphic block, an electronic device, and a storage medium.
Background
Currently, the color of a tile in an application is typically set by the user or the product side. For example, the background color of each tile displayed in existing applications is typically the same. The background color refers to the color of the region of the tile except for the image. And the background color of each image block is uniformly set by a user, or is uniformly set in the application development process.
Therefore, the color of the image blocks in the prior art is single, and the color richness is lacked.
Disclosure of Invention
In view of the above, in order to solve some or all of the above technical problems, embodiments of the present disclosure provide a method and an apparatus for displaying a tile, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for displaying a tile, where the method includes:
detecting a tile display operation;
under the condition that the image block display operation is detected, determining whether target first color information of a target image block displayed by the image block display operation instruction is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed;
under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space;
and displaying the target image block according to the color indicated by the target first color information.
In a possible embodiment, the preset storage space stores the first color information by the following processing method:
determining second color information of an image in a picture block to be displayed;
determining first color information of the tile to be displayed based on the second color information;
and storing the determined first color information into a preset storage space.
In one possible embodiment, the method further comprises:
determining the number of single-screen displays of a target application, wherein the number of single-screen displays represents the number of image blocks of the single-screen display of the target application;
determining a target number based on the single-screen display number, wherein the target number represents the number of first color information to be determined in parallel;
and determining the target number of first color information in parallel by adopting the processing mode so as to store the target number of first color information to the preset storage space.
In one possible embodiment, the preset storage space updates the first color information as follows:
determining the storage duration of the first color information in the preset storage space;
and deleting the first color information with the storage duration being greater than or equal to the preset duration from the preset storage space.
In one possible embodiment, after the obtaining the target first color information from the preset storage space, the method further includes at least one of:
deleting the acquired first color information from the preset storage space;
and storing the determined new first color information to the preset storage space by adopting the processing mode.
In one possible embodiment, the determining second color information of the image in the tile to be displayed includes:
and determining second color information of the image in the image block to be displayed by adopting at least one of a median segmentation algorithm and a K-means clustering algorithm.
In one possible embodiment, the determining, in a case that the tile display operation is detected, whether target first color information of a target tile displayed by the tile display operation instruction is stored in a preset storage space includes:
in the case that the tile display operation is detected, determining whether a target tile displayed by the tile display operation indication is used for being displayed on a head screen of a target application;
and under the condition that the target image block is not used for being displayed on the head screen, determining whether target first color information of the target image block displayed by the image block display operation indication is stored in a preset storage space.
In one possible implementation, after the determining whether the tile display operation indicates that the displayed target tile is used for displaying on the first screen of the target application, the method further includes:
displaying the pre-rendered target tile if the target tile is for display at the home screen.
In one possible embodiment, after the determining whether the preset storage space stores the target first color information of the target tile displayed by the tile display operation indication, the method further includes:
determining third color information of an image in the target image block under the condition that the target first color information is not stored in the preset storage space;
determining fourth color information for the target tile based on the third color information;
and displaying the target image block according to the color indicated by the fourth color information.
In a second aspect, embodiments of the present disclosure provide a tile display device, the device comprising:
a detection unit for detecting a tile display operation;
a first determination unit, configured to determine, in a case that the tile display operation is detected, whether target first color information of a target tile indicated to be displayed by the tile display operation is stored in a preset storage space, where the preset storage space is used to store in advance the first color information of the tile to be displayed, and the first color information is determined based on second color information of an image in the tile to be displayed;
an obtaining unit, configured to obtain the target first color information from the preset storage space when the target first color information is stored in the preset storage space;
and the first display unit is used for displaying the target image block according to the color indicated by the target first color information.
In a possible embodiment, the preset storage space stores the first color information by the following processing method:
determining second color information of an image in a picture block to be displayed;
determining first color information of the tile to be displayed based on the second color information;
and storing the determined first color information into a preset storage space.
In one possible embodiment, the apparatus further comprises:
the second determination unit is used for determining the number of single-screen displays of the target application, wherein the number of the single-screen displays represents the number of image blocks of the single-screen displays of the target application;
a third determining unit, configured to determine a target number based on the single-screen display number, where the target number represents a number of first color information to be determined in parallel;
and the fourth determining unit is used for determining the target number of first color information in parallel by adopting the processing mode so as to store the target number of first color information into the preset storage space.
In one possible embodiment, the preset storage space updates the first color information as follows:
determining the storage duration of the first color information in the preset storage space;
and deleting the first color information with the storage duration being greater than or equal to the preset duration from the preset storage space.
In a possible embodiment, after the obtaining the target first color information from the preset storage space, the apparatus further includes at least one of:
a deleting unit configured to delete the acquired first color information from the preset storage space;
and the storage unit is used for storing the determined new first color information to the preset storage space by adopting the processing mode.
In one possible embodiment, the determining second color information of the image in the tile to be displayed includes:
and determining second color information of the image in the image block to be displayed by adopting at least one of a median segmentation algorithm and a K-means clustering algorithm.
In one possible embodiment, the determining, in a case that the tile display operation is detected, whether target first color information of a target tile indicated to be displayed by the tile display operation is stored in a preset storage space includes:
in the case that the tile display operation is detected, determining whether a target tile displayed by the tile display operation indication is used for being displayed on a head screen of a target application;
and under the condition that the target image block is not used for being displayed on the head screen, determining whether target first color information of the target image block displayed by the image block display operation indication is stored in a preset storage space.
In one possible embodiment, after the determining whether the tile display operation indicates that the displayed target tile is used for displaying on the first screen of the target application, the apparatus further includes:
and the second display unit is used for displaying the target image block which is rendered in advance under the condition that the target image block is used for being displayed on the head screen.
In one possible embodiment, after the determining whether the preset storage space stores the target first color information of the target tile displayed by the tile display operation indication, the apparatus further includes:
a fifth determining unit, configured to determine third color information of an image in the target tile if the target first color information is not stored in the preset storage space;
a sixth determining unit configured to determine fourth color information of the target tile based on the third color information;
and the third display unit is used for displaying the target image block according to the color indicated by the fourth color information.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
a memory for storing a computer program;
a processor configured to execute the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the tile display method of the first aspect of the disclosure is implemented.
In a fourth aspect, the disclosed embodiments provide a computer-readable storage medium, which when executed by a processor, implements the method of any one of the embodiments of the tile display method of the first aspect described above.
In a fifth aspect, embodiments of the present disclosure provide a computer program comprising computer readable code which, when run on a device, causes a processor in the device to execute instructions for implementing the steps in the method according to any one of the embodiments of the tile display method of the first aspect described above.
The tile block display method provided by the embodiment of the disclosure may detect a tile block display operation, and then determine whether a preset storage space stores target first color information of a target tile block displayed by the tile block display operation instruction when the tile block display operation is detected, where the preset storage space is used to store the first color information of the tile block to be displayed in advance, the first color information is determined based on second color information of an image in the tile block to be displayed, then, when the target first color information is stored in the preset storage space, obtain the target first color information from the preset storage space, and then, display the target tile block according to a color indicated by the target first color information. According to the method, the first color information of the image block to be displayed can be determined based on the second color information of the image in the image block to be displayed, and therefore the color richness of the image block is improved.
Drawings
Fig. 1 is a schematic flowchart of a method for displaying a block according to an embodiment of the disclosure;
FIG. 2 is a schematic flow chart diagram illustrating another method for displaying image blocks according to an embodiment of the present disclosure;
fig. 3A is a schematic flowchart of another method for displaying tiles according to an embodiment of the present disclosure;
fig. 3B is a schematic diagram of a block provided in an embodiment of the disclosure;
fig. 3C is a schematic diagram illustrating an implementation of converting RGB into HSV according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a tile display device according to an embodiment of the disclosure;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of parts and steps, numerical expressions, and values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
It will be understood by those within the art that the terms "first," "second," and the like in the embodiments of the present disclosure are used merely to distinguish one object, step, device, or module from another object, and do not denote any particular technical meaning or logical order therebetween.
It is also understood that in the present embodiment, "a plurality" may mean two or more, and "at least one" may mean one, two or more.
It is also to be understood that any reference to any component, data, or structure in the embodiments of the disclosure, may be generally understood as one or more, unless explicitly defined otherwise or stated otherwise.
In addition, the term "and/or" in the present disclosure is only one kind of association relationship describing an associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the former and latter associated objects are in an "or" relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and the same or similar parts may be referred to each other, so that the descriptions thereof are omitted for brevity.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail, but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be discussed further in subsequent figures.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. For the purpose of facilitating an understanding of the embodiments of the present disclosure, the present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments. It is to be understood that the described embodiments are only a few, and not all, of the disclosed embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Fig. 1 is a schematic flowchart of a method for displaying a block according to an embodiment of the present disclosure. The method can be applied to one or more electronic devices such as smart phones, notebook computers, desktop computers, portable computers and servers. In addition, the execution main body of the method can be hardware or software. When the execution main body is hardware, the execution main body may be one or more of the electronic devices. For example, a single electronic device may perform the method, or multiple electronic devices may cooperate with each other to perform the method. When the execution subject is software, the method may be implemented as a plurality of software or software modules, or may be implemented as a single software or software module. And is not particularly limited herein.
As shown in fig. 1, the method specifically includes:
101. tile display operations are detected.
In this embodiment, the tile display operation may be used to display a tile. As an example, the tile display operation may be an access operation performed on a page for displaying a tile; alternatively, the tile display operation may be a slide operation performed on a page for displaying a tile. Wherein the displayed tile may be updated by performing a sliding operation.
In a page for displaying tiles, one or more tiles may be displayed. In addition, the number of the tiles displayed on the page may be a fixed value or a value determined based on the screen size of the terminal and the size of the tiles.
An image may be included in the tile. Optionally, the image blocks may also include text. The tiles may have a background color. A tile may be an information element in an information stream. Through the image blocks, news, products, videos and other information (such as image-text block information) can be displayed.
102. And under the condition that the image block display operation is detected, determining whether a preset storage space is stored with target first color information of a target image block displayed by the image block display operation indication, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on the second color information of the image in the image block to be displayed.
In this embodiment, the preset storage space may be any preset storage space. The first color information in the preset storage space may be stored before the step 102 is executed. As an example, the preset storage space may be a cache.
The first color information may represent a color of the tile. As an example, the first color information may represent a background color of the tile, a color of the transparent coating, and the like. In some cases, the first color information may be represented by an HSV (Hue Saturation Value) Value.
The target tile can be a tile displayed by the tile display operation indication.
The target first color information may be first color information of the target tile.
The second color information may be color information of an image in a tile to be displayed. As an example, the second color information may represent a dominant color, a boundary color, or the like of an image in a tile to be displayed. The dominant color of the image may represent the color of the area with the largest proportion in the image. In some cases, the second color information may be represented by RGB (Red Green Blue, hong Lulan) values.
The block to be displayed may be a block to be displayed by an execution subject of the method. In practice, the block to be displayed may be a block determined based on the account number registered to the execution subject. As an example, the tiles to be displayed may be determined for the user by using a preset push algorithm based on the account number logged into the execution subject.
103. And under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space.
104. And displaying the target image block according to the color indicated by the target first color information.
In some optional implementation manners of this embodiment, the preset storage space may store the first color information by using the following processing manners:
first, second color information of an image in a tile to be displayed is determined.
Then, based on the second color information, first color information of the picture block to be displayed is determined.
As an example, the second color information may be determined as the first color information of the tile to be displayed.
As another example, in a case where the first color information is represented by HSV values and the second color information is represented by RGB values, the first color information of the tile to be displayed may be determined based on the second color information in the following manner:
first, the RGB values representing the second color information are converted into HSV values.
Then, the H value is kept unchanged for the converted HSV value. If the S value is greater than 65, the S value is determined to be 65. If the S value is less than 20, the S value is determined to be 20. If the S value is less than or equal to 65 and greater than or equal to 20, the S value remains unchanged. If the V value is greater than 40, the V value is determined to be 40. If the V value is less than 20, the V value is determined to be 20. If the V value is less than or equal to 40 and greater than or equal to 20, the V value remains unchanged.
And then, storing the determined first color information into a preset storage space.
It is understood that in the above alternative implementation, the first color information which is closer to the color represented by the second color information and has light color, black and white, and the like can be obtained.
In some application scenarios in the above optional implementation manners, the following steps may also be performed:
first, the number of single screen displays of the target application is determined.
Wherein the number of single screen displays characterizes a number of tiles of a single screen display of the target application. The single-screen display number may be a fixed numerical value or a numerical value that varies depending on the screen size of the terminal and the size of the tile.
The target application may be an application for displaying the tiles. By way of example, the target application may include, but is not limited to, one of: shopping software, video playing software, an information pushing platform and the like.
Then, based on the single-screen display number, the target number is determined.
Wherein the target number characterizes a number of first color information to be determined in parallel.
For example, the number of single-screen displays may be determined as the target number, or a preset multiple (e.g., 2 times) of the number of single-screen displays may be determined as the target number.
In some cases, the number of targets may be greater than the number of single screen displays.
Then, the target number of first color information is determined in parallel by adopting the processing mode, so that the target number of first color information is stored in the preset storage space.
It can be understood that, in the above application scenario, the target number of first color information may be determined in parallel, thereby increasing the speed of calculating the first color information. In addition, under the condition that the target number is larger than the single-screen display number, the probability that the first color information of the image blocks displayed by the image block display operation indication is stored in the preset storage space can be improved, and therefore the display speed of the image blocks is improved.
In some application scenarios in the above optional implementation manners, the preset storage space updates the first color information in the following manner:
firstly, the storage duration of the first color information in the preset storage space is determined.
And then, deleting the first color information with the storage duration being greater than or equal to the preset duration from the preset storage space.
It can be understood that, in the application scenario, when the storage duration of the first color information is long, the first color information may be deleted so as to clear the preset storage space, so that other first color information is stored therein.
In some application scenarios in the above alternative implementation, after the step 103 is executed, at least one of the following steps may also be executed:
step one, deleting the acquired first color information from the preset storage space.
And step two, storing the determined new first color information to the preset storage space by adopting the processing mode.
It can be understood that, through the first step, the timeliness of deleting the acquired first color information from the preset storage space can be improved, so that the deleted storage space is used for storing new first color information. Through the second step, the timeliness of storing the determined first color information into the preset storage space can be improved, so that new first color information can be acquired from the preset storage space in the following process and used for displaying the image blocks.
In some application scenarios in the above-described alternative implementation, the second color information of the image in the tile to be displayed may be determined as follows:
and determining second color information of the image in the image block to be displayed by adopting at least one of a median segmentation algorithm and a K-means clustering algorithm.
As an example, a median cut algorithm (median cut) may be adopted, and all pixels of the image in the tile to be displayed are firstly mapped to the RGB cuboid space, the longest edge of the cuboid is found, and the image is cut from the median. So that the number of pixels of the two divided blocks is basically the same. Repeating the segmentation process to finally obtain the desired color quantity cuboids, wherein the mean value of the RGB values in each cuboid region is the target color value of the region. It may be set to obtain 5 (or other numerical values) theme colors, and then select the color value with the largest proportion as the second color information.
As still another example, the color information indicated by the cluster center may be determined as the second color information by using a K-means clustering algorithm.
In some cases, the second color information of the images in the tiles to be displayed may also be determined based on results of both the median cut algorithm and the K-means clustering algorithm.
It can be understood that, in the application scenario, at least one of the median segmentation algorithm and the K-means clustering algorithm is used to determine the second color information of the image in the image block to be displayed, so that the accuracy of determining the second color information can be improved.
In some optional implementations of this embodiment, after the step 102 is performed, the following steps may also be performed:
first, in a case that the target first color information is not stored in the preset storage space, third color information of an image in the target tile is determined.
The third color information may be color information of an image in the target tile. As an example, the third color information may represent a dominant color of the image in the target tile. The dominant color of the image may represent the color of the area with the largest proportion in the image. In some cases, the third color information may be represented using RGB values.
The third color information is different from the second color information in that the second color information is color information of an image in any one of the tiles, and the third color information is color information of an image in the target tile.
Then, fourth color information of the target tile is determined based on the third color information.
The fourth color information may be color information of the target tile. As an example, the fourth color information may represent a color of the target tile. As an example, the fourth color information may represent a background color of the target tile, a color of the transparent coating, and the like. In some cases, the fourth color information may be represented using HSV values.
The fourth color information is different from the first color information in that the first color information is color information of any tile, and the fourth color information is color information of a target tile.
Then, the target tile is displayed according to the color indicated by the fourth color information.
In some cases of the present disclosure, the execution priority of the step of "determining fourth color information of the target tile based on the third color information" may be higher than the execution priority of the step of "determining first color information of the tile to be displayed based on the second color information", so that color information of a tile that needs to be displayed at present may be preferentially calculated to increase the display speed.
It can be understood that, in the above application scenario, in the case that the target first color information is not stored in the preset storage space, the fourth color information of the target tile is determined according to the third color information of the image in the target tile, and the target tile is displayed according to the color indicated by the fourth color information, so that the tile display in the case that the target first color information is not stored in the preset storage space can be realized.
The tile block display method provided by the embodiment of the disclosure may detect a tile block display operation, and then determine whether a preset storage space stores target first color information of a target tile block displayed by the tile block display operation instruction when the tile block display operation is detected, where the preset storage space is used to store the first color information of the tile block to be displayed in advance, the first color information is determined based on second color information of an image in the tile block to be displayed, then, when the target first color information is stored in the preset storage space, obtain the target first color information from the preset storage space, and then, display the target tile block according to a color indicated by the target first color information. According to the method, the first color information of the image block to be displayed can be determined based on the second color information of the image in the image block to be displayed, and therefore the color richness of the image block is improved.
Fig. 2 is a schematic flow chart of another tile display method according to an embodiment of the disclosure. As shown in fig. 2, the method specifically includes:
201. a tile display operation is detected.
In this embodiment, step 201 is substantially the same as step 101 in the embodiment corresponding to fig. 1, and is not described here again.
202. And in the case that the tile block display operation is detected, determining whether the displayed target tile block indicated by the tile block display operation is used for being displayed on a head screen of a target application.
In this embodiment, after a page for displaying tiles in the target application is opened, before operations such as clicking and sliding of the tiles of the page are performed, each tile displayed on the page, that is, a tile displayed on the first screen of the target application, are performed.
203. And under the condition that the target image block is not used for being displayed on the head screen, determining whether target first color information of the target image block displayed by the image block display operation indication is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed.
In this embodiment, the execution manner of step 203 may refer to step 102 in the corresponding embodiment of fig. 1, which is not described herein again.
204. And under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space.
In this embodiment, step 204 is substantially the same as step 103 in the embodiment corresponding to fig. 1, and is not described here again.
205. And displaying the target image block according to the color indicated by the target first color information.
In this embodiment, step 205 is substantially the same as step 104 in the corresponding embodiment of fig. 1, and is not described herein again.
In some optional implementations of this embodiment, after the step 202 is performed, the following steps may also be performed:
displaying the pre-rendered target tile if the target tile is for display at the home screen.
It can be understood that, in the above alternative implementation, the tiles to be displayed on the first screen are processed in a pre-rendering manner, so that the display speed of the tiles on the first screen is increased.
It should be noted that, in addition to the above-mentioned contents, the present embodiment may further include the technical features described in the embodiment corresponding to fig. 1, so as to achieve the technical effect of the method for displaying the blocks shown in fig. 1.
The method for displaying the image blocks provided by the embodiment of the disclosure determines the first color information of the image blocks to be displayed based on the second color information of the images in the image blocks to be displayed for the image blocks which are used for displaying and are not the first screen, and does not need to adopt the above mode for the image blocks which are used for displaying and are the first screen.
Fig. 3A is a schematic flowchart of another tile display method according to an embodiment of the disclosure.
Specifically, as shown in fig. 3A, the method specifically includes:
step one, calculating the number of the image-text blocks which can be displayed on one screen (namely the number of the single-screen display). As an example, the screen height divided by the block height may be calculated. Wherein, can use frames such as taro to realize, the first screen can adopt and render in advance to guarantee the loading performance of first screen. The taro is an open cross-end cross-frame solution, and supports the development of applications by using the frames of React, vue, nerv and the like.
In this embodiment, the image may be included in the tile. Optionally, the image block may further include text. The tiles may have a background color. A tile may be an information element in an information stream. Through the image blocks, news, products, videos and other information (such as image-text block information) can be displayed. For example, please refer to fig. 3B, and fig. 3B is a schematic diagram of a block diagram according to an embodiment of the disclosure. In fig. 3B, tile 302 includes image 301. The first color information of the tile 302 may include a background color 303 of the tile 302.
And step two, requesting list data. Wherein, the elements in the list include the picture addresses of the pictures (i.e. the images) in the image-text block (i.e. the image block). The elements in the list are arranged in order of addition. And traversing the list and taking the picture address. Preferentially checking whether the corresponding background color (namely the second color information) exists in the cache (namely the preset storage space), and if so, directly updating the corresponding background color data in the list.
And step three, creating a background color calculation queue. And adding the picture addresses which are not stored in the cache into a background color calculation queue, continuously calculating the main color of the cover (namely the image) of the non-displayed image-text block, obtaining the final background color (namely the first color information) according to rules, and adding the final background color into the cache. The number of parallel computations may be 2n. Wherein n represents the number of the image-text blocks that can be displayed on one screen (i.e. the number of the single-screen display). Thus, when the user views the data of the back screen, the background color can be basically extracted from the cache.
And step four, when the user scrolls the screen (namely one of the image block display operations), adjusting the queue when the scrolling is finished, preferentially acquiring or calculating the main color and the final background color of the image-text block of the current screen and the next screen, and responding to scenes such as too fast sliding of the user and the like.
Step five, the algorithm for calculating the background color on the small program can adopt the following modes:
1. an off-screen canvas is created, a picture is drawn on the off-screen canvas, and Uint8 CampEdarray (8-bit unsigned integer fixed array) data is obtained. The canvas width and the canvas height may be specified values or obtained by calculation using the obtained screen width and height.
2. Converting Uint8 CampedArray into pixel array, and calculating by using median cut algorithm or K-Mmeans algorithm to obtain dominant color RGB value.
3. The RGB values are converted into HSV values. The final background color (i.e., the first color information) is calculated according to the above rules. For example, please refer to fig. 3C, and fig. 3C is a schematic diagram illustrating an implementation manner of converting RGB into HSV according to an embodiment of the present disclosure. In fig. 3C, H denotes a converted H value, S denotes a converted S value, and V denotes a converted V value. max represents the maximum of the three RGB values before conversion. min represents the minimum of the three RGB values before conversion. R represents the R value before conversion. G represents the value of G before conversion. B represents the B value before conversion.
And step six, the caching algorithm of the picture address and the background color can select an LRU (Least Recently Used) algorithm to preferentially delete the first color information which is not Used for a long time.
It should be noted that, in addition to the above-mentioned contents, the present embodiment may further include technical features described in the embodiment corresponding to fig. 1 and/or fig. 2, so as to achieve the technical effects of the method for displaying the blocks shown in fig. 1 and/or fig. 2, please refer to the description related to fig. 1 and/or fig. 2 for brevity, which is not repeated herein.
The image block display method provided by the embodiment of the disclosure can dynamically specify the background (i.e. the first color information) of the image-text block (i.e. the image in the image block) according to the cover picture (i.e. the image in the image block). By combining the methods of front-end pre-calculation and background color caching, the delay of background color generation and display is reduced, and the experience is improved.
Fig. 4 is a schematic structural diagram of a tile display device according to an embodiment of the disclosure. The method specifically comprises the following steps:
a detection unit 401 for detecting a tile display operation;
a first determination unit 402, configured to determine, in a case where the tile display operation is detected, whether target first color information of a target tile indicated to be displayed by the tile display operation is stored in a preset storage space, where the preset storage space is used to store first color information of a tile to be displayed in advance, and the first color information is determined based on second color information of an image in the tile to be displayed;
an obtaining unit 403, configured to obtain the target first color information from the preset storage space in a case that the target first color information is stored in the preset storage space;
a first display unit 404, configured to display the target tile according to the color indicated by the target first color information.
In a possible embodiment, the preset storage space stores the first color information by using the following processing manner:
determining second color information of an image in a picture block to be displayed;
determining first color information of the image block to be displayed based on the second color information;
and storing the determined first color information into a preset storage space.
In one possible embodiment, the apparatus further comprises:
a second determination unit (not shown in the figure) for determining the number of single-screen displays of the target application, wherein the number of single-screen displays represents the number of blocks of the single-screen display of the target application;
a third determining unit (not shown in the figure) for determining a target number based on the single-screen display number, wherein the target number represents the number of the first color information to be determined in parallel;
a fourth determining unit (not shown in the figure) configured to determine the target number of first color information in parallel by using the processing manner, so as to store the target number of first color information into the preset storage space.
In one possible embodiment, the preset storage space updates the first color information as follows:
determining the storage duration of the first color information in the preset storage space;
and deleting the first color information with the storage duration being greater than or equal to the preset duration from the preset storage space.
In a possible embodiment, after the obtaining the target first color information from the preset storage space, the apparatus further includes at least one of:
a deleting unit configured to delete the acquired first color information from the preset storage space;
and the storage unit is used for storing the determined new first color information to the preset storage space by adopting the processing mode.
In one possible embodiment, the determining second color information of the image in the tile to be displayed includes:
and determining second color information of the image in the image block to be displayed by adopting at least one of a median segmentation algorithm and a K-means clustering algorithm.
In one possible embodiment, the determining, in a case that the tile display operation is detected, whether target first color information of a target tile indicated to be displayed by the tile display operation is stored in a preset storage space includes:
in the case that the tile display operation is detected, determining whether a target tile displayed by the tile display operation indication is used for being displayed on a head screen of a target application;
and determining whether the target first color information of the target image block displayed by the image block display operation indication is stored in a preset storage space or not under the condition that the target image block is not used for being displayed on the first screen.
In one possible embodiment, after the determining whether the tile display operation indicates that the displayed target tile is used for displaying on the first screen of the target application, the apparatus further includes:
and the second display unit is used for displaying the target image block which is rendered in advance under the condition that the target image block is used for being displayed on the head screen.
In one possible embodiment, after the determining whether the preset storage space stores the target first color information of the target tile displayed by the tile display operation indication, the apparatus further includes:
a fifth determining unit (not shown in the figure) for determining third color information of the image in the target tile if the target first color information is not stored in the preset storage space;
a sixth determining unit (not shown in the figure) for determining fourth color information of the target tile based on the third color information;
and a third display unit (not shown in the figure) for displaying the target tile according to the color indicated by the fourth color information. The block display device provided in this embodiment may be the block display device shown in fig. 4, and may perform all the steps of the block display methods described above, so as to achieve the technical effects of the block display methods described above.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device 500 shown in fig. 5 includes: at least one processor 501, memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together by a bus system 505. It is understood that the bus system 505 is used to enable connection communications between these components. The bus system 505 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 505 in FIG. 5.
The user interface 503 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, touch pad, or touch screen, among others.
It is to be understood that the memory 502 in embodiments of the present disclosure may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), enhanced Synchronous SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 502 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 502 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof: an operating system 5021 and application programs 5022.
The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application 5022 includes various applications, such as a Media Player (Media Player), a Browser (Browser), and the like, for implementing various application services. A program implementing the method of the embodiments of the present disclosure may be included in the application program 5022.
In this embodiment, by calling a program or an instruction stored in the memory 502, specifically, a program or an instruction stored in the application 5022, the processor 501 is configured to execute the method steps provided by the method embodiments, for example, including:
detecting a tile display operation;
under the condition that the image block display operation is detected, determining whether target first color information of a target image block displayed by the image block display operation instruction is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed;
under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space;
and displaying the target image block according to the color indicated by the target first color information.
The method disclosed by the embodiment of the present disclosure can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in software form in the processor 501. The Processor 501 may be a general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present disclosure may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the method in combination with the hardware.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the Processing units may be implemented in one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the above-described functions of the present disclosure, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units performing the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The electronic device provided in this embodiment may be the electronic device shown in fig. 5, and may perform all the steps of the above-described method for displaying the blocks, so as to achieve the technical effects of the above-described method for displaying the blocks.
The disclosed embodiments also provide a storage medium (computer-readable storage medium). The storage medium herein stores one or more programs. Among others, storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When the one or more programs in the storage medium are executable by the one or more processors, the method for displaying the image blocks executed on the electronic device side is implemented.
The processor is used for executing the tile display program stored in the memory to realize the following steps of the tile display method executed on the electronic equipment side:
detecting a tile display operation;
under the condition that the image block display operation is detected, determining whether target first color information of a target image block displayed by the image block display operation instruction is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed;
under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space;
and displaying the target image block according to the color indicated by the target first color information.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments, objects, technical solutions and advantages of the present disclosure are described in further detail, it should be understood that the above-mentioned embodiments are merely illustrative of the present disclosure and are not intended to limit the scope of the present disclosure, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure. Moreover, while the foregoing embodiments have been described for illustrative purposes, they are presented as a series of interrelated states for performing the disclosed steps, it will be appreciated by those skilled in the art that the present invention is not limited by the order in which the acts are described, as some steps may occur in other orders or concurrently with other steps in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that the acts and modules illustrated are not necessarily required to practice the invention.

Claims (12)

1. A method for displaying a tile, the method comprising:
detecting a tile display operation;
under the condition that the image block display operation is detected, determining whether target first color information of a target image block displayed by the image block display operation instruction is stored in a preset storage space, wherein the preset storage space is used for storing the first color information of the image block to be displayed in advance, and the first color information is determined based on second color information of an image in the image block to be displayed;
under the condition that the target first color information is stored in the preset storage space, acquiring the target first color information from the preset storage space;
and displaying the target image block according to the color indicated by the target first color information.
2. The method according to claim 1, wherein the preset storage space stores the first color information by:
determining second color information of an image in a picture block to be displayed;
determining first color information of the tile to be displayed based on the second color information;
and storing the determined first color information into a preset storage space.
3. The method of claim 2, further comprising:
determining the number of single-screen displays of a target application, wherein the number of single-screen displays represents the number of blocks of the single-screen display of the target application;
determining a target number based on the single-screen display number, wherein the target number represents the number of first color information to be determined in parallel;
and determining the target number of first color information in parallel by adopting the processing mode so as to store the target number of first color information to the preset storage space.
4. The method according to claim 2, wherein the preset storage space updates the first color information by:
determining the storage duration of the first color information in the preset storage space;
and deleting the first color information with the storage duration being greater than or equal to the preset duration from the preset storage space.
5. The method according to claim 2, wherein after the obtaining of the target first color information from the preset storage space, the method further comprises at least one of:
deleting the acquired first color information from the preset storage space;
and storing the determined new first color information to the preset storage space by adopting the processing mode.
6. The method of claim 2, wherein determining second color information for images in the tile to be displayed comprises:
and determining second color information of the image in the image block to be displayed by adopting at least one of a median segmentation algorithm and a K-means clustering algorithm.
7. The method according to one of claims 1 to 6, wherein the determining whether target first color information of a target tile displayed by the tile display operation indication is stored in a preset storage space in the case that the tile display operation is detected comprises:
in the case that the tile display operation is detected, determining whether a target tile displayed by the tile display operation indication is used for being displayed on a head screen of a target application;
and determining whether the target first color information of the target image block displayed by the image block display operation indication is stored in a preset storage space or not under the condition that the target image block is not used for being displayed on the first screen.
8. The method of claim 7, wherein after the determining whether the tile display operation indicates that the displayed target tile is for display at a home screen of a target application, the method further comprises:
displaying the pre-rendered target tile if the target tile is for display at the home screen.
9. The method according to one of claims 1 to 6, wherein after determining whether the target first color information of the target tile displayed by the tile display operation indication is stored in the preset storage space, the method further comprises:
determining third color information of an image in the target image block under the condition that the target first color information is not stored in the preset storage space;
determining fourth color information for the target tile based on the third color information;
and displaying the target image block according to the color indicated by the fourth color information.
10. A tile display apparatus, characterized in that the apparatus comprises:
a detection unit for detecting a tile display operation;
a first determination unit configured to determine, in a case where the tile display operation is detected, whether target first color information of a target tile indicated to be displayed by the tile display operation is stored in a preset storage space, where the preset storage space is used to store first color information of a tile to be displayed in advance, and the first color information is determined based on second color information of an image in the tile to be displayed;
an obtaining unit, configured to obtain the target first color information from the preset storage space when the target first color information is stored in the preset storage space;
and the first display unit is used for displaying the target image block according to the color indicated by the target first color information.
11. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing a computer program stored in the memory, and when executed, implementing the method of any of the preceding claims 1-9.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of the preceding claims 1 to 9.
CN202211502969.XA 2022-11-25 2022-11-25 Picture block display method and device, electronic equipment and storage medium Pending CN115842906A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211502969.XA CN115842906A (en) 2022-11-25 2022-11-25 Picture block display method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211502969.XA CN115842906A (en) 2022-11-25 2022-11-25 Picture block display method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115842906A true CN115842906A (en) 2023-03-24

Family

ID=85576120

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211502969.XA Pending CN115842906A (en) 2022-11-25 2022-11-25 Picture block display method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115842906A (en)

Similar Documents

Publication Publication Date Title
CN110377263B (en) Image synthesis method, image synthesis device, electronic equipment and storage medium
US9092668B2 (en) Identifying picture areas based on gradient image analysis
CN106468984A (en) A kind of method of item associations picture rapid preview and device
CN113822817A (en) Document image enhancement method and device and electronic equipment
US20160275917A1 (en) Predictive pre-decoding of encoded media item
US10115012B1 (en) Capture object boundary jitter reduction
US8780120B2 (en) GPU self throttling
US20150371411A1 (en) Computerized systems and methods for rendering a user interface element
WO2019018062A1 (en) Organizing images automatically into image grid layout
US20130127916A1 (en) Adaptive Content Display
CN108989704B (en) Image generation method and device and terminal equipment
CN113657518B (en) Training method, target image detection method, device, electronic device, and medium
CN109358927B (en) Application program display method and device and terminal equipment
CN109065001B (en) Image down-sampling method and device, terminal equipment and medium
CN115842906A (en) Picture block display method and device, electronic equipment and storage medium
US11782850B2 (en) Information processing method, server, terminal, and computer storage medium
US11132762B2 (en) Content aware image fitting
CN109739403B (en) Method and apparatus for processing information
US10586304B2 (en) Dynamic selection of image rendering formats
US20090300489A1 (en) Selective access to a frame buffer
CN111083552A (en) Thumbnail generation method, device, equipment and medium
US20140079278A1 (en) Method and apparatus for creating a media sequence with automatic selection of an optimal sequence preset
US20230206523A1 (en) Systems and methods for automatically adjusting design element attributes
CN111405345B (en) Image processing method, image processing device, display device and readable storage medium
CN107025645A (en) A kind of image processing method and terminal

Legal Events

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