A bitmap stretching method, a bitmap stretching device and an electronic device

By generating and adjusting bitmap matrices, the problem of bitmap stretching distortion is solved, high-quality bitmap stretching effects are achieved, and display blur or misalignment is avoided.

CN113096045BActive Publication Date: 2024-09-10LAUNCH TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110401000.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-14
Publication Date
2024-09-10
Estimated Expiration
2041-04-14

AI Technical Summary

Technical Problem

Bitmaps are easily distorted during the stretching process, resulting in blurred or misaligned displays, affecting the appearance.

Method used

By obtaining the layout information of the bitmap, generate a matrix, and calculate the horizontal and vertical stretching multiples based on the size information, expand it by copying the matrix elements, adjust the matrix size, and generate the stretched bitmap to ensure that the pixels are copied and match the target size.

Benefits of technology

It effectively avoids the blurring or misalignment of the bitmap after stretching, ensuring good display effect and maintaining the beauty of the bitmap.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113096045B
    Figure CN113096045B
Patent Text Reader

Abstract

The present application discloses a bitmap stretching method, device, electronic device and computer-readable storage medium. The method includes: obtaining layout information of a bitmap to be displayed, the layout information includes pixel information and size information; based on the layout information, generating a matrix of the bitmap to be displayed, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel information; calculating the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information; expanding the elements of the matrix according to the horizontal stretching multiple and the vertical stretching multiple to adjust the size of the matrix; generating a stretched bitmap to be displayed based on the adjusted matrix. The present application can make the stretched bitmap still maintain a good display effect and reduce the phenomenon of display blur or error.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of bitmap processing, and in particular, relates to a bitmap stretching method, a bitmap stretching device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In software development, bitmaps are often used to decorate the software to form its own unique style. In this process, the bitmap may need to be stretched to fit the display interface. However, due to the inherent properties of the bitmap, the stretched bitmap will be distorted, resulting in unsightly phenomena such as blur or misalignment of the displayed bitmap. Summary of the invention

[0003] The present application provides a bitmap stretching method, a bitmap stretching device, an electronic device and a computer-readable storage medium, which can ensure that the stretched bitmap still maintains a good display effect and reduce the occurrence of display blur or errors.

[0004] In a first aspect, the present application provides a bitmap stretching method, comprising:

[0005] Obtaining layout information of the bitmap to be displayed, the layout information including pixel information and size information;

[0006] Based on the above layout information, a matrix of the bitmap to be displayed is generated, wherein the size of the above matrix is ​​determined according to the above size information, and the value of each element in the above matrix is ​​determined according to the above pixel point information;

[0007] Calculate the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information;

[0008] According to the transverse stretching multiple and the longitudinal stretching multiple, a matrix expansion operation is performed by copying elements of the matrix to adjust the size of the matrix;

[0009] The stretched bitmap to be displayed is generated based on the adjusted matrix.

[0010] Optionally, generating the matrix of the bitmap to be displayed based on the layout information includes:

[0011] According to the layout information, a matrix having the same size as the bitmap to be displayed is created, wherein each element in the matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

[0012] Optionally, the size information includes an original height and an original width, the target size information includes a target width and a target height, and calculating a horizontal stretch multiple and a vertical stretch multiple of the to-be-displayed bitmap according to the size information and the target size information includes:

[0013] Calculate the width ratio of the target width to the original width as the transverse stretch multiple;

[0014] The ratio of the target height to the original height is calculated as the longitudinal stretch multiple.

[0015] Optionally, the matrix expansion operation is implemented by copying elements of the matrix according to the transverse stretching multiple and the longitudinal stretching multiple to adjust the size of the matrix, including:

[0016] Selecting an element to be copied in the matrix according to the transverse stretching multiple and the longitudinal stretching multiple;

[0017] A matrix expansion operation is implemented by copying the elements to be copied, so as to adjust the size of the matrix.

[0018] Optionally, the elements to be copied include horizontal elements to be copied and vertical elements to be copied, and selecting the elements to be copied in the matrix according to the horizontal stretch multiple and the vertical stretch multiple includes:

[0019] Determining transverse elements to be replicated in the matrix according to the transverse stretching multiple;

[0020] According to the longitudinal stretching multiple, determining longitudinal elements to be replicated in the matrix;

[0021] Accordingly, the matrix expansion operation is implemented by copying the elements to be copied to adjust the size of the matrix, including:

[0022] For each horizontal element to be copied, copy the horizontal element to be copied at a specified horizontal position of the horizontal element to be copied at a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretch multiple;

[0023] For each element to be copied vertically, the element to be copied vertically is copied at a specified vertical position of the element to be copied vertically with a specified vertical multiple to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretch multiple.

[0024] Optionally, generating the stretched bitmap to be displayed based on the adjusted matrix includes:

[0025] Creating an empty bitmap having the same size as the adjusted matrix;

[0026] Traversing each element of the adjusted matrix, and restoring the value of each element to a corresponding pixel value;

[0027] Based on the position of each element in the matrix and the pixel value corresponding to each element, the empty bitmap is filled to obtain the stretched bitmap to be displayed.

[0028] Optionally, before calculating the horizontal stretching multiple and the vertical stretching multiple of the to-be-displayed bitmap according to the size information and the target size information, the method further includes:

[0029] Determining a display mode of a target interface, wherein the target interface is an interface that is ready to display the bitmap to be displayed;

[0030] If the target interface is in window mode, determining the target size information based on the size of the target interface;

[0031] If the target interface is in full screen mode, the target size information is determined based on a preset default size.

[0032] In a second aspect, the present application provides a bitmap stretching device, comprising:

[0033] An acquisition unit, used to acquire layout information of the bitmap to be displayed, wherein the layout information includes pixel point information and size information;

[0034] A first generating unit is used to generate a matrix of the bitmap to be displayed based on the layout information, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel point information;

[0035] A calculation unit, used for calculating the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information;

[0036] An adjustment unit, configured to implement a matrix expansion operation by copying elements of the matrix according to the transverse stretching multiple and the longitudinal stretching multiple, so as to adjust the size of the matrix;

[0037] The second generating unit is used to generate the stretched bitmap to be displayed based on the adjusted matrix.

[0038] Optionally, the first generating unit is specifically used to create a matrix having the same size as the bitmap to be displayed according to the layout information, wherein each element in the matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

[0039] Optionally, the size information includes an original height and an original width, the target size information includes a target width and a target height, and the calculation unit includes:

[0040] A first calculation subunit is used to calculate a width ratio of a target width to an original width as a transverse stretch multiple;

[0041] The second calculation subunit is used to calculate the ratio of the target height to the original height as the longitudinal stretching multiple.

[0042] Optionally, the adjustment unit includes:

[0043] An element selection subunit, used to select an element to be copied in the matrix according to the horizontal stretch multiple and the vertical stretch multiple;

[0044] The element copying subunit is used to implement a matrix expansion operation by copying the elements to be copied, so as to adjust the size of the matrix.

[0045] Optionally, the elements to be copied include horizontal elements to be copied and vertical elements to be copied; and the element selection subunit includes:

[0046] A transverse to-be-copied element determination subunit, used to determine the transverse to-be-copied element in the matrix according to the transverse stretch multiple;

[0047] A subunit for determining the longitudinal elements to be copied, used for determining the longitudinal elements to be copied in the matrix according to the longitudinal stretch multiple;

[0048] Accordingly, the above element replication subunit includes:

[0049] An element horizontal replication subunit, for replicating each horizontally replicated element at a specified horizontal position of the horizontally replicated element at a specified horizontal multiple, so as to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretch multiple;

[0050] The element vertical replication subunit is used to replicate the vertical element to be replicated at a specified vertical position with a specified vertical multiple for each vertical element to be replicated, so as to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretch multiple.

[0051] Optionally, the second generating unit includes:

[0052] A bitmap creation subunit, used to create an empty bitmap having the same size as the adjusted matrix;

[0053] A pixel value restoration subunit, used to traverse each element of the adjusted matrix and restore the value of each element to a corresponding pixel value;

[0054] The bitmap filling subunit is used to fill the above empty bitmap based on the position of each element in the above matrix and the pixel value corresponding to each element to obtain the stretched bitmap to be displayed.

[0055] Optionally, the above-mentioned bitmap stretching device further includes:

[0056] A display mode determination unit, used to determine a display mode of a target interface, wherein the target interface is an interface that is ready to display the bitmap to be displayed;

[0057] The target size information determining unit is used to determine the target size information based on the size of the target interface if the target interface is in window mode, and to determine the target size information based on a preset default size if the target interface is in full screen mode.

[0058] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method of the first aspect when executing the computer program.

[0059] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method of the first aspect are implemented.

[0060] In a fifth aspect, the present application provides a computer program product, which includes a computer program. When the computer program is executed by one or more processors, it implements the steps of the method of the first aspect.

[0061] Compared with the prior art, the present application has the following beneficial effects: first, the layout information of the bitmap to be displayed is obtained, the layout information includes pixel information and size information, then based on the layout information, a matrix of the bitmap to be displayed is generated, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel information, then according to the size information and the target size information, the horizontal stretch multiple and the vertical stretch multiple of the bitmap to be displayed are calculated, and according to the horizontal stretch multiple and the vertical stretch multiple, the matrix expansion operation is implemented by copying the elements of the matrix to adjust the size of the matrix, and finally the stretched bitmap to be displayed is generated based on the adjusted matrix. In the above process, the elements in the matrix corresponding to the bitmap to be displayed are first copied so that the matrix matches the target size information, and then the new bitmap is restored based on the expanded matrix, which essentially realizes the copying of the pixels in the bitmap to be displayed, which not only makes the newly generated bitmap match the target size information, but also avoids the unsightly phenomena such as blur or dislocation. It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0063] Figure 1 It is a schematic diagram of the implementation process of the bitmap stretching method provided in the embodiment of the present application;

[0064] Figure 2 is a schematic diagram of a bitmap to be displayed and its matrix provided in an embodiment of the present application;

[0065] Figure 3 This is an example diagram of the transverse stretching of the matrix provided in the embodiment of the present application;

[0066] Figure 4 is another example diagram of the transverse stretching of the matrix provided in the embodiment of the present application;

[0067] Figure 5 is another exemplary diagram of the transverse stretching of the matrix provided in the embodiment of the present application;

[0068] Figure 6 This is an example diagram of the longitudinal stretching of the matrix provided in the embodiment of the present application;

[0069] Figure 7is another example diagram of longitudinal stretching of the matrix provided in an embodiment of the present application;

[0070] Figure 8 is another exemplary diagram of the longitudinal stretching of the matrix provided in the embodiment of the present application;

[0071] Fig. 9 is an example diagram of a matrix expansion operation provided in an embodiment of the present application;

[0072] Fig.10 is another example diagram of the matrix expansion operation provided in an embodiment of the present application;

[0073] Fig.11 is a structural block diagram of a bitmap stretching device provided in an embodiment of the present application;

[0074] Fig.12 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0076] In software development, it is often necessary to use a bitmap to decorate the software to form the software's own unique style. For example, a bitmap is used as the background image of the software, a bitmap is used as the startup screen of the software, or a bitmap is used to draw virtual buttons, etc. When a bitmap is used as the background image of the software, there is often a situation where the size of the software's display interface exceeds the resolution size of the bitmap. At this time, the bitmap needs to be stretched to adapt to the display interface. However, due to the inherent properties of the bitmap, the stretched bitmap will be distorted, resulting in unsightly phenomena such as distortion or dislocation of the displayed bitmap. Based on this, the embodiment of the present application proposes a bitmap stretching method, a bitmap stretching device, an electronic device, and a computer-readable storage medium, which can make the stretched bitmap still maintain a good display effect and reduce the occurrence of display distortion or error phenomena. In order to illustrate the technical solution proposed in the embodiment of the present application, it is described below through a specific embodiment.

[0077] The following is an explanation of the bitmap stretching method proposed in the embodiment of the present application. Figure 1 , the bitmap stretching method includes:

[0078] Step 101: Obtain layout information of a bitmap to be displayed.

[0079] In an embodiment of the present application, each display interface of the software has pre-specified a corresponding bitmap. When a display interface receives a display instruction, the display interface can be determined as the target interface, and the bitmap corresponding to the display interface is the bitmap to be displayed. Generally speaking, the bitmaps corresponding to each display interface are stored in a preset resource file. The electronic device can load the bitmap to be displayed from the resource file and obtain the layout information of the bitmap to be displayed. Among them, the layout information includes pixel information and size information, the pixel information includes the pixel value of each pixel in the bitmap to be displayed, and the size information is used to indicate the size of the bitmap to be displayed, and the size is in pixels.

[0080] In some embodiments, the electronic device may first obtain the width and height of the bitmap to be displayed, for example, the width is 295 pixels and the height is 425 pixels, so as to obtain the size information of the bitmap to be displayed; then, based on the width and height of the bitmap to be displayed, traverse each pixel in the bitmap to be displayed in a specified order, for example, traverse the pixels in the bitmap to be displayed from left to right and from top to bottom, and read out the pixel value of each pixel point, so as to obtain the pixel point information of the bitmap to be displayed. It should be noted that the above-mentioned specified order can be set by the user and is not limited here. Specifically, considering that the color encoding used by the bitmap for screen display is usually RGB mode, the above-mentioned operation of reading the pixel value of each pixel point is actually: reading the pixel value of each pixel point in the R channel, the pixel value in the G channel, and the pixel value in the B channel.

[0081] Step 102: Generate a matrix of the bitmap to be displayed based on the layout information.

[0082] In an embodiment of the present application, an electronic device may generate a matrix based on the layout information of a bitmap to be displayed, wherein the size of the matrix may be determined according to the size information of the bitmap to be displayed, and the value of each element in the matrix may be determined according to the pixel information of the bitmap to be displayed. Specifically, the size of the matrix is ​​the same as the size of the bitmap to be displayed, that is, the width of the matrix (the number of elements in each row of the matrix) is equal to the width of the bitmap to be displayed (the number of pixels in each row of the bitmap to be displayed), and the height of the matrix (the number of elements in each column of the matrix) is equal to the height of the bitmap to be displayed (the number of pixels in each column of the bitmap to be displayed). Furthermore, each element in the matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

[0083] In some embodiments, the value of each element can be 32 bits, represented by hexadecimal. As an example only, the 0th to 7th bits may store the pixel value of the corresponding pixel point in the R channel (recorded as the first byte), the 8th to 15th bits may store the pixel value of the corresponding pixel point in the G channel (recorded as the second byte), the 16th to 23rd bits may store the pixel value of the corresponding pixel point in the B channel (recorded as the third byte), and the 24th to 31st bits are blank data (recorded as blank bytes). That is, the value of each element can be represented by a 4-byte hexadecimal value.

[0084] For example, see Figure 2 , the bitmap I to be displayed with a width of 8 pixels and a height of 10 pixels corresponds to a 10×8 (10 rows and 8 columns) matrix K. The pixel point in the jth row and ith column of the bitmap I to be displayed (that is, the pixel point with coordinates (i, j) in the bitmap I to be displayed) and the element in the jth row and ith column of the matrix K (that is, k ji ) correspond to each other. Assuming that the pixel value of the pixel point with coordinates (i, j) in the bitmap I to be displayed is RGB (255, 250, 251), then the corresponding element k in the matrix K is obtained ji is 0xFFFAFB00.

[0085] Step 103: Calculate the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information.

[0086] In the embodiment of the present application, the target size information is used to indicate the size of the target interface (i.e., the display interface that is ready to display the bitmap to be displayed), and the size can also be in pixels. Generally speaking, the target size information needs to be determined according to the display mode of the target interface: if the target interface is in window mode, then since the target interface in window mode can be stretched arbitrarily by the user, the target size information needs to be determined based on the real-time size of the target interface; conversely, if the target interface is in full-screen mode, then since the screen size is fixed, the target size information can be directly determined based on the pre-set default size.

[0087] In some embodiments, the size information of the bitmap to be displayed obtained by the electronic device includes the original height (denoted as height) and the original width (denoted as width), and the target size information obtained includes the target width (denoted as new_width) and the target height (denoted as new_height). Therefore, the width ratio of the target width to the original width (that is, new_width / width) can be calculated as the horizontal stretching factor, and the height ratio of the target height to the original height (that is, new_height / height) can be calculated as the vertical stretching factor.

[0088] Step 104, according to the horizontal stretching multiple and the vertical stretching multiple, a matrix expansion operation is implemented by copying the elements of the matrix to adjust the size of the matrix.

[0089] In the embodiment of the present application, the calculated stretch multiple (including the horizontal stretch multiple and the vertical stretch multiple) is likely to be a decimal. In this case, a local element copy operation is required. Therefore, the electronic device can first select the elements to be copied in the matrix according to the horizontal stretch multiple and the vertical stretch multiple, and then implement the matrix expansion operation by copying these elements to be copied to adjust the size of the matrix. The following is an explanation of the horizontal stretch and the vertical stretch respectively:

[0090] For horizontal stretching, the electronic device first determines the horizontal elements to be copied in the matrix according to the horizontal stretching multiple, and then for each horizontal element to be copied, copies the horizontal element to be copied at a specified horizontal position of the horizontal element to be copied at a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretching multiple. As an example only, the specified horizontal position may be the left.

[0091] In some embodiments, the transverse stretch factor (new_width / width) can be divided into three types, namely, an integer greater than 1, a decimal greater than 1 and less than 2, and a decimal greater than 2.

[0092] If the horizontal stretch multiple is an integer greater than 1, all elements in the matrix can be determined as horizontal elements to be copied. To the left of each horizontal element to be copied, the horizontal element to be copied is copied with the specified horizontal multiple, which is (new_width / width)-1. That is, to the left of each horizontal element to be copied, (new_width / width)-1 corresponding horizontal elements to be copied are added. Please refer to Figure 3 , based on a 2×2 matrix, assuming the transverse stretch factor is 3, Figure 3 An example of horizontal stretching is given. The italic bold letters represent the copied elements (that is, the newly added elements).

[0093] If the horizontal stretch multiple is a decimal greater than 1 and less than 2, the elements of the specified ratio in each row of the matrix are determined as the horizontal elements to be copied. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio For example, if new_width / width is 1.5, the specified ratio is 0.5, which is the fraction of 1.5, i.e. 50%; to the left of each horizontal element to be copied, the horizontal element to be copied is copied by the specified horizontal multiple, which is 1. That is, to the left of each horizontal element to be copied, a corresponding horizontal element to be copied is added. Figure 4 , based on a 2×2 matrix, assuming a transverse stretch factor of 1.5, Figure 4 Another example of horizontal stretching is given below, where the italic bold letters represent the copied elements (that is, the newly added elements).

[0094] If the horizontal stretch multiple is a decimal greater than 2, this horizontal stretch operation involves two copies: the first copy is to determine all elements in the matrix as horizontal elements to be copied; to the left of each horizontal element to be copied determined this time, copy the horizontal element to be copied at the specified horizontal multiple, and the specified horizontal multiple this time is That is, the first replication is to add a new element to the left of each horizontal element to be replicated. The second replication is to determine the elements of the specified ratio in each row of the matrix as the elements to be replicated horizontally. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio For example, if new_width / width is 2.5, the specified ratio is 0.5, which is the fraction of 2.5, i.e. 50%. To the left of each horizontal element to be copied determined this time, the horizontal element to be copied is copied again with the specified horizontal multiple, which is 1. That is, the second copy is to add a corresponding horizontal element to be copied to the left of each horizontal element to be copied determined this time. Please refer to Figure 5 , based on a 2×2 matrix, assuming a transverse stretch factor of 2.5, Figure 5 Another example of horizontal stretching is given, wherein the oblique bold letters represent the copied elements (that is, the newly added elements).

[0095] For vertical stretching, the electronic device first determines the vertical elements to be copied in the matrix according to the vertical stretching multiple, and then for each vertical element to be copied, copies the vertical element to be copied at a specified vertical position of the vertical element to be copied at a specified vertical multiple to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretching multiple. As an example only, the specified vertical position may be downward.

[0096] In some embodiments, the longitudinal stretch factor (new_height / height) can be divided into three types, namely, an integer greater than 1, a decimal greater than 1 and less than 2, and a decimal greater than 2.

[0097] If the vertical stretch multiple is an integer greater than 1, all elements in the matrix can be determined as elements to be copied vertically. Under each element to be copied vertically, the element to be copied vertically is copied with the specified vertical multiple, which is (new_height / height)-1. That is, under each element to be copied vertically, (new_height / height)-1 corresponding elements to be copied vertically are added. Please refer to Figure 6 , based on a 2×2 matrix, assuming the longitudinal stretch factor is 3, Figure 6 An example of vertical stretching is given. The italic bold letters represent the copied elements (that is, the newly added elements).

[0098] If the vertical stretch multiple is a decimal greater than 1 and less than 2, the elements of the specified ratio in each row of the matrix are determined as the elements to be copied vertically. The specified ratio is the decimal part of the vertical stretch multiple, that is, the specified ratio For example, if new_height / height is 1.5, the specified ratio is 0.5, which is the decimal part of 1.5, that is, 50%; under each vertical element to be copied determined this time, the vertical element to be copied is copied at the specified vertical multiple, and the specified vertical multiple is 1. That is, under each vertical element to be copied, a corresponding vertical element to be copied is added. See Figure 7 , based on a 2×2 matrix, assuming the longitudinal stretch factor is 1.5, Figure 7 Another example of vertical stretching is given below, where the italic bold letters represent the copied elements (that is, the newly added elements).

[0099] If the vertical stretch multiple is a decimal greater than 2, this vertical stretch operation involves two copies: the first copy is to determine all elements in the matrix as elements to be copied vertically; under each vertical element to be copied determined this time, the vertical element to be copied is copied at the specified vertical multiple this time, and the specified vertical multiple this time is That is, the first replication is to add a new The second replication is to determine the elements of the specified ratio in each row of the matrix as the elements to be replicated vertically. The specified ratio is the decimal part of the vertical stretch multiple, that is, the specified ratio For example, if new_height / height is 2.5, the specified ratio is 0.5, the decimal part of 2.5, that is, 25%; under each vertical element to be copied determined this time, the vertical element to be copied is copied with the specified vertical multiple of this time, and the specified vertical multiple of this time is 1. That is, the second copy is to add a corresponding vertical element to be copied under each vertical element to be copied determined this time. See Figure 8 , based on a 2×2 matrix, assuming the longitudinal stretch factor is 2.5, Figure 8 Another example of longitudinal stretching is given, wherein the oblique bold letters represent the copied elements (that is, the newly added elements).

[0100] In some embodiments, the electronic device may choose to sequentially stretch the matrix in the horizontal and vertical directions; that is, first complete the horizontal stretching of the matrix, and then perform the vertical stretching on the basis of the matrix that has been stretched horizontally; or first complete the vertical stretching of the matrix, and then perform the horizontal stretching on the basis of the matrix that has been stretched vertically. Fig. 9 , based on a 2×2 matrix, assuming that the transverse stretching multiple is 3 and the longitudinal stretching multiple is 2.5, Fig. 9 An example of the matrix expansion process is shown. Alternatively, the electronic device can also choose to stretch the matrix horizontally and vertically at the same time. In this case, there may be a blank position (i.e., blank element) on the diagonal position (lower left) of the element to be copied. In this case, you only need to copy the element to be copied to the corresponding blank position again. Fig.10 , based on a 2×2 matrix, assuming that the transverse stretching multiple is 3 and the longitudinal stretching multiple is 2.5, Fig.10 Another example of a matrix expansion process is shown. Fig. 9 and Fig.10 In the figure, italic bold letters indicate copied elements (that is, newly added elements). Fig.10 The rectangle in the box represents a blank element.

[0101] It should be noted that since the bitmap to be displayed is pre-saved in the specified resource, that is, for the electronic device, the bitmap to be displayed is known, the electronic device can analyze the bitmap to be displayed in advance to determine which pixels in the bitmap to be displayed are more suitable for copying. It is generally believed that the pixels in the area of ​​the bitmap that tends to be pure color are more suitable for copying. After analysis, a copy weight can be assigned to each pixel of the bitmap to be displayed. The larger the copy weight, the more suitable the pixel is for copying; the smaller the copy weight, the less suitable the pixel is for copying. Therefore, when it is necessary to select the elements to be copied on each row / column of the matrix at a specified ratio, the selection can be made according to the copy weight of each pixel on each row / column, so that the pixels with large copy weights can be preferentially selected as the elements to be copied, further ensuring that the stretched bitmap to be displayed does not appear blurred or misplaced.

[0102] Step 105: Generate the stretched bitmap to be displayed based on the adjusted matrix.

[0103] In the embodiment of the present application, step 105 can actually be regarded as the reverse operation of step 102: step 102 is to generate a matrix based on the bitmap; step 105 is to restore the bitmap based on the matrix. However, it should be noted that the matrix in step 105 has been adjusted and its size has changed. The electronic device will first create an empty bitmap with the same size as the adjusted matrix above (that is, the width of the empty bitmap is new_width and the height is new_height). Then it traverses each element of the adjusted matrix and restores the value of each element to the corresponding pixel value. The restoration formula is: for the element k in the adjusted matrix K' mn For example, R=(k mn >>24)&0xFF, G=(k mn >>16)&0xFF, B=(k mn >>8)&0xFF, where R is the pixel value of the R channel, G is the pixel value of the G channel, and B is the pixel value of the B channel. Finally, based on the position of each element in the adjusted matrix and the pixel value corresponding to each element, the empty bitmap is filled to obtain the stretched bitmap to be displayed. For example, element k mn If the element in the mth row and nth column in the matrix K' is the pixel value of the pixel in the mth row and nth column in the empty bitmap (that is, the pixel with coordinates (n, m)) is set to the value based on the element k mn The restored pixel value.

[0104] As can be seen from the above, through the embodiment of the present application, the layout information of the bitmap to be displayed is first obtained, and the above layout information includes pixel information and size information. Then, based on the above layout information, the matrix of the bitmap to be displayed is generated, wherein the size of the above matrix is ​​determined according to the above size information, and the value of each element in the above matrix is ​​determined according to the above pixel information. Then, according to the above size information and the target size information, the horizontal stretch multiple and the vertical stretch multiple of the bitmap to be displayed are calculated, and according to the above horizontal stretch multiple and the vertical stretch multiple, the matrix expansion operation is realized by copying the elements of the above matrix to adjust the size of the above matrix, and finally, the stretched bitmap to be displayed is generated based on the adjusted matrix. In the above process, the elements in the matrix corresponding to the bitmap to be displayed are first copied so that the matrix matches the target size information, and then the new bitmap is restored based on the expanded matrix, which essentially realizes the copying of the pixels in the bitmap to be displayed, which not only makes the newly generated bitmap match the target size information, but also avoids the unsightly phenomena such as blur or dislocation.

[0105] Corresponding to the bitmap stretching method provided above, the present application embodiment also provides a bitmap stretching device. Fig.11 As shown, the bitmap stretching device 1100 includes:

[0106] The acquisition unit 1101 is used to acquire layout information of the bitmap to be displayed, wherein the layout information includes pixel information and size information;

[0107] A first generating unit 1102 is used to generate a matrix of the bitmap to be displayed based on the layout information, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel point information;

[0108] The calculation unit 1103 is used to calculate the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information;

[0109] An adjusting unit 1104, configured to implement a matrix expansion operation by copying elements of the matrix according to the transverse stretching multiple and the longitudinal stretching multiple, so as to adjust the size of the matrix;

[0110] The second generating unit 1105 is used to generate the stretched bitmap to be displayed based on the adjusted matrix.

[0111] Optionally, the first generation unit 1102 is specifically used to create a matrix having the same size as the bitmap to be displayed according to the layout information, wherein each element in the matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

[0112] Optionally, the size information includes an original height and an original width, the target size information includes a target width and a target height, and the calculation unit 1103 includes:

[0113] A first calculation subunit is used to calculate a width ratio of a target width to an original width as a transverse stretch multiple;

[0114] The second calculation subunit is used to calculate the ratio of the target height to the original height as the longitudinal stretching multiple.

[0115] Optionally, the adjusting unit 1104 includes:

[0116] An element selection subunit, used to select an element to be copied in the matrix according to the horizontal stretch multiple and the vertical stretch multiple;

[0117] The element copying subunit is used to implement a matrix expansion operation by copying the elements to be copied, so as to adjust the size of the matrix.

[0118] Optionally, the elements to be copied include horizontal elements to be copied and vertical elements to be copied; and the element selection subunit includes:

[0119] A transverse to-be-copied element determination subunit, used to determine the transverse to-be-copied element in the matrix according to the transverse stretch multiple;

[0120] A subunit for determining the longitudinal elements to be copied, used for determining the longitudinal elements to be copied in the matrix according to the longitudinal stretch multiple;

[0121] Accordingly, the above element replication subunit includes:

[0122] An element horizontal replication subunit, for replicating each horizontally replicated element at a specified horizontal position of the horizontally replicated element at a specified horizontal multiple, so as to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretch multiple;

[0123] The element vertical replication subunit is used to replicate the vertical element to be replicated at a specified vertical position with a specified vertical multiple for each vertical element to be replicated, so as to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretch multiple.

[0124] Optionally, the second generating unit 1105 includes:

[0125] A bitmap creation subunit, used to create an empty bitmap having the same size as the adjusted matrix;

[0126] A pixel value restoration subunit, used to traverse each element of the adjusted matrix and restore the value of each element to a corresponding pixel value;

[0127] The bitmap filling subunit is used to fill the above empty bitmap based on the position of each element in the above matrix and the pixel value corresponding to each element to obtain the stretched bitmap to be displayed.

[0128] Optionally, the above-mentioned bitmap stretching device 1100 further includes:

[0129] A display mode determination unit, used to determine a display mode of a target interface, wherein the target interface is an interface that is ready to display the bitmap to be displayed;

[0130] The target size information determining unit is used to determine the target size information based on the size of the target interface if the target interface is in window mode, and to determine the target size information based on a preset default size if the target interface is in full screen mode.

[0131] As can be seen from the above, through the embodiment of the present application, the layout information of the bitmap to be displayed is first obtained, and the above layout information includes pixel information and size information. Then, based on the above layout information, the matrix of the bitmap to be displayed is generated, wherein the size of the above matrix is ​​determined according to the above size information, and the value of each element in the above matrix is ​​determined according to the above pixel information. Then, according to the above size information and the target size information, the horizontal stretch multiple and the vertical stretch multiple of the bitmap to be displayed are calculated, and according to the above horizontal stretch multiple and the vertical stretch multiple, the matrix expansion operation is realized by copying the elements of the above matrix to adjust the size of the above matrix, and finally, the stretched bitmap to be displayed is generated based on the adjusted matrix. In the above process, the elements in the matrix corresponding to the bitmap to be displayed are first copied so that the matrix matches the target size information, and then the new bitmap is restored based on the expanded matrix, which essentially realizes the copying of the pixels in the bitmap to be displayed, which not only makes the newly generated bitmap match the target size information, but also avoids the unsightly phenomena such as blur or dislocation.

[0132] Corresponding to the bitmap stretching method provided above, the present application embodiment also provides an electronic device. Fig.12 The electronic device 12 in the embodiment of the present application includes: a memory 1201, one or more processors 1202 ( Fig.12Only one is shown) and a computer program stored in the memory 1201 and executable on the processor. Among them: the memory 1201 is used to store software programs and units, and the processor 1202 executes various functional applications and diagnoses by running the software programs and units stored in the memory 1201 to obtain the resources corresponding to the above-mentioned preset events. Specifically, the processor 1202 implements the following steps when running the above-mentioned computer program stored in the memory 1201:

[0133] Obtaining layout information of the bitmap to be displayed, the layout information including pixel information and size information;

[0134] Based on the above layout information, a matrix of the bitmap to be displayed is generated, wherein the size of the above matrix is ​​determined according to the above size information, and the value of each element in the above matrix is ​​determined according to the above pixel point information;

[0135] Calculate the horizontal stretching multiple and the vertical stretching multiple of the bitmap to be displayed according to the size information and the target size information;

[0136] According to the transverse stretching multiple and the longitudinal stretching multiple, a matrix expansion operation is performed by copying elements of the matrix to adjust the size of the matrix;

[0137] The stretched bitmap to be displayed is generated based on the adjusted matrix.

[0138] Assuming that the above is the first possible implementation, in a second possible implementation provided on the basis of the first possible implementation, generating the matrix of the bitmap to be displayed based on the layout information includes:

[0139] According to the above layout information, a matrix with the same size as the bitmap to be displayed is created, wherein each element in the above matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

[0140] In a third possible implementation provided on the basis of the first possible implementation, the size information includes an original height and an original width, the target size information includes a target width and a target height, and the horizontal stretching multiple and the vertical stretching multiple of the to-be-displayed bitmap are calculated according to the size information and the target size information, including:

[0141] Calculate the width ratio of the target width to the original width as the transverse stretch multiple;

[0142] The ratio of the target height to the original height is calculated as the longitudinal stretch multiple.

[0143] In a fourth possible implementation provided as a basis of the first possible implementation, the matrix expansion operation is implemented by copying elements of the matrix according to the transverse stretching multiple and the longitudinal stretching multiple to adjust the size of the matrix, including:

[0144] According to the above transverse stretching multiple and longitudinal stretching multiple, select the element to be copied in the above matrix;

[0145] A matrix expansion operation is implemented by copying the elements to be copied, so as to adjust the size of the matrix.

[0146] In a fifth possible implementation provided on the basis of the fourth possible implementation, the elements to be copied include horizontal elements to be copied and vertical elements to be copied, and the elements to be copied in the matrix are selected according to the horizontal stretch multiple and the vertical stretch multiple, including:

[0147] According to the above transverse stretching multiple, determining the transverse elements to be replicated in the above matrix;

[0148] According to the longitudinal stretching multiple, determining the longitudinal elements to be copied in the matrix;

[0149] Accordingly, the matrix expansion operation is implemented by copying the elements to be copied to adjust the size of the matrix, including:

[0150] For each horizontal element to be copied, copy the horizontal element to be copied at a specified horizontal position of the horizontal element to be copied with a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretch multiple;

[0151] For each vertical element to be copied, the vertical element to be copied is copied at a specified vertical position of the vertical element at a specified vertical multiple to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretch multiple.

[0152] In a sixth possible implementation provided on the basis of the first possible implementation, the step of generating the stretched bitmap to be displayed based on the adjusted matrix includes:

[0153] Create an empty bitmap with the same dimensions as the adjusted matrix above;

[0154] Traverse each element of the adjusted matrix and restore the value of each element to the corresponding pixel value;

[0155] Based on the position of each element in the matrix and the pixel value corresponding to each element, the empty bitmap is filled to obtain the stretched bitmap to be displayed.

[0156] In a seventh possible implementation provided on the basis of the first possible implementation, or the second possible implementation, or the third possible implementation, or the fourth possible implementation, or the fifth possible implementation, or the sixth possible implementation, before calculating the horizontal stretch multiple and the vertical stretch multiple of the to-be-displayed bitmap according to the size information and the target size information, the processor 1202 further implements the following steps when running the computer program stored in the memory 1201:

[0157] Determine a display mode of a target interface, wherein the target interface is an interface that is to display the bitmap to be displayed;

[0158] If the target interface is in window mode, determining the target size information based on the size of the target interface;

[0159] If the target interface is in full screen mode, the target size information is determined based on a preset default size.

[0160] It should be understood that in the embodiment of the present application, the processor 1202 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0161] The memory 1201 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1202. A part or all of the memory 1201 may also include a non-volatile random access memory. For example, the memory 1201 may also store information of a device category.

[0162] As can be seen from the above, through the embodiment of the present application, the layout information of the bitmap to be displayed is first obtained, and the above layout information includes pixel information and size information. Then, based on the above layout information, the matrix of the bitmap to be displayed is generated, wherein the size of the above matrix is ​​determined according to the above size information, and the value of each element in the above matrix is ​​determined according to the above pixel information. Then, according to the above size information and the target size information, the horizontal stretch multiple and the vertical stretch multiple of the bitmap to be displayed are calculated, and according to the above horizontal stretch multiple and the vertical stretch multiple, the matrix expansion operation is realized by copying the elements of the above matrix to adjust the size of the above matrix, and finally, the stretched bitmap to be displayed is generated based on the adjusted matrix. In the above process, the elements in the matrix corresponding to the bitmap to be displayed are first copied so that the matrix matches the target size information, and then the new bitmap is restored based on the expanded matrix, which essentially realizes the copying of the pixels in the bitmap to be displayed, which not only makes the newly generated bitmap match the target size information, but also avoids the unsightly phenomena such as blur or dislocation.

[0163] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0164] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0165] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0166] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the above modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0167] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0168] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the associated hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer-readable memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media does not include electrical carrier signals and telecommunication signals.

[0169] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A bitmap stretching method, characterized in that: include: Obtaining layout information of the bitmap to be displayed, wherein the layout information includes pixel point information and size information; Based on the layout information, a matrix of the bitmap to be displayed is generated, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel point information; Calculating a horizontal stretching multiple and a vertical stretching multiple of the to-be-displayed bitmap according to the size information and the target size information; According to the transverse stretching multiple and the longitudinal stretching multiple, a matrix expansion operation is implemented by copying elements of the matrix to adjust the size of the matrix, including: Selecting an element to be copied in the matrix according to the transverse stretching multiple and the longitudinal stretching multiple; Implementing a matrix expansion operation by copying the elements to be copied, so as to adjust the size of the matrix; For the horizontal stretching, firstly, the horizontal elements to be copied are determined in the matrix according to the horizontal stretching multiple, and then for each horizontal element to be copied, the horizontal element to be copied is copied at a specified horizontal position of the horizontal element to be copied with a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretching multiple; the specified horizontal position may be the left; The horizontal stretch multiple new_width / width is divided into three types: an integer greater than 1, a decimal greater than 1 and less than 2, and a decimal greater than 2; If the horizontal stretch multiple is an integer greater than 1, all elements in the matrix can be determined as horizontal elements to be copied; to the left of each horizontal element to be copied, the horizontal element to be copied is copied with a specified horizontal multiple, and the specified horizontal multiple is (new_width / width)-1, that is, to the left of each horizontal element to be copied, (new_width / width)-1 corresponding horizontal elements to be copied are added; If the horizontal stretch multiple is a decimal greater than 1 and less than 2, the elements of the specified ratio in each row of the matrix are determined as the horizontal elements to be copied. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio If the horizontal stretch multiple is a decimal greater than 2, this horizontal stretch operation involves two copies: the first copy is to determine all elements in the matrix as horizontal elements to be copied; to the left of each horizontal element to be copied determined this time, the horizontal element to be copied is copied at the specified horizontal multiple. The specified horizontal multiple this time is That is, the first replication is to add a new element to the left of each horizontal element to be replicated. The second replication is to determine the elements of the specified ratio in each row of the matrix as the elements to be replicated horizontally. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio. Analyze the bitmap to be displayed in advance to determine which pixels in the bitmap to be displayed are more suitable for copying; pixels in the area of ​​the bitmap that tends to be pure color are more suitable for copying; after the analysis, assign a copy weight to each pixel of the bitmap to be displayed; the larger the copy weight, the more suitable the pixel is for copying; the smaller the copy weight, the less suitable the pixel is for copying; when it is necessary to select the elements to be copied on each row / column of the matrix at a specified ratio, select according to the copy weights of each pixel on each row / column, so that the pixels with large copy weights are preferentially selected as the elements to be copied; The stretched bitmap to be displayed is generated based on the adjusted matrix.

2. The bitmap stretching method according to claim 1, characterized in that: The step of generating a matrix of the bitmap to be displayed based on the layout information includes: According to the layout information, a matrix having the same size as the bitmap to be displayed is created, wherein each element in the matrix corresponds one-to-one to each pixel in the bitmap to be displayed, and the corresponding pixels and elements have the same position information.

3. The bitmap stretching method according to claim 1, wherein: The size information includes an original height and an original width, the target size information includes a target width and a target height, and calculating the horizontal stretch multiple and the vertical stretch multiple of the to-be-displayed bitmap according to the size information and the target size information includes: Calculate the width ratio of the target width to the original width as the transverse stretch multiple; The ratio of the target height to the original height is calculated as the longitudinal stretch multiple.

4. The bitmap stretching method according to claim 1, wherein: The elements to be copied include horizontal elements to be copied and vertical elements to be copied, and selecting the elements to be copied in the matrix according to the horizontal stretch multiple and the vertical stretch multiple includes: Determining transverse elements to be replicated in the matrix according to the transverse stretching multiple; According to the longitudinal stretching multiple, determining longitudinal elements to be replicated in the matrix; Accordingly, the matrix expansion operation is implemented by copying the elements to be copied to adjust the size of the matrix, including: For each horizontal element to be copied, copy the horizontal element to be copied at a specified horizontal position of the horizontal element to be copied at a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretch multiple; For each element to be copied vertically, the element to be copied vertically is copied at a specified vertical position of the element to be copied vertically with a specified vertical multiple to adjust the height of the matrix, wherein the specified vertical multiple is determined according to the vertical stretch multiple.

5. The bitmap stretching method according to claim 1, wherein: The step of generating the stretched bitmap to be displayed based on the adjusted matrix includes: Creating an empty bitmap having the same size as the adjusted matrix; Traversing each element of the adjusted matrix, and restoring the value of each element to a corresponding pixel value; Based on the position of each element in the matrix and the pixel value corresponding to each element, the empty bitmap is filled to obtain the stretched bitmap to be displayed.

6. The bitmap stretching method according to any one of claims 1 to 5, characterized in that: Before calculating the horizontal stretching multiple and the vertical stretching multiple of the to-be-displayed bitmap according to the size information and the target size information, the method further includes: Determining a display mode of a target interface, wherein the target interface is an interface that is ready to display the bitmap to be displayed; If the target interface is in window mode, determining the target size information based on the size of the target interface; If the target interface is in full screen mode, the target size information is determined based on a preset default size.

7. A bitmap stretching device, characterized in that: include: An acquisition unit, used to acquire layout information of a bitmap to be displayed, wherein the layout information includes pixel point information and size information; A first generating unit is configured to generate a matrix of the bitmap to be displayed based on the layout information, wherein the size of the matrix is ​​determined according to the size information, and the value of each element in the matrix is ​​determined according to the pixel point information; A calculation unit, used for calculating a horizontal stretching multiple and a vertical stretching multiple of the to-be-displayed bitmap according to the size information and the target size information; An adjustment unit, used to implement a matrix expansion operation by copying elements of the matrix according to the transverse stretching multiple and the longitudinal stretching multiple, so as to adjust the size of the matrix, comprising: Selecting an element to be copied in the matrix according to the transverse stretching multiple and the longitudinal stretching multiple; Implementing a matrix expansion operation by copying the elements to be copied, so as to adjust the size of the matrix; For the horizontal stretching, firstly, the horizontal elements to be copied are determined in the matrix according to the horizontal stretching multiple, and then for each horizontal element to be copied, the horizontal element to be copied is copied at a specified horizontal position of the horizontal element to be copied with a specified horizontal multiple to adjust the width of the matrix, wherein the specified horizontal multiple is determined according to the horizontal stretching multiple; the specified horizontal position may be the left; The horizontal stretch multiple new_width / width is divided into three types: an integer greater than 1, a decimal greater than 1 and less than 2, and a decimal greater than 2; If the horizontal stretch multiple is an integer greater than 1, all elements in the matrix can be determined as horizontal elements to be copied; to the left of each horizontal element to be copied, the horizontal element to be copied is copied with a specified horizontal multiple, and the specified horizontal multiple is (new_width / width)-1, that is, to the left of each horizontal element to be copied, (new_width / width)-1 corresponding horizontal elements to be copied are added; If the horizontal stretch multiple is a decimal greater than 1 and less than 2, the elements of the specified ratio in each row of the matrix are determined as the horizontal elements to be copied. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio If the horizontal stretch multiple is a decimal greater than 2, this horizontal stretch operation involves two copies: the first copy is to determine all elements in the matrix as horizontal elements to be copied; to the left of each horizontal element to be copied determined this time, the horizontal element to be copied is copied at the specified horizontal multiple. The specified horizontal multiple this time is That is, the first replication is to add a new element to the left of each horizontal element to be replicated. The second replication is to determine the elements of the specified ratio in each row of the matrix as the elements to be replicated horizontally. The specified ratio is the decimal part of the horizontal stretch multiple, that is, the specified ratio. Analyze the bitmap to be displayed in advance to determine which pixels in the bitmap to be displayed are more suitable for copying; pixels in the area of ​​the bitmap that tends to be pure color are more suitable for copying; after the analysis, assign a copy weight to each pixel of the bitmap to be displayed; the larger the copy weight, the more suitable the pixel is for copying; the smaller the copy weight, the less suitable the pixel is for copying; when it is necessary to select the elements to be copied on each row / column of the matrix at a specified ratio, select according to the copy weights of each pixel on each row / column, so that the pixels with large copy weights are preferentially selected as the elements to be copied; The second generating unit is used to generate the stretched bitmap to be displayed based on the adjusted matrix.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.