Wallpaper implementation method, device and equipment
By calculating the grayscale difference between the pixel to be processed and adjacent pixels, determining the pixel position offset and obtaining the target color, it solves the problem that the wallpaper cannot achieve a dynamic frosted glass effect, achieves a dynamic frosted glass effect, and improves the user interaction experience.
Patent Information
- Application Number
- CN202410675718.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-10-11
AI Technical Summary
In the existing technology, wallpaper can only achieve a linear glass effect and cannot achieve a dynamic frosted glass effect.
By obtaining the grayscale difference between the pixel to be processed and adjacent pixels, determining the pixel position offset, and obtaining the color of the target pixel based on the offset, the dynamic frosted glass effect of the wallpaper is achieved.
The dynamic frosted glass effect of the wallpaper is realized, and the interactive experience of simulating the growth of ice flowers, rapid freezing, and the spread of ice cubes improves the user experience.
Smart Images

Figure CN118762089A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a wallpaper implementation method, device and equipment. Background Art
[0002] Wallpaper is a picture that decorates the desktop or lock screen interface of an electronic device. Wallpapers can be divided into lock screen wallpapers, screen wallpapers, and dynamic wallpapers. Users can download their favorite pictures and then set them as wallpapers. In related technologies, when the terminal enters the lock screen from the off screen (or the desktop enters the lock screen), the wallpaper can only achieve a straight glass effect, but cannot achieve a dynamic frosted glass effect. Summary of the invention
[0003] The present invention provides a wallpaper realization method, device and equipment, which are used to solve the technical problem that wallpaper in the prior art can only realize a straight glass effect but cannot realize a dynamic frosted glass effect.
[0004] The present invention provides a wallpaper realization method, comprising the following steps.
[0005] For any pixel to be processed in the original image, a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel are obtained; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in a rectangular coordinate system of the original image; determining pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system according to the first grayscale difference and the second grayscale difference; Acquire a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; The color of the pixel to be processed in the wallpaper image is determined according to the color of the target pixel.
[0006] According to a wallpaper implementation method provided by the present invention, the grayscale value of any pixel in the original image is determined based on the following method: determining a color channel value of the pixel; The grayscale value of the pixel is determined according to the size relationship between the color channel value and a minimum grayscale value; wherein, during a screen lock process, the minimum grayscale value gradually changes within a preset minimum grayscale value range.
[0007] According to a wallpaper implementation method provided by the present invention, determining the grayscale value of the pixel according to the size relationship between the color channel value and a minimum grayscale value includes: The maximum value between the color channel value and the minimum grayscale value is used as the grayscale value of the pixel.
[0008] According to a wallpaper implementation method provided by the present invention, determining the color of the pixel to be processed in the wallpaper image according to the color of the target pixel includes: Obtain a mask image color channel value of the pixel position to be processed in the mask image at the current moment during the screen lock process; When the color channel value of the mask image is greater than or equal to a preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the color channel value of the mask image is less than the mask threshold, the color of the pixel to be processed remains the color in the original image; wherein, during a screen lock process, the mask threshold changes gradually within a preset mask threshold range.
[0009] According to a wallpaper realization method provided by the present invention, determining the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system according to the first grayscale difference and the second grayscale difference includes: Multiplying the first grayscale difference and the second grayscale difference by a preset offset strength respectively to obtain initial pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system; The pixel position offsets in two mutually perpendicular directions of the rectangular coordinate system are determined according to the initial pixel position offset and the preset boundary constraint.
[0010] According to a wallpaper implementation method provided by the present invention, wallpaper parameters are modified based on an animation thread; the wallpaper parameters include the minimum grayscale value and the mask threshold; The original image is rendered based on the rendering thread and the wallpaper parameters.
[0011] The present invention also provides a wallpaper realization device, comprising the following modules: an acquisition module, configured to acquire, for any pixel to be processed in the original image, a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in a rectangular coordinate system of the original image; A first determining module, configured to determine pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system according to the first grayscale difference and the second grayscale difference; A second determination module, configured to obtain a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; The third determination module is used to determine the color of the pixel to be processed in the wallpaper image according to the color of the target pixel.
[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the wallpaper implementation methods described above is implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the wallpaper realization method described in any one of the above is realized.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned wallpaper implementation methods.
[0015] The wallpaper realization method, device and equipment provided by the present invention first obtain the first grayscale difference between the pixel to be processed and the first adjacent pixel, and the second grayscale difference between the pixel to be processed and the second adjacent pixel; then determine the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system according to the first grayscale difference and the second grayscale difference, and the second coordinate of the target pixel after the offset according to the pixel position offset; finally, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image. That is, the coordinates of the original image are offset based on the grayscale difference between the pixel to be processed and the adjacent pixel in the original image, thereby realizing the dynamic frosted glass effect of the wallpaper. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 is a flowchart of a wallpaper implementation method provided by an embodiment of the present invention; Figure 2 is another schematic flow chart of the wallpaper realization method provided by an embodiment of the present invention; Figure 3 is a schematic diagram of an image grayscale image provided by an embodiment of the present invention; Figure 4 is a schematic diagram of a mask image provided by an embodiment of the present invention; Figure 5 This is a schematic diagram of the effect of wallpaper provided by an embodiment of the present invention; Figure 6 is a structural schematic diagram of a wallpaper realization device provided by an embodiment of the present invention; Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] Combine the following Figure 1-Figure 7 The technical solution of the present invention is described in detail with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0020] Figure 1 1 is a flow chart of an embodiment of a wallpaper implementation method provided by an embodiment of the present invention. Figure 1 As shown, the method provided in this embodiment includes: Step 101: for any pixel to be processed in the original image, obtain a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in the rectangular coordinate system of the original image.
[0021] Specifically, when the terminal enters the lock screen from the off screen (or the desktop enters the lock screen), in order to achieve the dynamic frosted glass effect of the wallpaper, in one embodiment of the present application, the grayscale difference between the pixel A to be processed and the first adjacent pixel in the original image, and the grayscale difference between the pixel A to be processed and the second adjacent pixel in the original image are first obtained; wherein the original image is an image for which a dynamic frosted glass effect is to be achieved; the pixel A to be processed is any pixel in the original image; the first adjacent pixel and the pixel A to be processed are adjacent on the horizontal coordinate of the rectangular coordinate system of the original image; the second adjacent pixel and the pixel A are adjacent on the vertical coordinate of the rectangular coordinate system of the original image. Optionally, the grayscale difference between adjacent pixels can be calculated in the following way: differential value = grayscale value of the current pixel - grayscale value of the adjacent pixel. That is, the first grayscale difference is the grayscale value of the pixel A to be processed minus the grayscale value of the first adjacent pixel; the second grayscale difference is the grayscale value of the pixel A to be processed minus the grayscale value of the second adjacent pixel.
[0022] Step 102: Determine pixel position offsets in two mutually perpendicular directions of a rectangular coordinate system according to the first grayscale difference and the second grayscale difference.
[0023] Specifically, after obtaining the first grayscale difference between the pixel to be processed and the first adjacent pixel, and the second grayscale difference between the pixel to be processed and the second adjacent pixel, in one embodiment of the present application, the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system is determined according to the first grayscale difference and the second grayscale difference. Optionally, the first grayscale difference can be used as the offset on the horizontal coordinate of the rectangular coordinate system of the original image, and the second grayscale difference can be used as the offset on the vertical coordinate of the rectangular coordinate system of the original image; the first grayscale difference and the second grayscale difference can also be multiplied by a (same or different) weight respectively, so as to obtain the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system.
[0024] Step 103, obtaining a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; Specifically, after determining the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system according to the first grayscale difference and the second grayscale difference, in one embodiment of the present application, the second coordinate of a target pixel in the original image is obtained according to the pixel position offset and the first coordinate of the pixel to be processed A in the rectangular coordinate system. Optionally, the first coordinate of the pixel to be processed A in the rectangular coordinate system may be offset according to the pixel position offset, so that the second coordinate of the target pixel in the rectangular coordinate system may be obtained.
[0025] Step 104: Determine the color of the pixel to be processed in the wallpaper image according to the color of the target pixel.
[0026] Specifically, after obtaining the second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system, in one embodiment of the present application, the color of the pixel to be processed in the wallpaper image is determined according to the color of the target pixel, thereby achieving the dynamic frosted glass effect of the wallpaper. Optionally, the color of the target pixel can be used as the color of the pixel to be processed A in the wallpaper image, thereby achieving the dynamic frosted glass effect of the wallpaper.
[0027] The method of the above embodiment first obtains the first grayscale difference between the pixel to be processed and the first adjacent pixel, and the second grayscale difference between the pixel to be processed and the second adjacent pixel; then, according to the first grayscale difference and the second grayscale difference, determines the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system, and the second coordinate of the target pixel after the offset according to the pixel position offset; finally, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image. That is, the coordinates of the original image are offset based on the grayscale difference between the pixel to be processed and the adjacent pixel in the original image, thereby achieving the dynamic frosted glass effect of the wallpaper.
[0028] In one embodiment, the grayscale value of any pixel in the original image is determined based on the following method: Determine a color channel value of a pixel; The grayscale value of the pixel is determined according to the size relationship between the color channel value and a minimum grayscale value; wherein, during a screen lock process, the minimum grayscale value gradually changes within a preset minimum grayscale value range.
[0029] Specifically, in an embodiment of the present application, in the process of determining the grayscale value of a pixel, a color channel value of the pixel is first determined; optionally, it can be the R channel value of the pixel. Then, based on the size relationship between the color channel value and a minimum grayscale value, the grayscale value of the pixel is determined. Optionally, in a screen lock process, the minimum grayscale value gradually changes within a preset minimum grayscale value range, and the maximum value between the color channel value and the minimum grayscale value is used as the grayscale value of the pixel.
[0030] For example, assuming that the grayscale texture is grayTex, the minimum grayscale value at the current moment is minGray, and the texture coordinates of the pixel to be processed are lockUV, then the grayscale values of the pixel to be processed are as follows: Among them, texture is the texture sampling function, max is the maximum value function, tex is a four-dimensional vector, which represents the value of the four RGBA channels of the color, and the value range of each dimension is [0,1]; tex.r represents the R channel value of the pixel. RGBA stands for Red, Green, Blue, Alpha, which represent red, green, blue and transparency respectively.
[0031] Optionally, in the process from screen off to lock screen (or desktop to lock screen), the value of minGray gradually changes from 1 to 0, which will affect the calculation of grayscale difference. When on the desktop, when minGray is 1, the getGray function returns 1, the difference is 0, there is no pixel offset, and the frosting has not started to grow.
[0032] Optionally, when minGray is 0, the getGray function returns the grayscale sampled in the grayscale image, and the difference is basically non-zero, and most pixels will shift. At this time, the frosted density grows to the maximum value. That is, after the screen is locked, the minimum grayscale value changes from 1 to 0, so this method is called the "grayscale descent method", which can effectively realize the dynamic change of frosted density and simulate the effect of ice flower growth.
[0033] The method of the above embodiment, during a screen lock process, gradually changes the minimum grayscale value within a preset minimum grayscale value range, and uses the maximum value between a color channel value of a pixel and the minimum grayscale value as the grayscale value of the pixel, thereby effectively realizing the dynamic change of frosting density and simulating the growth effect of ice flowers.
[0034] In one embodiment, determining the color of the pixel to be processed in the wallpaper image according to the color of the target pixel includes: obtaining a mask image color channel value of the position of the pixel to be processed in the mask image at the current moment during the screen lock process; When the color channel value of the mask image is greater than or equal to the preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the color channel value of the mask image is less than the mask threshold, the color of the pixel to be processed remains the color in the original image; wherein, during a screen lock process, the mask threshold gradually changes within a preset mask threshold range.
[0035] Specifically, in the process of determining the color of the pixel to be processed in the wallpaper image according to the color of the target pixel, the present application first obtains a mask image color channel value of the position of the pixel to be processed in the mask image at the current moment during the lock screen process, and when the mask image color channel value is greater than or equal to a preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the mask image color channel value is less than the mask threshold, the color of the pixel to be processed maintains the color in the original image, that is, the mask image is used to make the blocked part only display the original image, and not the frosted effect, thereby effectively simulating the frosted multi-region diffusion effect, and obtaining an effect of rapid freezing and spreading ice.
[0036] For example, the lock screen texture is lockTex, the mask texture is maskTex, the current mask threshold is maskThreshold, and the texture coordinates of the pixel to be processed are lockUV. The final color finalColor at this position is calculated as follows: mask=texture(maskTex,lockUV).r Among them, texture is the texture sampling function, and offsetColor is the calculated frosted glass color, which is the color of the target pixel.
[0037] Optionally, in the process from screen off to screen lock (or from desktop to screen lock), the value of mask threshold maskThreshold gradually changes from 1 to 0. When the mask value of the mask image color channel value mask is less than the mask threshold maskThreshold, the frosted effect is not displayed at that position; when the mask value of the mask image color channel value mask is greater than or equal to the mask threshold maskThreshold, the frosted effect is displayed at that position. When maskThreshold is 1, the mask values of all positions are less than maskThreshold, and no frosted effect is displayed at all positions; when maskThreshold is 0, the mask values of all positions are greater than or equal to maskThreshold, and all positions display frosted effects.
[0038] The method of the above embodiment obtains a mask image color channel value of the position of the pixel to be processed in the mask image at the current moment during the screen lock process, and when the mask image color channel value is greater than or equal to the preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the mask image color channel value is less than the mask threshold, the color of the pixel to be processed remains the color in the original image. That is, the mask image is used to block part of the area, so that the blocked part only shows the original image and does not show the frosted effect, thereby simulating the frosted multi-area diffusion effect, and obtaining a rapid freezing and ice spreading effect.
[0039] In one embodiment, the weight for determining the pixel position offset is a preset offset strength. Therefore, determining the pixel position offset in two directions perpendicular to each other in a rectangular coordinate system according to the first grayscale difference and the second grayscale difference includes: multiplying the first grayscale difference and the second grayscale difference by a preset offset strength respectively to obtain the initial pixel position offset in two directions perpendicular to each other in the rectangular coordinate system; The pixel position offsets in two mutually perpendicular directions of the rectangular coordinate system are determined according to the initial pixel position offset and the preset boundary constraint.
[0040] Specifically, after determining the first grayscale difference between the pixel A to be processed and the first adjacent pixel, and the second grayscale difference between the pixel A to be processed and the second adjacent pixel, an embodiment of the present application first multiplies the first grayscale difference and the second grayscale difference by a preset offset strength, respectively, to obtain the initial pixel position offset in two directions perpendicular to each other in the rectangular coordinate system; then, the initial pixel position offset is processed through a preset boundary constraint to effectively limit the value range of the pixel position offset, so that the pixel position offset is more reasonable, which can effectively enhance the dynamic frosted glass effect of the wallpaper.
[0041] For example, for each frame of the original image, the color of a pixel at any position on the screen is determined by the color of the original image pixel at that position and the grayscale value of the grayscale image.
[0042] Assume that the lock screen texture is lockTex, the grayscale texture is grayTex, the width and height of the grayscale texture are grayWidth and grayHeight respectively, the offset strength is offsetStrength, the boundary constraint is clamp, and the texture coordinates of the pixel to be processed are lockUV, then the color offsetColor at this position is calculated as follows: du=1 / grayWidth dv=1 / grayHeight gray1=getGray(grayTex,lockUV) gray2=getGray(grayTex,lockUV-(du,0)) gray3=getGray(grayTex,lockUV-(0,dv)) dx=gray2-gray1 dy=gray3-gray1 uv1=lockUV+(dx,dy)*offsetStrength uv2.x = clamp(uv1.x, 0, 1) uv2.y=clamp(uv1.y,0,1) Among them, getGray is a grayscale sampling function; gray1 is the grayscale value of the pixel to be processed; gray2 is the grayscale value of the first adjacent pixel; gray3 is the grayscale value of the second adjacent pixel; dx is the grayscale difference between the first adjacent pixel and the pixel to be processed; dy is the grayscale difference between the second adjacent pixel and the pixel to be processed; (dx, dy)*offsetStrength is the initial pixel position offset; optionally, in one embodiment of the present application, offsetStrength takes the value of (0.1, 0.1); uv2.x and uv2.y represent the second coordinates of the target pixel after boundary constraints; offsetColor represents the color of the pixel to be processed in the wallpaper image.
[0043] The method of the above embodiment determines and optimizes the initial pixel position offset through offset strength and boundary constraints, effectively limits the value range of the pixel position offset, makes the pixel position offset more reasonable, and can effectively enhance the dynamic frosted glass effect of the wallpaper.
[0044] In one embodiment, wallpaper parameters are modified based on an animation thread; the wallpaper parameters include a minimum grayscale value and a mask threshold; and the original image is rendered based on a rendering thread and the wallpaper parameters.
[0045] Specifically, in one embodiment of the present application, the rendering of the wallpaper is implemented using OpenGL ES, and each frame is rendered in the onDrawFrame method of GLSerfaceView.Renderer. Among them, the animation thread is responsible for modifying the parameters of the wallpaper, such as the minimum grayscale minGray and the mask threshold maskThreshold; the rendering thread renders the picture according to the current wallpaper parameters, thereby realizing the animation following effect. Optionally, in the process from turning off the screen to locking the screen (or from the desktop to the lock screen), the density of the frosting gradually increases, and the frosted area gradually expands, which correspond to the changes in the minimum grayscale minGray and the mask threshold maskThreshold, respectively, and both change from 1 to 0. That is, in one embodiment of the present application, the wallpaper parameters of the minimum grayscale value minGray and the mask threshold maskThreshold are modified from 1 to 0 based on the animation thread, and the frosted glass animation can be realized quickly and accurately based on the rendering thread.
[0046] The method of the above embodiment, in the process of switching from screen off to lock screen (or from desktop to lock screen), modifies the wallpaper parameter minimum grayscale value minGray and mask threshold maskThreshold from 1 to 0 based on the animation thread, and the rendering thread renders according to the current wallpaper parameters, so that the frosted density gradually increases and the frosted area gradually expands, thereby realizing frosted glass animation quickly and accurately.
[0047] For example, Figure 2 As shown, in one embodiment of the present application, a wallpaper realization method is provided, and the specific process is as follows: (1) the minimum grayscale value is gradually changed within a preset minimum grayscale value range, and the maximum value between a color channel value of a pixel and the minimum grayscale value is used as the grayscale value of the pixel; that is, the grayscale value of the pixel to be processed in the original image is determined by the "grayscale reduction method". Optionally, the image grayscale map is as follows Figure 3 shown.
[0048] (2) By obtaining the first grayscale difference between the pixel to be processed and the first adjacent pixel in the original image, and the second grayscale difference between the pixel to be processed and the second adjacent pixel, the pixel position offset in two directions perpendicular to each other in the rectangular coordinate system and the second coordinate of the target pixel are determined, and the color offsetColor of the target pixel is used as the color of the pixel to be processed in the wallpaper image. That is, the coordinates of the original image are offset based on the grayscale difference between the pixel to be processed and the adjacent pixel in the original image, so as to achieve the dynamic frosted glass effect of the wallpaper.
[0049] (3) Obtain a mask image color channel value of the pixel position to be processed in the mask image at the current moment during the screen lock process; Optionally, the mask image is as follows Figure 4 As shown in the figure; when the mask color channel value mask is greater than or equal to the preset mask threshold maskThreshold, the color offsetColor of the target pixel is used as the color finalColor of the pixel to be processed in the wallpaper image; when the mask color channel value mask is less than the mask threshold maskThreshold, the color finalColor of the pixel to be processed is the same as the color originColor in the original image. That is, the mask image is used to block part of the area, so that the blocked part only shows the original image, not the frosted effect, thereby simulating the frosted multi-area diffusion effect, and obtaining a rapid freezing and ice spreading effect.
[0050] In the method of the above embodiment, a layer of frosted glass filter effect is provided on the terminal wallpaper, and the frosted particles gradually become denser, and the frosted range gradually spreads from multiple areas to the full screen, and the effect is as follows: Figure 5 As shown, it effectively solves the problems of matte filter rendering, matte particle density change, multi-area matte diffusion, etc., bringing a better interactive experience.
[0051] The wallpaper realization device provided by the present invention is described below. The wallpaper realization device described below and the wallpaper realization method described above can be referenced to each other.
[0052] Figure 6 : is a schematic diagram of the structure of the wallpaper realization device provided by the present invention. The wallpaper realization device provided in this embodiment includes: The acquisition module 610 is used to acquire, for any pixel to be processed in the original image, a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in a rectangular coordinate system of the original image; A first determination module 620, configured to determine pixel position offsets in two directions perpendicular to each other in a rectangular coordinate system according to the first grayscale difference and the second grayscale difference; A second determination module 630 is used to obtain a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; The third determination module 640 is used to determine the color of the pixel to be processed in the wallpaper image according to the color of the target pixel.
[0053] Optionally, the acquisition module 610 is further used to: The grayscale value of any pixel in the original image is determined as follows: Determine a color channel value of a pixel; The grayscale value of the pixel is determined according to the size relationship between the color channel value and a minimum grayscale value; wherein, during a screen lock process, the minimum grayscale value gradually changes within a preset minimum grayscale value range. Optionally, the acquisition module 610 is specifically configured to: The maximum value between the color channel value and the minimum grayscale value is used as the grayscale value of the pixel.
[0054] Optionally, the third determining module 640 is specifically configured to: Get a mask image color channel value of the pixel position to be processed in the mask image at the current moment during the screen lock process; When the color channel value of the mask image is greater than or equal to the preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the color channel value of the mask image is less than the mask threshold, the color of the pixel to be processed remains the color in the original image; wherein, during a screen lock process, the mask threshold gradually changes within a preset mask threshold range.
[0055] Optionally, the first determining module 620 is specifically configured to: The first grayscale difference and the second grayscale difference are respectively multiplied by a preset offset strength to obtain initial pixel position offsets in two directions perpendicular to each other in a rectangular coordinate system; The pixel position offsets in two mutually perpendicular directions of the rectangular coordinate system are determined according to the initial pixel position offset and the preset boundary constraint.
[0056] Optionally, the third determining module 640 is further configured to: Modify wallpaper parameters based on animation thread; wallpaper parameters include minimum grayscale value and mask threshold; Renders the original image based on the rendering thread and wallpaper parameters.
[0057] The device of the embodiment of the present invention is used to execute the method in any of the aforementioned method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0058] Figure 7The physical structure diagram of an electronic device is illustrated, and the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the wallpaper implementation method, which includes: for any pixel to be processed in the original image, obtaining the first grayscale difference between the pixel to be processed and the first adjacent pixel, and the second grayscale difference between the pixel to be processed and the second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two mutually perpendicular directions of the rectangular coordinate system of the original image; according to the first grayscale difference and the second grayscale difference, determining the pixel position offset in two mutually perpendicular directions of the rectangular coordinate system; according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system, obtaining the second coordinate of a target pixel in the original image; according to the color of the target pixel, determining the color of the pixel to be processed in the wallpaper image.
[0059] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0060] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the wallpaper implementation method provided by the above-mentioned methods, which method includes: for any pixel to be processed in the original image, obtaining a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in the rectangular coordinate system of the original image; according to the first grayscale difference and the second grayscale difference, determining the pixel position offset in two directions perpendicular to each other in the rectangular coordinate system; according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system, obtaining the second coordinate of a target pixel in the original image; according to the color of the target pixel, determining the color of the pixel to be processed in the wallpaper image.
[0061] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the wallpaper implementation methods provided above, the methods comprising: for any pixel to be processed in the original image, obtaining a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; the first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in the rectangular coordinate system of the original image; determining a pixel position offset in two directions perpendicular to each other in the rectangular coordinate system based on the first grayscale difference and the second grayscale difference; obtaining a second coordinate of a target pixel in the original image based on the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; and determining the color of the pixel to be processed in the wallpaper image based on the color of the target pixel.
[0062] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0064] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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. However, 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 invention.
Claims
1. A wallpaper realization method, characterized in that: include: For any pixel to be processed in the original image, obtaining a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; The first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in the rectangular coordinate system of the original image; Determining pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system according to the first grayscale difference and the second grayscale difference; Acquire a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; The color of the pixel to be processed in the wallpaper image is determined according to the color of the target pixel.
2. The wallpaper realization method according to claim 1, characterized in that: The method further comprises: The grayscale value of any pixel in the original image is determined based on the following method: determining a color channel value of the pixel; The grayscale value of the pixel is determined according to the size relationship between the color channel value and a minimum grayscale value; wherein, during a screen lock process, the minimum grayscale value gradually changes within a preset minimum grayscale value range.
3. The wallpaper realization method according to claim 2, characterized in that: Determining the grayscale value of the pixel according to the size relationship between the color channel value and a minimum grayscale value includes: The maximum value between the color channel value and the minimum grayscale value is used as the grayscale value of the pixel.
4. The wallpaper realization method according to claim 3, characterized in that: The step of determining the color of the pixel to be processed in the wallpaper image according to the color of the target pixel includes: Obtain a mask image color channel value of the pixel position to be processed in the mask image at the current moment during the screen lock process; When the color channel value of the mask image is greater than or equal to a preset mask threshold, the color of the target pixel is used as the color of the pixel to be processed in the wallpaper image; when the color channel value of the mask image is less than the mask threshold, the color of the pixel to be processed remains the color in the original image; wherein, during a screen lock process, the mask threshold changes gradually within a preset mask threshold range.
5. The wallpaper realization method according to claim 4, characterized in that: Determining the pixel position offset in two directions perpendicular to each other in the rectangular coordinate system according to the first grayscale difference and the second grayscale difference includes: Multiplying the first grayscale difference and the second grayscale difference by a preset offset strength respectively to obtain initial pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system; The pixel position offsets in two mutually perpendicular directions of the rectangular coordinate system are determined according to the initial pixel position offset and the preset boundary constraint.
6. The wallpaper realization method according to claim 4 or 5, characterized in that: The method further comprises: Modify wallpaper parameters based on the animation thread; the wallpaper parameters include the minimum grayscale value and the mask threshold; The original image is rendered based on the rendering thread and the wallpaper parameters.
7. A wallpaper realization device, characterized in that: include: An acquisition module, used for acquiring, for any pixel to be processed in the original image, a first grayscale difference between the pixel to be processed and a first adjacent pixel, and a second grayscale difference between the pixel to be processed and a second adjacent pixel; The first adjacent pixel and the second adjacent pixel are adjacent to the pixel to be processed in two directions perpendicular to each other in the rectangular coordinate system of the original image; A first determining module, configured to determine pixel position offsets in two directions perpendicular to each other in the rectangular coordinate system according to the first grayscale difference and the second grayscale difference; A second determination module, configured to obtain a second coordinate of a target pixel in the original image according to the pixel position offset and the first coordinate of the pixel to be processed in the rectangular coordinate system; The third determination module is used to determine the color of the pixel to be processed in the wallpaper image according to the color of the target pixel.
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 program, the steps of the wallpaper realization method according to any one of claims 1 to 6 are implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the wallpaper realization method according to any one of claims 1 to 6 are implemented.
10. A computer program product having executable instructions stored thereon, characterized in that: When the instruction is executed by the processor, the processor implements the steps of the wallpaper implementation method as described in any one of claims 1 to 6.
Citation Information
Cited By
Display method and electronic equipment
CN122019026A
Dynamic effect display method, electronic device, readable storage medium and chip
WO2026174804A1
