Wallpaper processing method, electronic device, and storage medium
By distorting the spherical lens parameters of the flat wallpaper of electronic devices, spherical wallpaper is generated, and the problem of being unable to dynamically generate spherical wallpaper in the existing technology is solved, and the richness and flexibility of wallpaper display is achieved.
Patent Information
- Application Number
- CN202510149155.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-02-11
AI Technical Summary
The existing technology cannot dynamically generate spherical wallpapers, resulting in the content of the wallpaper being displayed inflexibly.
By obtaining the flat wallpaper displayed under the first interface of the electronic device and distorting the texture coordinates based on the spherical lens parameters, spherical wallpaper is generated and displayed in the sub-display area.
It realizes dynamic conversion from flat wallpaper to spherical wallpaper, improving the richness and flexibility of wallpaper display.
Smart Images

Figure CN119668480B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and in particular, to a wallpaper processing method, an electronic device, and a storage medium. Background Art
[0002] As an important part of the personalized interface of intelligent terminals, the design and technical implementation of wallpapers have always received extensive attention from users.
[0003] Currently, the implementation of the spherical wallpaper function has, to a certain extent, met the users' needs for wallpaper personalization and dynamization. This spherical wallpaper function is mainly realized by playing a pre-produced video, lacking the ability of dynamic generation and unable to flexibly change the display content of the spherical wallpaper. Summary of the Invention
[0004] This application provides a wallpaper processing method, an electronic device, and a storage medium to solve the defect in the related art that a spherical wallpaper cannot be dynamically generated.
[0005] This application provides a wallpaper processing method applied to an electronic device, including:
[0006] In response to triggering a screen-off instruction on a first interface of the electronic device, obtaining a first wallpaper displayed on the first interface of the electronic device, where the first wallpaper is displayed in the main display area of the electronic device; and
[0007] Displaying a second wallpaper in a sub-display area of the electronic device, where the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area, and the sub-display area is located within the main display area.
[0008] According to the wallpaper processing method provided by this application, the first interface is a lock screen interface or a main display interface, the first wallpaper is a flat wallpaper of the lock screen interface or the main display interface, the main display area corresponds to the complete display area of the electronic device, the second wallpaper is a spherical wallpaper in the screen-off interface, and the sub-display area is a display area located within the main display area;
[0009] The displaying the second wallpaper in the sub-display area of the electronic device includes:
[0010] Obtaining first lens parameters of a spherical lens used to convert the spherical wallpaper, where the spherical lens corresponds to the sub-display area;
[0011] Based on the first lens parameters, performing distortion processing on the texture coordinates of the flat wallpaper to obtain first distorted coordinates of the texture coordinates mapped under the spherical lens;
[0012] Generate the spherical wallpaper based on the first distorted coordinates obtained by mapping the texture coordinates under the spherical lens.
[0013] Display the first process of converting the planar wallpaper to the spherical wallpaper in the sub-display area of the electronic device.
[0014] According to a wallpaper processing method provided by the present application, the first lens parameters include the central offset, distortion radius, and distortion intensity of the spherical lens. The central offset and the distortion intensity increase with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface, and the distortion radius decreases with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface.
[0015] The distortion processing of the texture coordinates of the planar wallpaper based on the first lens parameters to obtain the first distorted coordinates mapped to the spherical lens includes:
[0016] Determine the current central position of the spherical lens based on the initial central position of the spherical lens, the central offset, and the aspect ratio of the width and height of the main display area of the electronic device.
[0017] Establish a vector pointing from the current central position to the texture coordinates.
[0018] Calculate the vector scaling factor of the vector based on the vector, the distortion intensity, and the distortion scaling coefficient determined by the distortion radius.
[0019] Scale the vector using the vector scaling factor, and determine the first distorted coordinates mapped to the spherical lens based on the scaled vector and the current central position.
[0020] According to a wallpaper processing method provided by the present application, the distortion scaling coefficient is related to the smaller value of the distortion radius and the radius threshold.
[0021] According to a wallpaper processing method provided by the present application, the calculation of the vector scaling factor of the vector based on the vector, the distortion intensity, and the distortion scaling coefficient determined by the distortion radius includes:
[0022] Determine the intensity scaling factor of the texture coordinates based on the vector and the distortion intensity.
[0023] Determine the vector scaling factor of the vector based on the intensity scaling factor of the texture coordinates and the distortion scaling coefficient determined by the distortion radius.
[0024] According to a wallpaper processing method provided by the present application, before determining the first distorted coordinates of the texture coordinates mapped under the spherical lens based on the scaled vector and the current center position, the method further includes:
[0025] Based on the aspect ratio of the main display area of the electronic device, determine the width scaling factor of the texture coordinates in the width direction of the main display area;
[0026] Based on the width scaling factor, adjust the components of the texture coordinates in the width direction of the main display area.
[0027] According to a wallpaper processing method provided by the present application, the determining the current center position of the spherical lens based on the initial center position of the spherical lens, the center offset, and the aspect ratio of the main display area of the electronic device includes:
[0028] Based on the aspect ratio of the main display area of the electronic device, determine the width scaling factor of the center position coordinates of the spherical lens in the width direction of the main display area;
[0029] Take the center point of the main display area as the initial center position of the spherical lens, and based on the initial center position of the spherical lens and the center offset of the spherical lens, determine the candidate center position of the spherical lens;
[0030] Based on the width scaling factor, adjust the components of the candidate center position in the width direction of the main display area to obtain the current center position of the spherical lens.
[0031] According to a wallpaper processing method provided by the present application, the first lens parameter further includes a rotation angle, and the rotation angle changes periodically with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface;
[0032] The generating the spherical wallpaper based on the first distorted coordinates of the texture coordinates mapped under the spherical lens includes:
[0033] Based on the center offset of the spherical lens and the rotation angle, translate and rotate the first distorted coordinates to obtain the current spherical coordinates;
[0034] Based on the current spherical coordinates, generate the spherical wallpaper at the current moment.
[0035] According to a wallpaper processing method provided by the present application, the translating and rotating the first distorted coordinates based on the center offset of the spherical lens and the rotation angle to obtain the current spherical coordinates includes:
[0036] Map the first distorted coordinate from the first interval to the second interval;
[0037] Translate the first distorted coordinate within the second interval based on the center offset to obtain a translated second distorted coordinate;
[0038] Offset the translated second distorted coordinate to obtain an offset second distorted coordinate, where the degree of the offset is determined according to the deviation between the rotation center and the current center position;
[0039] Adjust the texture coordinate density of the offset second distorted coordinate in the width direction of the main display area of the electronic device using the aspect ratio of the main display area to obtain a third distorted coordinate;
[0040] Rotate the third distorted coordinate based on the rotation angle to obtain a rotated third distorted coordinate;
[0041] Restore the texture coordinate density of the rotated third distorted coordinate in the width direction of the main display area and cancel the offset of the rotated third distorted coordinate;
[0042] Map the third distorted coordinate after restoring the texture coordinate density and canceling the offset back to the first interval to obtain the current spherical coordinate.
[0043] According to a wallpaper processing method provided by the present application, it further includes:
[0044] Overlay a shadow on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens.
[0045] According to a wallpaper processing method provided by the present application, it further includes:
[0046] Offset and rotate the original shadow texture coordinates corresponding to the spherical lens based on the center offset of the spherical lens and the shadow rotation angle to obtain the shadow texture coordinates.
[0047] According to a wallpaper processing method provided by the present application, the offsetting and rotating the original shadow texture coordinates corresponding to the spherical lens based on the center offset of the spherical lens and the shadow rotation angle to obtain the shadow texture coordinates includes:
[0048] Map the original shadow texture coordinates from the first interval to the third interval, and translate the shadow texture coordinates within the third interval based on the center offset of the spherical lens to obtain shadow translation coordinates;
[0049] Scale the shadow translation coordinates based on the aspect ratio of the main display area of the electronic device and the distortion radius of the spherical lens to obtain shadow scaled coordinates;
[0050] Rotate the shadow scaled coordinates based on the shadow rotation angle to obtain shadow rotated coordinates;
[0051] Map the shadow rotated coordinates back to the first interval to obtain the shadow texture coordinates.
[0052] According to a wallpaper processing method provided by the present application, the overlaying a shadow on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens includes:
[0053] Sample color information from the texture image of the planar wallpaper based on the first distortion coordinate;
[0054] Sample shadow intensity information from the shadow texture corresponding to the spherical lens based on the shadow texture coordinates;
[0055] Mix the color information and black based on the shadow intensity information and the shadow ratio;
[0056] The shadow ratio increases as the electronic device changes from the lock screen interface or the main display interface to the screen-off interface.
[0057] According to a wallpaper processing method provided by the present application, the sampling color information from the texture image of the planar wallpaper based on the first distortion coordinate includes:
[0058] Sample the original color information from the texture image of the planar wallpaper that has been blurred based on the first distortion coordinate;
[0059] Adjust the saturation of the original color information based on the shadow ratio to obtain the color information.
[0060] According to a wallpaper processing method provided by the present application, the distorting the texture coordinates of the planar wallpaper based on the first lens parameter to obtain the first distortion coordinate of the texture coordinates mapped under the spherical lens includes:
[0061] Distort the texture coordinates of the texture image of the planar wallpaper that has been blurred based on the first lens parameter to obtain the first distortion coordinate of the texture coordinates mapped under the spherical lens;
[0062] The blur radius used for the blurring process increases as the electronic device changes from the lock screen interface or the main display interface to the screen-off interface.
[0063] A wallpaper processing method provided by the present application, the obtaining of the first lens parameters of the spherical lens used for converting the spherical wallpaper includes:
[0064] Obtaining the first lens parameters at the current animation progress from the parameter range corresponding to the animation process of converting the planar wallpaper into the spherical wallpaper;
[0065] The generating of the spherical wallpaper includes:
[0066] Generating the spherical wallpaper at the current animation progress.
[0067] A wallpaper processing method provided by the present application further includes:
[0068] In response to triggering a screen-on instruction on the screen-off interface of the electronic device, obtaining second lens parameters, where the second lens parameters include the center offset, distortion radius, and distortion intensity of the spherical lens, and the center offset and the distortion intensity decrease as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface, and the distortion radius increases as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface;
[0069] Displaying the second process of converting the spherical wallpaper to the planar wallpaper in the sub-display area of the electronic device.
[0070] The present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the wallpaper processing method as described in any one of the above.
[0071] The present application further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the wallpaper processing method as described in any one of the above.
[0072] The present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the wallpaper processing method as described in any one of the above.
[0073] The wallpaper processing method, electronic device, and storage medium provided by the present application realize the dynamic conversion from the first wallpaper to the second wallpaper by mapping the first wallpaper from the main display area to the sub-display area and displaying it, improving the richness and flexibility of wallpaper display. Description of the Drawings
[0074] To more clearly illustrate the technical solutions in the present application or related technologies, the following will briefly introduce the drawings required for use in the embodiments or descriptions of related technologies. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0075] Figure 1 It is a schematic structural diagram of the terminal provided by an embodiment of the present application.
[0076] Figure 2 It is one of the schematic flowcharts of the wallpaper processing method provided by an embodiment of the present application.
[0077] Figure 3 It is a schematic diagram of the first process of converting a planar wallpaper to a spherical wallpaper provided by an embodiment of the present application.
[0078] Figure 4 It is a schematic flowchart of displaying a spherical wallpaper in a sub-display area provided by an embodiment of the present application.
[0079] Figure 5 It is a schematic flowchart of distortion processing provided by an embodiment of the present application.
[0080] Figure 6 It is a schematic diagram of the original shadow texture provided by an embodiment of the present application.
[0081] Figure 7 It is a schematic flowchart of Gaussian blur provided by an embodiment of the present application.
[0082] Figure 8 It is another schematic flowchart of the wallpaper processing method provided by an embodiment of the present application.
[0083] Figure 9 It is a schematic diagram of a spherical wallpaper with a superimposed shadow provided by an embodiment of the present application.
[0084] Figure 10 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0085] To make the objectives, technical solutions, and advantages of the present application clearer, the following will clearly and completely describe the technical solutions in the present application with reference to the accompanying drawings in the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0086] The terms "first", "second", etc. in the description and claims of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances, so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same category, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the description and claims means at least one of the connected objects, and the character " / " generally means an "or" relationship between the associated objects before and after.
[0087] As an important part of the personalized interface of smart terminals, the design and technical implementation of wallpapers have always received extensive attention from users.
[0088] Currently, some manufacturers have launched a spherical wallpaper function, which to a certain extent meets the user's needs for wallpaper personalization and dynamicization. This spherical wallpaper function is mainly realized by playing a pre-produced video, and the video content mainly shows operations such as translation, rotation, and scaling on spherical objects, specifically usually spherical objects such as planets or other spherical objects. These operations all belong to the category of linear transformation, that is, the pixel points in the video image are transformed according to a fixed linear relationship, thus realizing a simple dynamic effect.
[0089] Although the existing spherical wallpaper function has achieved certain breakthroughs in visual effects, it still has certain limitations.
[0090] Specifically, the existing implementation scheme of spherical wallpapers mainly relies on pre-produced video files, lacks the ability to further process video content or dynamically generate, and cannot flexibly change the display content of spherical wallpapers.
[0091] Moreover, although linear transformation can achieve basic image transformation, it has obvious deficiencies in simulating complex light and shadow effects and object shape changes in the real world. Due to only using linear transformation operations, the dynamic effect of the wallpaper is relatively single, lacking sufficient diversity and depth.
[0092] Therefore, this application provides a wallpaper processing method, which performs non-linear distortion processing on the texture coordinates of a planar wallpaper based on a spherical lens to realize the conversion from a planar wallpaper to a spherical wallpaper, greatly improving the flexibility and richness of the images contained in the spherical wallpaper. Moreover, compared with the linear transformation conversion method, through non-linear distortion, the texture image of the planar wallpaper can be mapped onto a more three-dimensional and deep spherical model to enhance the visual impact of the spherical wallpaper on viewers.
[0093] The wallpaper processing method provided by the embodiments of the present application can be applied to an electronic device, specifically, it can be applied to terminals such as mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. It can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. The embodiments of the present application do not impose any restrictions on the specific type of the terminal.
[0094] For example, the terminal can be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with wireless communication capabilities, a computing device, or other processing devices connected to a wireless modem, a computer, a laptop computer, a handheld communication device, a handheld computing device, and / or other devices for communicating on a wireless system, as well as next-generation communication systems, such as mobile terminals in a 5G network, mobile terminals in a future evolved Public Land Mobile Network (PLMN), or mobile terminals in a future evolved Non-terrestrial Network (NTN).
[0095] By way of example and not limitation, when the terminal is a wearable device, the wearable device can also be a general term for devices that apply wearable technology to the intelligent design of daily wear and develop wearable devices, such as gloves, watches, AR (Augmented Reality) head-mounted display devices, VR (Virtual Reality) head-mounted display devices, or MR (Mixed Reality) head-mounted display devices configured with far-field communication modules and / or near-field communication modules.
[0096] In some embodiments, the above terminal can be a mobile phone 100 having a hardware structure as Figure 1 shown, such as Figure 1As shown, the mobile phone 100 may specifically include components such as a Radio Frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a short-range wireless communication module 170, a processor 180, and a power supply 190. Those skilled in the art can understand that Figure 1 the structure of the mobile phone 100 shown in
[0097] does not limit the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Figure 1 The following specifically introduces each component of the mobile phone:
[0098] The RF circuit 110 can be used for receiving and transmitting information during information reception, call, or specifically, after receiving the downlink information of the base station, it is processed by the processor 180; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, transceiver, coupler, low noise amplifier (LNA), duplexer, etc. In addition, the RF circuit 110 can also communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, and the wireless communication can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), new radio (NR), GNSS, FM, low earth orbit satellite connection, and / or IR technology, etc. The GNSS can include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS), etc.
[0099] The memory 120 can be used to store software programs and modules. The processor 180 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 120. The memory 120 may mainly include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as pictures, audio data, phone books, etc.). In addition, the memory 120 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Specifically, the memory 120 can store pictures taken by the electronic device or downloaded through a wireless network.
[0100] The input unit 130 can be used to receive input digital or character information and generate key signal inputs related to the user settings and function controls of the mobile phone 100. Specifically, the input unit 130 may include a touch panel 131 and other input devices 132. The touch panel 131, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 131), and drive corresponding connecting devices according to a preset program. Optionally, the touch panel 131 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 180, and can receive commands sent by the processor 180 and execute them. In addition, various types such as resistive, capacitive, infrared, and surface acoustic wave can be used to implement the touch panel 131. In addition to the touch panel 131, the input unit 130 may also include other input devices 132. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0101] The display unit 140 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 140 may include a display panel 141. Optionally, the display panel 141 can be configured in the form of a liquid crystal display (LCD), a light emitting diode (LED), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), etc. Further, the touch panel 131 can cover the display panel 141. When the touch panel 131 detects a touch operation on or near it, it is transmitted to the processor 180 to determine the type of touch event. Subsequently, the processor 180 provides a corresponding visual output on the display panel 141 according to the type of touch event. Although in Figure 1 the touch panel 131 and the display panel 141 are implemented as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 131 and the display panel 141 can be integrated to realize the input and output functions of the mobile phone.
[0102] The mobile phone 100 may further include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 141 and / or the backlight when the mobile phone is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc. As for other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors that the mobile phone can also be configured with, they will not be elaborated here.
[0103] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the mobile phone. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, and the speaker 161 converts it into a sound signal for output; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and then converted into audio data. After the audio data is output to the processor 180 for processing, it is sent to another electronic device, for example, through the RF circuit 110, or the audio data is output to the memory 120 for further processing.
[0104] Communication technologies such as Wi-Fi, Bluetooth, and Near Field Communication (NFC) belong to short-range wireless transmission technologies. The mobile phone can help users send and receive emails, browse the web, and access streaming media through the short-range wireless communication module 170, which provides users with wireless broadband Internet access. The above-mentioned short-range wireless communication module 170 may include a Wi-Fi chip, a Bluetooth chip, and an NFC chip. Through the Wi-Fi chip, the mobile phone 100 can achieve the function of Wi-Fi Direct connection with other electronic devices, and the mobile phone 100 can also work in the AP mode (Access Point mode) that can provide wireless access services and allow other wireless devices to access, or work in the STA mode (Station mode) that can connect to an AP but does not accept wireless device access, so as to establish point-to-point communication between the mobile phone 100 and other Wi-Fi devices.
[0105] The processor 180 is the control center of the mobile phone, connecting various parts of the entire mobile phone through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, it executes various functions of the mobile phone and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 180 may include one or more processing units; optionally, the processor 180 may include, for example, an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0106] The mobile phone 100 also includes a power supply 190 (such as a battery) that powers each component. Preferably, the power supply can be logically connected to the processor 180 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system.
[0107] The mobile phone 100 may also include a camera. Optionally, the position of the camera on the mobile phone may be front-facing or rear-facing, and this application embodiment does not limit this.
[0108] Figure 2One of the schematic flowcharts of the wallpaper processing method provided by the embodiments of the present application, which is applied to the electronic device as described above. The method includes:
[0109] Step 210: In response to triggering a screen-off instruction on the first interface of the electronic device, obtain a first wallpaper displayed on the first interface of the electronic device, where the first wallpaper is displayed in the main display area of the electronic device.
[0110] For example, the electronic device may be the aforementioned mobile phone 100. Refer to Figure 3 the four interfaces A-D shown, which show a schematic diagram of the change from the flat wallpaper on the lock screen interface to the spherical wallpaper on the screen-off interface provided by an embodiment of the present application. Among them, the main display area 310 may refer to the area included in the display panel 141 of the mobile phone 100, that is, the area where the mobile phone 100 can provide a visual effect display for the user (or can also be called the screen or window). In some examples, the display panel 141 may also be provided on the back of the mobile phone 100. At this time, the main display area 310 may also refer to the display area on the back of the mobile phone 100.
[0111] In some examples, the first interface may be the lock screen interface or the main display interface of the mobile phone 100. The main display interface refers to the interface that the mobile phone 100 enters from, for example, the lock screen interface or the screen-off interface. On the main display interface, the mobile phone 100 can arrange and display installed application icons, smart cards or other suitable displayed content. On the main display interface, the user can open applications through instructions to implement various functions such as calling, payment, shooting, and social networking. The first wallpaper is a flat wallpaper displayed on the lock screen interface or the main display interface. The first wallpapers displayed in the above two interfaces may be the same wallpaper or different wallpapers. The flat wallpaper means that the first wallpaper is a two-dimensional image and can be displayed in the main display area 310. For example, refer to Figure 3 A shown in, where the first display interface is the lock screen interface of the mobile phone 100, and a lock screen wallpaper is displayed on this lock screen interface.
[0112] The screen-off instruction may be a touch instruction, a voice instruction, a gesture instruction or other suitable instructions. For example, the screen-off instruction instructs the mobile phone 100 to change from the lock screen interface to the screen-off interface, or the screen-off instruction instructs the mobile phone 100 to change from the main display interface to the screen-off interface. For example, it can be in Figure 3 the lock screen interface shown in A, touch the "Screen off" button below to realize the change from the lock screen interface to the screen-off interface.
[0113] Step 220: Display a second wallpaper in the sub-display area of the electronic device, where the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area, and the sub-display area is located within the main display area.
[0114] In one example, the second wallpaper is a spherical wallpaper in the screen-off interface. The spherical wallpaper can be a two-dimensional image presenting a sphere. The sub-display area is a spherical area located within the main display area for displaying this spherical wallpaper. The content of the spherical wallpaper is presented according to the mapping of the first wallpaper from the main display area to the sub-display area.
[0115] See Figure 3 As shown in the interfaces of B - D in [reference], the sub-display areas 320a, 320b, and 320c are partial display areas within the main display area 310. That is, the main display area 310 is the complete display area of the mobile phone 100 that can present a visual effect, and the sub-display areas (320a, 320b, 320c) can change as the interface changes from the lock screen interface to the screen-off interface. For example, as the interface changes from the lock screen interface or the main display interface to the screen-off interface, the proportion of the sub-display areas (320a, 320b, 320c) occupying the main display area 310 becomes smaller, and the sub-display areas (320a, 320b, 320c) tend to be spherical or circular in shape.
[0116] It should be noted that the second wallpaper can be a wallpaper of other shapes, such as a non-rectangular wallpaper, such as an oval wallpaper or a special-shaped wallpaper. The sub-display area can also be a corresponding non-rectangular area, such as an oval area or a special-shaped area, to correspondingly display the second wallpaper. The description of the display shapes of the second wallpaper and the sub-display area does not constitute a limitation of this application.
[0117] Continue to refer to Figure 3 As shown in A - D in [reference], it shows the process of an exemplary mobile phone 100 changing from the lock screen interface to the screen-off interface in this application. Figure 3 A in [reference] shows a possible lock screen interface of the mobile phone 100, which includes, for example, a lock screen wallpaper, a time widget, and other widgets or touch icons providing functions. When the mobile phone 100 Figure 3 receives a screen-off instruction in the lock screen interface shown in A in [reference], for example, receives a touch instruction at the "Screen-off" icon or receives a voice instruction indicating screen-off, the mobile phone 100 will display Figure 3 the interfaces of B - D in [reference] as it changes from the lock screen interface to the screen-off interface. That is, the lock screen wallpaper will change from the main display area 310 to the sub-display areas (320a, 320b, 320c) for display. That is, the content of the lock screen wallpaper will be mapped from the main display area 310 to the sub-display areas (320a, 320b, 320c), so as to display a distorted wallpaper effect in the sub-display areas (320a, 320b, 320c). Figure 3 D in [reference] shows the final display form of the sub-display area 320c and the final second wallpaper in the screen-off interface of this example.Figure 3 The sub-display areas of A-D in it show the first process of converting from a planar wallpaper to a spherical wallpaper.
[0118] In the method provided by the embodiments of the present application, by mapping the first wallpaper from the main display area to the sub-display area to obtain and display the second wallpaper, the dynamic conversion from the first wallpaper to the second wallpaper is realized, enhancing the richness and flexibility of wallpaper display.
[0119] Figure 4 It is a schematic flowchart of displaying a spherical wallpaper in the sub-display area provided by the embodiments of the present application. As Figure 4 shown, displaying the second wallpaper in the sub-display area of the electronic device may include the following steps: Step 410, Step 420, Step 430, and Step 440. The steps of this method flow are merely a possible implementation manner of the present application.
[0120] Step 410: Obtain the first lens parameter of the spherical lens used to convert the spherical wallpaper, and the spherical lens corresponds to the sub-display area.
[0121] The process of displaying a spherical wallpaper in the sub-display area provided by the embodiments of the present application aims to realize the conversion between a planar wallpaper and a spherical wallpaper. Specifically, it can be embodied as converting from a planar wallpaper to a spherical wallpaper, or as converting from a spherical wallpaper to a planar wallpaper. It should be noted that the planar wallpaper described herein can be obtained, for example, by a processor of an electronic device fitting a texture image to a virtual model and then rendering it into a rectangular two-dimensional image, which is configured to be displayed in, for example, the window of the electronic device, so as to provide a rich visual effect for the user; the spherical wallpaper described herein is obtained by mapping the texture coordinates of the texture image of the planar wallpaper to a spherical model. The spherical model usually only occupies a partial display area of the window, for example, it is displayed in the center of the window. It can be understood that the models of the above planar wallpaper and spherical wallpaper can be three-dimensional or two-dimensional, which does not limit the present application. For example, Figure 3 B-D in it shows a schematic diagram of the spherical wallpaper provided by the embodiments of the present application. In Figure 3 B-D in it, there is a spherical surface with a visual effect, and the visual effect is jointly determined by the shape of the spherical model and the texture image mapped to the spherical model.
[0122] To realize the conversion from a planar wallpaper to a spherical wallpaper, it is necessary to apply the parameters of the spherical lens to perform non-linear distortion processing on the texture coordinates of the planar wallpaper, thereby establishing a mapping relationship between the distorted texture coordinates and the spherical lens model, so that the spherical lens model matches the distorted texture coordinates, and presenting the effect of a texture map after rendering the spherical lens model. To ensure that the distortion processing based on the spherical lens can meet the expected effect of the spherical wallpaper, the first lens parameter of the spherical lens can be determined first.
[0123] Here, the first lens parameter of the spherical lens is the parameter of the spherical lens (or called the spherical lens model) used for the spherical wallpaper. The first lens parameter describes the lens characteristics of the spherical lens, and the above-mentioned first lens parameter determines the effect of distorting the texture coordinates. The first lens parameter may specifically include parameters such as the center offset of the spherical lens, the distortion radius, and the distortion intensity, and may also include parameters such as the rotation angle of the spherical lens. The embodiments of the present application do not make specific limitations on this.
[0124] It can be understood that the spherical lens described herein needs to correspond to the aforementioned sub-display areas (320a, 320b, 320c) for display in the above sub-display areas.
[0125] Step 420: Based on the first lens parameter, perform distortion processing on the texture coordinates of the planar wallpaper to obtain the first distorted coordinates of the texture coordinates under the spherical lens.
[0126] Specifically, the texture image of the planar wallpaper can be a one-dimensional, two-dimensional, or three-dimensional image. In this article, an example is given with the texture image being a two-dimensional rectangular image, which is configured to add details of a model (such as a two-dimensional model or a three-dimensional model). The model is usually represented by a plurality of triangles composed of vertices (regardless of whether the model is a two-dimensional model or a three-dimensional model, it uses three-dimensional coordinates to represent), and each vertex needs to be associated with a texture coordinate (that is, the three-dimensional vertex coordinate corresponds to the two-dimensional texture coordinate), indicating which part of the texture image the vertex should sample from, so as to realize pasting the two-dimensional texture image onto the surface of the model.
[0127] The planar wallpaper described in this article has a corresponding texture image, and the texture image and the first model of the planar wallpaper establish a first mapping relationship. Thus, each texture coordinate of the texture image corresponds to each vertex coordinate of the first model. When the texture image is pasted onto the first model and rendered on the window of the electronic device, the above-mentioned planar wallpaper is generated. For the present application, under the action of the first lens parameter of the spherical lens (or called the second model, the spherical lens model) of the spherical wallpaper, the texture coordinates of the texture image will be distorted. The texture coordinates obtained by non-linear distortion are denoted as the first distorted coordinates in the embodiments of the present application. It can be understood that the first distorted coordinates are the texture coordinates of the texture image of the planar wallpaper mapped under the spherical lens, that is, a second mapping relationship is established between the texture coordinates of the texture image and the spherical lens, so that the texture image can be completely pasted onto the spherical lens.
[0128] Here, distortion processing is performed. Specifically, it can be a process of applying a transformation function determined based on the first lens parameters of a spherical lens to map each texture coordinate of the texture image to the spherical lens, which can also be understood as a process of mapping the texture coordinate grid (such as a rectangular coordinate grid) of the texture image to a spherical grid.
[0129] It should be noted that distortion processing refers to performing a non-linear operation on the texture coordinates to achieve the effect of converting from a rectangular plane wallpaper described in this article to other shapes such as circular, oval, or other irregular-shaped wallpapers.
[0130] Step 430: Generate the spherical wallpaper based on the first distorted coordinates obtained by mapping the texture coordinates to the spherical lens.
[0131] Specifically, after obtaining the first distorted coordinates, the texture coordinates of the planar wallpaper texture image can be directly mapped to the corresponding first distorted coordinates, thereby establishing the mapping relationship between the texture image and the spherical lens, that is, establishing the mapping relationship between the vertex coordinates of the spherical lens and the first distorted coordinates of the texture image. When rendering the spherical lens, the corresponding first distorted coordinates are used to sample from the texture image to obtain the spherical pattern in the spherical wallpaper, and then the spherical wallpaper is generated.
[0132] Step 440: Display the first process of converting the planar wallpaper to the spherical wallpaper in the sub-display area of the electronic device.
[0133] See Figure 3 A - D in and the corresponding descriptions above. After generating a spherical wallpaper, it can be displayed in the corresponding sub-display areas (320a, 320b, 320c) to implement the above first process.
[0134] In the embodiments of the present application, non-linear distortion processing is performed on the texture coordinates of the planar wallpaper based on a spherical lens to achieve the conversion from the planar wallpaper to the spherical wallpaper, which greatly improves the flexibility and richness of the images contained in the spherical wallpaper. Moreover, compared with the conversion method of linear transformation, through non-linear distortion, the texture image of the planar wallpaper can be mapped to a more three-dimensional and deep spherical model to enhance the visual impact of the spherical wallpaper on viewers.
[0135] It should be noted that each embodiment of the present application can be freely combined, the order can be swapped, or each can be executed independently, and does not need to rely on or depend on a fixed execution order.
[0136] It should be noted that for an electronic device, the locked screen and the screen-off are two different display states. Among them, the locked screen interface refers to the interface displayed by the electronic device when it is not unlocked. The locked screen interface usually includes elements such as time, date, notification information, etc., and may also have some shortcut operation buttons, such as a camera, a flashlight, etc. When the electronic device is in the locked screen interface, the user needs to unlock the electronic device by entering a password, fingerprint, face recognition, etc. to enter the main interface or use other functions.
[0137] In the locked screen interface, the user can trigger the screen-off of the electronic device, or when the electronic device stays in the locked screen interface for a period of time and the user does not operate the electronic device, the electronic device can also automatically turn off the screen. The screen-off here means that the main display area of the electronic device displays less content compared to the locked screen interface, so as to achieve the effect of saving power and extending the battery life of the electronic device.
[0138] Here, the screen-off instruction triggered in the locked screen interface can be issued by the user pressing the power button of the electronic device, or touching the screen-off shortcut key on the main display area of the electronic device, etc., or can also be automatically triggered by the electronic device when it has not received user operations for a long time. The embodiments of the present application do not make specific limitations on this.
[0139] When the screen-off instruction in the locked screen interface is detected, the screen-off instruction can be responded to. The response method here is to obtain the first lens parameter of the spherical lens, thereby realizing the conversion from the flat wallpaper displayed in the locked screen interface to the spherical wallpaper displayed in the screen-off interface.
[0140] It can be understood that the foregoing content does not mean that the wallpaper processing method described in this article must be applied to the change process from the locked screen interface to the screen-off interface. The wallpaper processing method described in this article can also be applied to the change process from the main display interface to the screen-off interface, or the change process from other suitable display interfaces to the screen-off interface.
[0141] In some embodiments, the first lens parameter includes the center offset, distortion radius, and distortion intensity of the spherical lens. The center offset and the distortion intensity increase with the progress of the electronic device changing from the locked screen interface or the main display interface to the screen-off interface, and the distortion radius decreases with the progress of the electronic device changing from the locked screen interface or the main display interface to the screen-off interface.
[0142] Among them, the center offset of the spherical lens refers to the degree of offset between the optical axis and the mechanical axis of the spherical lens, including translation or tilt. In the non-linear distortion processing based on the spherical lens, the magnitude of the center offset determines the degree of tilt or offset of the flat wallpaper.
[0143] The distortion radius is usually used to describe the degree and range of image distortion when a spherical lens forms an image, that is, the distortion radius can reflect the distribution range of non-linear distortion processing in a planar wallpaper. The larger the distortion radius, the more extensive the non-linear distortion processing, and the more obvious the distortion at the edge of the planar wallpaper.
[0144] The distortion intensity is used to quantify the degree of image distortion when a spherical lens forms an image. In non-linear distortion processing, the greater the distortion intensity, the stronger the degree of change in the shape and proportion of the image of the planar wallpaper.
[0145] For the case where the screen-off instruction triggers the transformation from a planar wallpaper to a spherical wallpaper, during the process of converting from a planar wallpaper to a spherical wallpaper, the value of the first lens parameter can change according to the progress of the electronic device changing from the lock screen interface or the main display interface showing the planar wallpaper to the screen-off interface showing the spherical wallpaper, so as to achieve the dynamic effect of the gradual change of the wallpaper image.
[0146] During this process, the center offset and the distortion intensity increase with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface, that is, the closer to the final screen-off interface, the higher the degree of offset of the non-linear distortion for the planar wallpaper, the greater the intensity of the non-linear distortion for the planar wallpaper, and the more obvious the deformation of the planar wallpaper. For example, during this process, the center offset of the spherical lens can gradually move from the center of the main display area (0.5, 0.5) to (0.5, 0.165), and the distortion intensity can change from 0 to 40.9.
[0147] In addition, during this process, the distortion radius decreases with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface, that is, the closer to the final screen-off interface, the smaller the distortion radius of the non-linear distortion for the planar wallpaper, and the clearer the edge of the spherical pattern in the converted spherical wallpaper. For example, during this process, the distortion radius of the spherical lens can change from 1.3 to 0.22.
[0148] In this case, Figure 5 is a schematic flowchart of the distortion processing provided by an embodiment of the present application. As Figure 5 shown, in step 420, the distortion processing of the texture coordinates of the planar wallpaper based on the first lens parameter to obtain the first distorted coordinates of the texture coordinates mapped under the spherical lens includes step 421, step 422, step 423, and step 424.
[0149] Step 421: Determine the current center position of the spherical lens based on the initial center position of the spherical lens, the center offset, and the aspect ratio of the width and height of the main display area of the electronic device.
[0150] Specifically, during the conversion of a planar wallpaper to a spherical wallpaper, the center offset of the spherical lens changes with the progress of the conversion. Therefore, it is necessary to determine the center position of the spherical lens at the current progress based on the currently determined value of the center offset, that is, the current center position.
[0151] Here, the determination of the current center position is based on the initial center position of the spherical lens, the center offset, and the aspect ratio of the main display area of the electronic device. The specific determination method can be to calculate the scaling factor of the texture coordinates of the center position coordinates of the spherical lens in the width or height direction of the main display area using the aspect ratio of the main display area, and combine the initial center position and the center offset of the spherical lens to calculate the center position when not adapted to the aspect ratio of the main display area, and then adjust the center position based on the scaling factor in the width or height direction of the main display area, thereby obtaining the current center position.
[0152] Step 422: Establish a vector pointing from the current center position to the texture coordinates.
[0153] Specifically, after obtaining the current center position, a vector can be established from the center of the current position of the spherical lens to the texture coordinates of the texture image of the planar wallpaper. Assuming the center of the current position is center and the texture coordinates are uv, the vector dire established here can be expressed in the following form:
[0154] vec2 dire = uv – center;
[0155] Here, the vector dire can represent the direction of each texture coordinate relative to the center of the current position of the spherical lens, that is, the distortion center.
[0156] In addition, when calculating uv - center, the distance between uv and center can be calculated. For the case where the distance is greater than the distortion radius, the final rendered color can be directly returned as black, that is, for the case where the distance is greater than the distortion radius, the non - linear distortion can be directly not performed for this texture coordinate.
[0157] Step 423: Calculate the vector scaling factor of the vector based on the vector, the distortion intensity, and the distortion scaling coefficient determined by the distortion radius.
[0158] Specifically, the distortion scaling coefficient is used to enhance or weaken the distortion effect and can be determined by the distortion radius. Further, the distortion scaling coefficient is generally inversely proportional to the distortion radius, that is, the larger the distortion radius, the smaller the distortion scaling coefficient.
[0159] The intensity scaling factor of the texture coordinates of the planar wallpaper can be determined by combining the vector determined in step 422 and the distortion intensity in the first lens parameter. The intensity scaling factor here is used to reflect the preliminary change in the vector modulus length after distortion. After obtaining the intensity scaling factor, the intensity scaling factor and the distortion scaling coefficient can be combined to calculate the vector scaling factor of the vector.
[0160] The vector scaling factor here is used to reflect the influence of non - linear distortion on the vector.
[0161] Step 424: Scale the vector using the vector scaling factor, and determine the first distorted coordinates of the texture coordinates mapped to the spherical lens based on the scaled vector and the current center position.
[0162] Specifically, after obtaining the vector scaling factor, the vector scaling factor can be multiplied by the vector to achieve scaling of the vector, thereby obtaining the scaled vector. On this basis, the scaled vector can be added to the current center position to achieve the center offset of the scaled vector, thereby mapping the texture coordinates of the texture image of the planar wallpaper to the spherical lens, obtaining the texture coordinates of the texture image mapped to the spherical lens, that is, obtaining the first distorted coordinates.
[0163] Here, assuming that the vector scaling factor is pho2, the vector is dire, and the current center position is center, the first distorted coordinates uv1 can be expressed in the following form:
[0164] ;
[0165] Among them, The length of the vector dire changes, while the vector direction remains unchanged, that is, distortion occurs. On this basis, adding it to center can ensure that the obtained uv1 is the coordinate with center as the center reference point.
[0166] In some embodiments, before step 420, it further includes:
[0167] Based on the aspect ratio of the main display area of the electronic device, determine the width scaling factor of the texture coordinates in the width direction of the main display area;
[0168] Based on the width scaling factor, adjust the components of the texture coordinates in the width direction of the main display area.
[0169] Specifically, assume that the aspect ratio of the main display area of the electronic device is u_aspect. After obtaining the aspect ratio u_aspect, the width scaling factor of the texture coordinates in the width direction of the main display area can be calculated, denoted as scale here. Here, the variable definition for the width scaling factor scale can be expressed as:
[0170] vec2 scale = vec2(1.0, 1.0 / u_aspect);
[0171] Here, in the calculation of the width scaling factor scale, its x component is 1.0 (without changing the horizontal ratio), and the y component is 1.0 / u_aspect, which is used to adjust the texture coordinates in the vertical direction. The width scaling factor can adjust the texture coordinates of the texture image of the plane wallpaper to match the aspect ratio of the main display area.
[0172] After obtaining the width scaling factor, in order to ensure that the change amount of the texture coordinates per unit distance in the horizontal and vertical directions of the plane wallpaper is the same, so that the shape of the image obtained after non - linear distortion is spherical, it is necessary to adjust the components of the texture coordinates of the texture image of the plane wallpaper in the width direction of the main display area based on the width scaling factor. After adjustment, the texture coordinate densities in the horizontal and vertical directions of the texture coordinates are consistent.
[0173] Here, the adjustment of the components of the texture coordinates of the texture image of the plane wallpaper in the width direction of the main display area can be expressed in the following form:
[0174] ;
[0175] Here, v_originUV is the original unadjusted texture coordinates, and uv is the adjusted texture coordinates. In specific implementation, the above formula can also be understood as dividing the y component of the original texture coordinates v_originUV by u_aspect to obtain the adjusted texture coordinates uv.
[0176] Correspondingly, after step 420 is executed and the first distorted coordinates uv1 are obtained, uv1 / scale can also be calculated to restore the texture coordinate density of the first distorted coordinates in the vertical direction.
[0177] In some embodiments, in step 421, the determining of the current center position of the spherical lens based on the initial center position of the spherical lens, the center offset amount, and the aspect ratio of the main display area of the electronic device includes:
[0178] Determine the width scaling factor of the center position coordinates of the spherical lens in the width direction of the main display area based on the aspect ratio of the main display area of the electronic device;
[0179] Take the center point of the main display area as the initial center position of the spherical lens, and determine the candidate center position of the spherical lens based on the initial center position of the spherical lens and the center offset of the spherical lens;
[0180] Adjust the component of the candidate center position in the width direction of the main display area based on the width scaling factor to obtain the current center position of the spherical lens.
[0181] Specifically, assume that the aspect ratio of the main display area of the electronic device is u_aspect. After obtaining the aspect ratio u_aspect, the width scaling factor of the center position coordinates of the spherical lens in the width direction of the main display area can be calculated, denoted as scale here. Here, the variable definition for the width scaling factor scale can be expressed as:
[0182] vec2 scale = vec2(1.0, 1.0 / u_aspect);
[0183] Here, in the calculation of the width scaling factor scale, its x component is 1.0 (without changing the horizontal ratio), and the y component is 1.0 / u_aspect, which is used to adjust the vertical texture coordinates. The width scaling factor can adjust the coordinates of the spherical lens to match the aspect ratio of the main display area.
[0184] Assume that the initial center position of the spherical lens is the center point of the main display area, denoted as vec2(0.5) here, and the center offset of the spherical lens is u_lens_translate. Then, the candidate center position of the spherical lens can be determined by combining these two, that is, the center offset can be added to the initial center position to obtain the candidate center position. The candidate center position obtained in this way is the center position that does not match the aspect ratio of the main display area and can be expressed as (vec2(0.5) - u_lens_translate).
[0185] After obtaining the width scaling factor and the candidate center position, the component of the candidate center position in the width direction of the main display area can be adjusted based on the width scaling factor, and thus the current center position of the spherical lens is obtained. Denote the current center position as center here, and it can be specifically expressed as:
[0186] ;
[0187] Here, multiplying the candidate center position (vec2(0.5) - u_lens_translate) by the width scaling factor scale realizes the scaling of the candidate center position in the width direction, so that the resulting current center position can adapt to the aspect ratio of the main display area.
[0188] In some embodiments, the distortion scaling coefficient is related to the smaller of the distortion radius and the radius threshold.
[0189] Specifically, in step 423, the distortion scaling coefficient can be determined based on the distortion radius. Further, to avoid the distortion radius being too large, resulting in the distortion scaling coefficient being too small and ensuring that the overall effect of the distortion is within an acceptable range, a radius threshold can be set. Here, the radius threshold is the maximum value of the acceptable distortion radius.
[0190] Thus, the smaller value can be determined from the distortion radius and the radius threshold, and based on the value of the smaller one, the distortion scaling coefficient can be calculated. For example, assuming the radius threshold is 0.5 and the distortion radius is u_lens_radius, the distortion scaling coefficient u_distort_scale can be expressed in the following form:
[0191] u_distort_scale = 0.25 / min(u_lens_radius, 0.5).
[0192] In some embodiments, in step 423, calculating the vector scaling factor of the vector based on the vector, the distortion intensity, and the distortion scaling coefficient determined by the distortion radius includes:
[0193] Determining the intensity scaling factor of the texture coordinates based on the vector and the distortion intensity;
[0194] Determining the vector scaling factor of the vector based on the intensity scaling factor of the texture coordinates and the distortion scaling coefficient determined by the distortion radius.
[0195] Specifically, for the texture coordinates of the texture image of the plane wallpaper, the intensity scaling factor when the spherical lens performs non - linear distortion on the texture coordinates can be calculated by combining the vector from the current center position of the spherical lens to the texture coordinates and the distortion intensity of the spherical lens. When specifically calculating, the square of the vector modulus can be calculated, and the square of the vector modulus is multiplied by the distortion intensity to reflect the influence of the distortion intensity on the vector modulus, and then the intensity scaling factor of the texture coordinates can be determined based on this, which can be specifically expressed in the following form:
[0196] ;
[0197] Wherein, pho1 is the intensity scaling factor, u_distort_strength is the distortion intensity, dot(dire, dire) calculates the dot product of the vector dire with itself, which is equivalent to the square of the magnitude of the dire vector. The 1.0 in the formula is the initial value of the intensity scaling factor, and this value decreases as increases.
[0198] It can be seen from the above formula that the smaller the value of pho1, the more obvious the distortion effect. When performing non-linear distortion processing on the texture coordinates of a texture image, this usually means that the pixels at the current center position will be affected by stronger distortion.
[0199] After obtaining the intensity scaling factor, the intensity scaling factor can be combined with the distortion scaling coefficient to calculate the vector scaling factor, which can be specifically expressed in the following form:
[0200] ;
[0201] Wherein, pho2 is the vector scaling factor, pho1 is the intensity scaling factor, and u_distort_scale is the distortion scaling coefficient. pho1 + 1.0 is to ensure that even if the value of pho1 is 0 (indicating the strongest distortion effect), pho2 will not become 0, thus avoiding the error of dividing by 0 when pho2 is used as the denominator subsequently or an infinite distortion effect. On this basis, multiplying (pho1 + 1.0) by u_distort_scale is to further adjust the intensity of the distortion effect according to the distortion radius.
[0202] In some embodiments, the first lens parameter further includes a rotation angle, and the rotation angle changes periodically with the progress of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface.
[0203] Specifically, in order to further enhance the dynamic effect of the spherical wallpaper, a rotation angle can be added to the first lens parameter. The rotation angle here can achieve the rotation of the first distorted coordinates obtained by mapping the texture coordinates onto the spherical lens, and the rotation angles at different times can be different and show a periodic change. Thus, the rotation special effect of the sphere in the spherical wallpaper during the process of changing from the lock screen interface or the main display interface to the screen-off interface and in the screen-off interface can be realized. For example, the rotation angle can change periodically from 0° to 360° with time. In addition, in order to enhance the rotation effect, the center offset of the spherical lens can be coordinated, and the center offset amount of the spherical lens can also change during the above process, for example, it can change from (0,0) to (0, 0.335).
[0204] Correspondingly, in step 430, generating the spherical wallpaper based on the first distorted coordinates mapped under the spherical lens to the texture coordinates includes:
[0205] Translating and rotating the first distorted coordinates based on the center offset and the rotation angle of the spherical lens to obtain the current spherical coordinates;
[0206] Generating the spherical wallpaper at the current moment based on the current spherical coordinates.
[0207] Specifically, after obtaining the first distorted coordinates, translation and rotation can be performed on the first distorted coordinates based on the center offset and the rotation angle of the spherical lens, thereby obtaining the coordinates after translation and rotation, denoted here as the current spherical coordinates.
[0208] After obtaining the current spherical coordinates, the mapping relationship between the texture image and the spherical lens can be established, that is, the mapping relationship between the vertex coordinates of the spherical lens and the current spherical coordinates of the texture image can be established. When rendering the spherical lens, the corresponding current spherical coordinates are used to sample from the texture image, so as to obtain the spherical pattern in the spherical wallpaper at the current moment, and then generate the spherical wallpaper at the current moment, that is, the conversion from the planar wallpaper to the spherical wallpaper is realized.
[0209] It can be understood that the translation and rotation of the first distorted coordinates here can also be understood as the translation and rotation of the spherical lens. After non-linear distortion processing, the translation and rotation of the spherical lens can be more convenient for adjusting the effect of translation and rotation.
[0210] In some embodiments, in step 430, translating and rotating the first distorted coordinates based on the center offset and the rotation angle of the spherical lens to obtain the current spherical coordinates includes:
[0211] Mapping the first distorted coordinates from the first interval to the second interval;
[0212] Translating the first distorted coordinates in the second interval based on the center offset to obtain the translated second distorted coordinates;
[0213] Offsetting the translated second distorted coordinates to obtain the offset second distorted coordinates, where the degree of offset is determined according to the deviation between the rotation center and the current center position;
[0214] Adjusting the texture coordinate density of the offset second distorted coordinates in the width direction of the main display area of the electronic device using the aspect ratio of the main display area of the electronic device to obtain the third distorted coordinates;
[0215] Rotate the third distorted coordinate based on the rotation angle to obtain the rotated third distorted coordinate;
[0216] Restore the texture coordinate density of the rotated third distorted coordinate and cancel the offset of the rotated third distorted coordinate in the width direction of the main display area;
[0217] Map the third distorted coordinate after restoring the texture coordinate density and canceling the offset back to the first interval to obtain the current spherical coordinate.
[0218] Specifically, first, after obtaining the first distorted coordinate, the first distorted coordinate can be mapped from the first interval to the second interval. Here, the first interval represents the value range interval of the common texture coordinate system, and the second interval represents the interval with symmetric value range. For example, the first interval can be [0, 1], and the second interval can be [-1, 1]. The process of mapping the first distorted coordinate from the first interval to the second interval can be expressed as:
[0219] ;
[0220] where uv is the first distorted coordinate in the first interval, and uv1 is the first distorted coordinate in the second interval. The mapping from [0, 1] to [-1, 1] is realized.
[0221] Before completing the interval mapping, the first distorted coordinate in the second interval can be translated based on the center offset to obtain the translated first distorted coordinate, denoted here as the translated second distorted coordinate uv2, which can be specifically expressed in the following form:
[0222] ;
[0223] where u_lens_translate is the center offset, scale is the width scaling factor, and the calculation method of scale can be seen above and will not be elaborated here. The translation transformation for the spherical lens is realized.
[0224] After obtaining the translated second distorted coordinate, the translated second distorted coordinate can be offset based on the deviation between the rotation center and the current center position to obtain the offset second distorted coordinate, which can be specifically expressed in the following form:
[0225] vec2 uv2’ = uv2 – offset;
[0226] Among them, uv2’ is the second distorted coordinate after offset, and offset is the deviation, specifically the offset from the rotation center to the distortion center. If offset = vec2(0.0), it means that the rotation center coincides with the distortion center. If the rotation center coincides with the distortion center (i.e., the lens center), the color of the distortion center will remain unchanged, which will result in a monotonous visual experience. Considering this situation, usually the rotation center and the distortion center are set not to coincide.
[0227] In the above formula, uv2 – offset realizes the offset of the rotation center, so that the rotation center does not coincide with the lens center, so as to enhance the dynamic visual effect.
[0228] After obtaining the second distorted coordinate after offset, the aspect ratio of the main display area of the electronic device can be used to adjust the texture coordinate density of the second distorted coordinate after offset in the width direction of the main display area, thereby obtaining the third distorted coordinate. Here, specifically, the width scaling factor scale can be determined based on the aspect ratio of the main display area of the electronic device, and then by multiplying scale by the second distorted coordinate after offset, the adjustment of the texture coordinate density in the width direction can be realized, which can be specifically expressed in the following form:
[0229] ;
[0230] Among them, uv3 is the third distorted coordinate. By adjusting the texture coordinate density in the vertical direction, the texture coordinate density of uv3 can be made consistent in the horizontal and vertical directions, avoiding becoming an ellipse during rotation.
[0231] After obtaining the third distorted coordinate, the third distorted coordinate can be rotated based on the rotation angle to obtain the rotated third distorted coordinate. Here, the rotated third distorted coordinate can be expressed in the following form:
[0232] vec2 uv3’ = rotateAngle(uv3, -u_lens_rotate);
[0233] Among them, uv3’ is the rotated third distorted coordinate. rotateAngle represents the rotation function, and u_lens_rotate represents the rotation angle.
[0234] Subsequently, based on the width scaling factor scale, the texture coordinate density of the rotated third distorted coordinate can be restored in the width direction of the main display area. In addition, based on the deviation offset during offset, the offset of the rotated third distorted coordinate can be cancelled, which can be specifically expressed in the following form:
[0235] vec2 uv4 = uv3’ / scale;
[0236] vec2 uv5 = uv4 + offset;
[0237] Among them, uv4 is the third distorted coordinate after restoring the texture coordinate density, and uv5 is the third distorted coordinate after restoring the texture coordinate density and canceling the offset.
[0238] After that, the third distorted coordinate after restoring the texture coordinate density and canceling the offset can be mapped back to the first interval, and the coordinate after being mapped back to the first interval is used as the current spherical coordinate. Specifically, it can be expressed in the following form:
[0239] vec2 uv6 = (uv5 + 1.0) / 2.0;
[0240] Among them, uv6 is the current spherical coordinate obtained hereby. Here, (uv5 + 1.0) / 2.0 realizes the mapping from [-1, 1] to [0, 1].
[0241] In some embodiments, the wallpaper processing method further includes:
[0242] Overlaying a shadow on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens.
[0243] Specifically, a three-dimensional shadow effect can be added to the spherical lens, so that the spherical pattern on the spherical wallpaper can present a more realistic visual effect. To achieve the shadow effect, on the basis of the spherical wallpaper obtained by the distortion processing based on the spherical lens, a shadow can be overlaid on the spherical pattern in the spherical wallpaper.
[0244] Here, the shadow texture coordinates corresponding to the spherical lens are the coordinates on the texture image of the shadow image adapted to the spherical lens. After determining the shadow texture coordinates corresponding to the spherical lens, a shadow can be overlaid at the position corresponding to the shadow texture coordinates on the spherical wallpaper to achieve a three-dimensional shadow effect.
[0245] In some embodiments, the wallpaper processing method further includes:
[0246] Offsetting and rotating the original shadow texture coordinates corresponding to the spherical lens based on the center offset of the spherical lens and the shadow rotation angle to obtain the shadow texture coordinates.
[0247] Specifically, in order to achieve the three-dimensional shadow effect of the spherical pattern, the original shadow texture coordinates corresponding to the spherical lens can be offset and rotated in combination with the central offset of the spherical lens and the shadow rotation angle, so that the shadow texture coordinates obtained after offset and rotation can adapt to the offset and rotation of the spherical lens itself, thereby ensuring that the shadow texture can cover the distorted lens.
[0248] Here, the original shadow texture is the texture image of the shadow image set in advance. For example, Figure 6 is the schematic diagram of the original shadow texture provided by the embodiment of the present application. As Figure 6 shown, the original shadow texture can be the texture image of a spherical shadow image, where the values of the rgb channels are all 0 (indicating black), and the value of the a channel represents the shadow intensity. The larger the value, the greater the ratio of the black shadow added to the corresponding pixel position of the lens. The original shadow texture coordinates are the texture coordinates of the original shadow texture.
[0249] Based on the central offset of the spherical lens, translation processing for the original shadow texture coordinates can be achieved. Based on the shadow rotation angle, rotation processing for the original shadow texture coordinates can be achieved. Combining the two can obtain the shadow texture coordinates to facilitate shadow overlay.
[0250] In some embodiments, the offsetting and rotating the original shadow texture coordinates corresponding to the spherical lens based on the central offset of the spherical lens and the shadow rotation angle to obtain the shadow texture coordinates includes:
[0251] Mapping the original shadow texture coordinates from the first interval to the third interval, and translating the shadow texture coordinates in the third interval based on the central offset of the spherical lens to obtain shadow translation coordinates;
[0252] Scaling the shadow translation coordinates based on the aspect ratio of the main display area of the electronic device and the distortion radius of the spherical lens to obtain shadow scaling coordinates;
[0253] Rotating the shadow scaling coordinates based on the shadow rotation angle to obtain shadow rotation coordinates;
[0254] Mapping the shadow rotation coordinates back to the first interval to obtain the shadow texture coordinates.
[0255] Specifically, for the original shadow texture coordinates, they can be mapped from the first interval to the third interval. Here, the first interval represents the value range interval of the common texture coordinate system, and the third interval represents the interval with symmetric value range. For example, the first interval can be [0, 1], and the third interval can be [-0.5, 0.5]. The process of mapping the original shadow texture coordinates from the first interval to the third interval can be expressed as:
[0256] vec2 uv1 = uv - 0.5;
[0257] Here, uv is the original shadow texture coordinate within the first interval, and uv1 is the original shadow texture coordinate within the third interval. uv - 0.5 realizes the mapping from [0, 1] to [-0.5, 0.5]. By mapping the original shadow texture coordinates to the third interval, the rotation center and the scaling center of the original shadow texture coordinates can be moved to the center of the main display area.
[0258] Subsequently, based on the central offset of the spherical lens, the shadow texture coordinates uv1 within the third interval can be translated, thereby obtaining the shadow translation coordinates, which can be specifically expressed as:
[0259] vec2 uv2 = uv1 + u_lens_translate;
[0260] Here, uv2 is the shadow translation coordinate, and u_lens_translate is the central offset. After this translation step, the rotation center and the scaling center of the shadow translation coordinates are no longer the center of the main display area.
[0261] Then, based on the aspect ratio of the main display area of the electronic device and the distortion radius of the spherical lens, the shadow translation coordinates can be scaled, thereby ensuring that the shadow scaling coordinates obtained after scaling will not be stretched and deformed when displayed on the main display area. The shadow scaling coordinates can be specifically expressed as:
[0262] ;
[0263] Among them, uv3 is the shadow scaling coordinate, u_aspect is the aspect ratio of the main display area, and u_lens_radius is the distortion radius of the lens. u_aspect / u_lens_radius represents the scaling factor in the horizontal direction, and 1.0 / u_lens_radius represents the scaling factor in the vertical direction. Scaling uv2 in the horizontal and vertical directions respectively can prevent the shadow texture from being stretched and deformed. For example, for the case where the original shadow texture is a square picture, if it is aligned with the four corners of the main display area, the original shadow texture will be stretched and deformed. Therefore, it is necessary to multiply the horizontal component by u_aspect.
[0264] Subsequently, based on the shadow rotation angle, the shadow scaling coordinate can be rotated, and the resulting shadow rotation coordinate can be expressed as:
[0265] vec2 uv4 = rotateAngle(uv3, u_shadow_rotate);
[0266] Among them, uv4 is the shadow rotation coordinate, rotateAngle represents the rotation function, and u_shadow_rotate represents the shadow rotation angle. By rotating uv3, the rotation effect of the shadow texture can be achieved.
[0267] After obtaining the shadow rotation coordinate, the shadow rotation coordinate can be mapped back to the first interval, that is, the shadow texture coordinate can be obtained, and the shadow texture coordinate can be expressed as:
[0268] vec2 uv5 = uv4 + 0.5;
[0269] Among them, uv5 is the shadow texture coordinate, and uv4 + 0.5 can achieve the mapping from [-0.5, 0.5] to [0, 1], thereby preventing the shadow texture from shifting.
[0270] It should be noted that since the translation, rotation, and scaling transformations involved in the above steps are all linear transformations and do not change the linear properties of the original shadow texture coordinates, the above steps can be executed using a vertex shader to improve the generation efficiency of the spherical wallpaper.
[0271] In some embodiments, superimposing a shadow on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens includes:
[0272] Sampling color information from the texture image of the planar wallpaper based on the first distortion coordinate;
[0273] Sampling shadow intensity information from the shadow texture corresponding to the spherical lens based on the shadow texture coordinate;
[0274] Mix the color information with black based on the shadow intensity information and the shadow ratio;
[0275] The shadow ratio increases as the electronic device changes from the lock screen interface or the main display interface to the standby screen interface.
[0276] Specifically, after generating the spherical wallpaper, based on the mapping relationship between the vertex coordinates of the spherical lens corresponding to the spherical pattern in the spherical wallpaper and the first distortion coordinates of the texture image of the planar wallpaper, color information can be sampled from the texture image of the planar wallpaper using the first distortion coordinates, thereby obtaining the color information of each coordinate mapped in the texture image of the planar wallpaper in the spherical pattern.
[0277] In addition, shadow texture coordinates can be applied to sample shadow intensity information corresponding to the shadow texture coordinates from the shadow texture corresponding to the spherical lens. Specifically, it can be expressed as:
[0278] float shadow = texture(u_shadowTex, v_shadowUV).a;
[0279] In the formula, shadow is the shadow intensity information, u_shadowTex is the shadow texture, v_shadowUV is the shadow texture coordinate, texture is the texture sampling function, whose input is (texture, texture coordinate), and texture(u_shadowTex, v_shadowUV).a indicates that the sampled value is from the a channel, that is, the shadow intensity.
[0280] After obtaining the color information and the shadow intensity information, the color information and black can be mixed based on the shadow intensity information and the shadow ratio, thereby achieving the shadow overlay effect.
[0281] Here, the shadow ratio can gradually increase following the progress of the conversion from the lock screen interface or the main display interface to the standby screen interface, that is, the closer to the standby screen interface, the higher the shadow ratio can be, and specifically, it can gradually change from 0 to 1.
[0282] Furthermore, mixing the color information and black based on the shadow intensity information and the shadow ratio can be expressed in the following form:
[0283] ;
[0284] where color2 is the color information after the shadow is overlaid. Through the mix function, the color information color1 can be mixed with black vec3(0.0) according to the shadow intensity shadow and the shadow ratio u_shadow_rate. The mix function can be expressed as , where A is color1, B is black, and x is . In this way, the greater the shadow intensity (close to 1), the closer the color color2 after superimposing the shadow is to black, thus simulating the shadow effect.
[0285] In some embodiments, sampling color information from the texture image of the planar wallpaper based on the first distorted coordinates includes:
[0286] Sampling the original color information from the blurred texture image of the planar wallpaper based on the first distorted coordinates;
[0287] Adjusting the saturation of the original color information based on the shadow ratio to obtain the color information.
[0288] Specifically, before sampling color information for the texture image of the planar wallpaper, the texture image of the planar wallpaper can be blurred first, thereby obtaining the blurred texture image. Here, the way of blurring can be Gaussian blur, or it can also be other blur algorithms, such as mean filtering, bilateral filtering, etc.
[0289] After that, the first distorted coordinates can be used to sample color information from the blurred texture image of the planar wallpaper, thereby obtaining the original color information corresponding to the first distorted coordinates in the blurred texture image, which can be specifically expressed in the following form:
[0290] vec3 blurColor = texture(u_blurTex, uv).rgb;
[0291] Among them, the original color information is blurColor, the blurred image is u_blurTex, and the first distorted surface coordinates are uv. texture is a texture sampling function, whose input is (texture, texture coordinates), and texture(u_blurTex, uv).rgb means sampling the values of the r, g, and b channels.
[0292] After obtaining the original color information, the saturation of the original color information can be adjusted based on the shadow ratio so that the saturation of the original color information can better fit the shadow effect. Here, the original color information after saturation adjustment can be used as the finally sampled color information, which can be specifically expressed in the following form:
[0293] ;
[0294] Here, color1 is the color information, blurColor is the original color information, u_shadow_rate is the shadow ratio, adjustSaturation is the saturation adjustment function, and the saturation increase amount here is .
[0295] The input of the saturation adjustment function adjustSaturation is (color, adjustment intensity), and the output is the color after saturation adjustment. It can be understood that for the saturation adjustment function, the color difference between its input and output depends on the adjustment intensity in the input.
[0296] Furthermore, in the process of performing saturation adjustment on a color based on the saturation adjustment function, the input color can be weighted separately on the red, green, and blue channels, and the weighted-adjusted color can be converted to grayscale. Then, according to the input adjustment intensity, the input color and the obtained grayscale are weighted as the finally output color after saturation adjustment. Among them, the weights for weighting on the red, green, and blue channels can be set artificially. For example, according to the different sensitivities of the human eye to light of different wavelengths (i.e., different colors), specifically, for the case where the human eye is most sensitive to green, second most sensitive to red, and least sensitive to blue, the weights of the red, green, and blue channels can be set to (0.2125, 0.7154, 0.0721) respectively.
[0297] In some embodiments, in step 420, the distortion processing of the texture coordinates of the planar wallpaper based on the first lens parameter to obtain the first distorted coordinates of the texture coordinates mapped to the spherical lens includes:
[0298] Based on the first lens parameter, perform distortion processing on the texture coordinates of the texture image of the planar wallpaper after blurring to obtain the first distorted coordinates of the texture coordinates mapped to the spherical lens;
[0299] The blur radius used for the blurring process increases as the electronic device changes from the lock screen interface or the main display interface to the screen-off interface.
[0300] Specifically, in the process of converting from a planar wallpaper to a spherical wallpaper, the texture image of the planar wallpaper can be first blurred to obtain a blurred texture image, and then the texture coordinates of the blurred texture image can be distorted to obtain the first distorted coordinates mapped to the spherical lens.
[0301] When blurring the texture image of a flat wallpaper, it can be achieved based on the blur radius. Here, the blur radius is a parameter that determines the scale of the blur algorithm. The blur radius determines the range of influence of surrounding pixels on the central pixel when blurring the texture image of a flat wallpaper. The size of the blur radius can directly determine the effect and intensity of the blurring process.
[0302] To further enhance the dynamic effect of the spherical wallpaper, during the process of the electronic device changing from the lock screen interface or the main display interface to the screen-off interface, the blur radius can be gradually increased. That is, the closer it is to the screen-off interface, the stronger the blur effect on the texture image of the flat wallpaper. For example, during the process of changing from the lock screen interface or the main display interface to the screen-off interface, the value of the blur radius can gradually change from 0 to 22.
[0303] For example, based on Gaussian blur, the blurring process of the texture image of the flat wallpaper can be achieved. Here, Gaussian blur is a widely used blur algorithm in the industry, and its working principle is based on convolution operations. This algorithm updates the color value of each pixel by calculating the weighted average of the surrounding pixels. The weights used for the weighted average are determined by the Gaussian function, and this set of weights is called the convolution kernel (also known as the Gaussian kernel). The Gaussian kernel can well simulate the influence degree of each pixel in the image neighborhood on the currently processed pixel, that is, the closer the distance between pixels, the greater its influence. In short, Gaussian blur performs a convolution operation on the image through the convolution kernel generated by the Gaussian function, thereby achieving the blur effect.
[0304] The Gaussian function can be expressed as the following formula:
[0305]
[0306] In the formula, x and y are the integer distances from the current position to the center of the convolution kernel. is the Gaussian value of, is the standard deviation, The larger the value, the shorter and fatter the image appears; conversely, the smaller the value, the taller and thinner the image appears.
[0307] By constructing the Gaussian kernel, the calculation of the Gaussian value at each position in the Gaussian kernel can be achieved. Thus, through convolution operations, the Gaussian blur of the image can be realized. In the Gaussian blur algorithm, the width of the Gaussian kernel is 2 times the blur radius plus 1. Given the width of the Gaussian kernel, the Gaussian blur can be performed.
[0308] For example, Figure 7 is the schematic flow diagram of Gaussian blur provided by the embodiments of the present application. As Figure 7 shown, for the image, it can be through a size of Perform convolution operations on the convolution kernel, thereby achieving Gaussian blur for the central pixel point. It should be noted that in order to ensure that the image after blurring does not become darker, it is necessary to normalize the elements in the Gaussian kernel, that is, divide all elements by their weight sum, so as to ensure that the weight sum after normalization is 1.
[0309] In addition, during the process of Gaussian blur, when pixels at the edge positions participate in convolution operations, if the texture coordinates of the pixels participating in convolution are less than 0, take 0; if they are greater than 1, take 1. If the texture coordinates are out of bounds, take the pixels at the edge positions (i.e., the pixels closest to the convolution region) to participate in convolution, thereby ensuring that the width and height pixel values of the texture do not change after blurring.
[0310] In some embodiments, in step 410, obtaining the first lens parameters of the spherical lens used to convert the spherical wallpaper includes:
[0311] Obtain the first lens parameters at the current animation progress from the parameter range corresponding to the animation process of converting the planar wallpaper to the spherical wallpaper;
[0312] The current animation progress referred to here is the specific progress at the current moment in the animation process of converting the planar wallpaper to the spherical wallpaper. It can be understood that in the animation process of converting the planar wallpaper to the spherical wallpaper, different animation progress can correspond to different first lens parameters. In order to make the first lens parameters corresponding to different animation progress present a continuous and dynamic visual effect in the application of converting the planar wallpaper to the spherical wallpaper, it is possible to pre-set the parameter range of each parameter in the first lens parameters for the overall animation process. It can be understood that in the animation process, the parameter values of the first lens parameters corresponding to all animation progress are within the parameter range.
[0313] For example, in the animation process of converting the planar wallpaper to the spherical wallpaper, the central offset u_lens_translate of the spherical lens can vary from (0, 0) to (0, 0.335); the distortion radius u_lens_radius can vary from 1.3 to 0.22; the distortion strength u_distort_strength can vary from 0 to 40.9; the rotation angle u_lens_rotate of the spherical lens can vary periodically from 0° to 360° with time; the blur radius blurRadius of the blur processing can vary from 0 to 22;
[0314] The rotation angle u_shadow_rotate of the shadow texture can vary from -149 to 0; the shadow ratio u_shadow_rate can vary from 0 to 1.
[0315] Accordingly, in step 430, generating the spherical wallpaper includes:
[0316] Generating the spherical wallpaper at the current animation progress.
[0317] That is, the spherical wallpaper obtained by distorting the first lens parameters at the current animation progress, which is the spherical wallpaper at the current animation progress. In the animation process of converting from a flat wallpaper to a spherical wallpaper, each animation progress corresponds to first lens parameters and also corresponds to a spherical wallpaper obtained by distortion. Thus, in the animation process of converting from a flat wallpaper to a spherical wallpaper, each animation progress corresponds to a different spherical wallpaper. By sequentially displaying the spherical wallpapers at each animation progress, the visual effect of the dynamic transformation from a flat wallpaper to a spherical wallpaper can be achieved.
[0318] Based on any of the above embodiments. The method further includes:
[0319] Rendering the animation of converting from the flat wallpaper to the spherical wallpaper based on the spherical wallpapers at each animation progress in the animation process.
[0320] Specifically, in order to achieve the dynamic visual effect of converting from a flat wallpaper to a spherical wallpaper, the spherical wallpapers at each animation progress in the animation process can be rendered based on the execution order of each animation progress, thereby obtaining an animation video that can reflect the transformation from the flat wallpaper, through the spherical wallpapers at each animation progress, to the spherical wallpaper at the last animation progress. By playing this animation video, a dynamic visual experience of converting from a flat wallpaper to a spherical wallpaper can be brought to the user.
[0321] Here, the animation rendering can be implemented based on OpenGL ES (Open Graphics Library for Embedded Systems). OpenGL ES is a cross-language and cross-platform application programming interface (API) for rendering 2D and 3D vector graphics, which can realize the generation of the spherical wallpapers at each animation progress and the generation of the animation. Specifically, the spherical wallpapers at each animation progress can be rendered in onDrawFrame of GLSerfaceView.Renderer.
[0322] Moreover, when rendering the animation of wallpaper conversion based on OpenGL ES, the thread in OpenGL ES can be responsible for modifying the parameters at each animation progress, such as the central offset u_lens_translate, distortion radius u_lens_radius, distortion strength u_distort_strength of the spherical lens, the rotation angle u_lens_rotate of the spherical lens, the blur radius blurRadius of the blur processing, the rotation angle u_shadow_rotate and shadow ratio u_shadow_rate of the shadow texture, etc., and thereby realize the rendering of the spherical wallpaper at each animation progress, and further obtain the animation of converting from the flat wallpaper to the spherical wallpaper.
[0323] In some embodiments, the method further includes:
[0324] In response to triggering a screen-on instruction on the screen-off interface of the electronic device, obtain second lens parameters, where the second lens parameters include the central offset, distortion radius, and distortion strength of the spherical lens, and the central offset and the distortion strength decrease as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface, and the distortion radius increases as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface;
[0325] Display the second process of converting the spherical wallpaper to the flat wallpaper in the sub-display area of the electronic device.
[0326] Specifically, in the screen-off interface, the user can trigger the electronic device to light up the main display area, at this time the electronic device enters the lock screen state, or can directly enter the main display interface from the screen-off interface. Here, the screen-on instruction triggered in the screen-off interface can be issued by the user in the form of pressing the power button of the electronic device, etc.
[0327] In the case of detecting a screen-on instruction in the screen-off interface, the screen-on instruction can be responded to, and the response method here is to obtain the second lens parameters of the spherical lens, thereby realizing the conversion from the spherical wallpaper displayed in the screen-off interface to the flat wallpaper displayed in the lock screen interface or the main display interface.
[0328] It can be understood that the second lens parameters referred to here are of the same parameter types as those included in the first lens parameters in the above embodiments, and, similar to the first lens parameters, the second lens parameters are also used to implement non-linear distortion processing of the texture coordinates of the texture image for the flat wallpaper. Different from the first lens parameters, the first lens parameters are applied in the process of converting from the lock screen interface or the main display interface to the screen-off interface, while the second lens parameters are applied in the process of converting from the screen-off interface to the lock screen interface or the main display interface. Specifically, in the process of converting from the lock screen interface or the main display interface to the screen-off interface, the changing trends of the parameters in the first lens parameters are opposite to those of the parameters in the second lens parameters in the process of converting from the screen-off interface to the lock screen interface or the main display interface.
[0329] For example, in the animation process of converting from a spherical wallpaper to a flat wallpaper, the center offset u_lens_translate of the spherical lens can change from (0, 0.335) to (0, 0); the distortion radius u_lens_radius can change from 0.22 to 1.3; the distortion strength u_distort_strength can change from 40.9 to 0; the rotation angle u_lens_rotate of the spherical lens can change periodically from 360° to 0° over time; the blur radius blurRadius of the blur processing can change from 22 to 0; the rotation angle u_shadow_rotate of the shadow texture can change from 0 to -149; the shadow ratio u_shadow_rate can change from 1 to 0.
[0330] Based on the second lens parameters, non-linear distortion processing is performed on the texture coordinates of the texture image of the flat wallpaper to obtain second distorted coordinates, so as to map the texture coordinates to the corresponding second distorted coordinates, thereby establishing a mapping relationship between the texture image and the spherical lens, that is, establishing a mapping relationship between the vertex coordinates of the spherical lens and the second distorted coordinates of the texture image. When rendering the spherical lens, the corresponding second distorted coordinates are used to sample from the texture image to obtain the spherical pattern in the spherical wallpaper, thereby realizing the generation of the spherical wallpaper, and thus gradually realizing the process of transitioning from the spherical wallpaper to the flat wallpaper, which is the same as the process of performing non-linear distortion processing on the texture coordinates of the texture image of the flat wallpaper based on the first lens parameters in the above embodiments to obtain the spherical wallpaper, and thus gradually realizing the process of transitioning from the flat wallpaper to the spherical wallpaper, and will not be elaborated here.
[0331] In some embodiments, Figure 8 is the second schematic flowchart of the wallpaper processing method provided by the embodiments of the present application. As Figure 8 shown, the method may include the following steps:
[0332] First, perform blurring processing on the texture image of the flat wallpaper:
[0333] The blurring processing here can be Gaussian blurring. Through Gaussian blurring, the texture image of the flat wallpaper after blurring processing can be obtained.
[0334] Secondly, perform linear transformation on the shadow texture coordinates:
[0335] Linear transformation operations such as offset, rotation, and scaling transformation can be performed on the original shadow texture, thereby obtaining the shadow texture coordinates required for subsequent superposition with the spherical pattern in the spherical wallpaper.
[0336] Subsequently, perform non - linear distortion based on the spherical lens:
[0337] Based on the lens parameters of the spherical lens, non - linear distortion can be performed on the texture coordinates of the texture image after blurring processing, so as to map the texture coordinates to the spherical lens grid, that is, obtain the distorted coordinates.
[0338] Then, perform linear transformation based on the spherical lens:
[0339] After obtaining the distorted coordinates, perform linear transformation such as translation and rotation on the spherical lens, thereby obtaining the distorted coordinates after translation and rotation. Sample from the texture image after blurring processing based on the distorted coordinates after translation and rotation, so as to obtain the spherical pattern, and then generate a spherical wallpaper similar to Figure 3 shown.
[0340] Finally, perform shadow superposition:
[0341] Based on the shadow texture coordinates, the texture image of the shadow can be superposed on the spherical pattern of the spherical wallpaper, and a spherical wallpaper with shadow superposed similar to Figure 9 shown can be obtained.
[0342] Figure 10 Illustrates a schematic diagram of the physical structure of an electronic device, as Figure 10 shown. The electronic device may include: a processor 1010, a communication interface 1020, a memory 1030, and a communication bus 1040. Among them, the processor 1010, the communication interface 1020, and the memory 1030 complete mutual communication through the communication bus 1040. The processor 1010 can call the logical instructions in the memory 1030 to execute the wallpaper processing method, and this method includes:
[0343] In response to triggering a screen-off instruction under a first interface of the electronic device, obtain a first wallpaper displayed under the first interface of the electronic device, where the first wallpaper is displayed in a main display area of the electronic device; and
[0344] Display a second wallpaper in a sub-display area of the electronic device, where the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area, and the sub-display area is located within the main display area.
[0345] In addition, when the logical instructions in the above-mentioned memory 1030 can be implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0346] On the other hand, this application also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the wallpaper processing method provided by the above-mentioned various methods. The method includes:
[0347] In response to triggering a screen-off instruction under a first interface of the electronic device, obtain a first wallpaper displayed under the first interface of the electronic device, where the first wallpaper is displayed in a main display area of the electronic device; and
[0348] Display a second wallpaper in a sub-display area of the electronic device, where the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area, and the sub-display area is located within the main display area.
[0349] On yet another aspect, this application 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, it is implemented to execute the wallpaper processing method provided by the above-mentioned various methods. The method includes:
[0350] In response to triggering a screen-off instruction under a first interface of the electronic device, obtain a first wallpaper displayed under the first interface of the electronic device, where the first wallpaper is displayed in the main display area of the electronic device; and
[0351] Display a second wallpaper in the sub-display area of the electronic device, where the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area for presentation, and the sub-display area is located within the main display area.
[0352] The device embodiments described above are merely illustrative. 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 distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
[0353] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment 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 solutions, in essence, or the part that contributes to the related technologies, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing 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.
[0354] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present application.
Claims
1. A wallpaper processing method, applied to electronic equipment, characterized in that: include: In response to triggering a screen-off instruction on a first interface of the electronic device, acquiring a first wallpaper displayed on the first interface of the electronic device, wherein the first wallpaper is displayed in a main display area of the electronic device, the first interface is a lock screen interface or a main display interface, the first wallpaper is a flat wallpaper of the lock screen interface or the main display interface, and the main display area corresponds to a complete display area of the electronic device; and Displaying a second wallpaper in the sub-display area of the electronic device, wherein the content of the second wallpaper is the first wallpaper mapped from the main display area to the sub-display area, the sub-display area is located in the main display area, the second wallpaper is a spherical wallpaper in the screen-off interface, and the sub-display area is a display area located in the main display area; Displaying a second wallpaper in the sub-display area of the electronic device includes: Acquire a first lens parameter of a spherical lens used for converting the spherical wallpaper, wherein the spherical lens corresponds to the sub-display area; Based on the first lens parameters, the texture coordinates of the plane wallpaper are distorted to obtain first distorted coordinates obtained by mapping the texture coordinates to the spherical lens, wherein the first lens parameters include a center offset, a distortion radius, and a distortion strength of the spherical lens, the center offset and the distortion strength increase as the electronic device changes from a lock screen interface or a main display interface to an off-screen interface, and the distortion radius decreases as the electronic device changes from a lock screen interface or a main display interface to an off-screen interface; Generate the spherical wallpaper based on mapping the texture coordinates to the first distortion coordinates under the spherical lens; A first process of converting the flat wallpaper to the spherical wallpaper is displayed in the sub-display area of the electronic device.
2. The wallpaper processing method according to claim 1, characterized in that: The step of performing distortion processing on the texture coordinates of the plane wallpaper based on the first lens parameter to obtain first distortion coordinates of the texture coordinates mapped to the spherical lens includes: Determining a current center position of the spherical lens based on an initial center position of the spherical lens, the center offset, and an aspect ratio of the main display area of the electronic device; Establishing a vector pointing to the texture coordinate based on the current center position; Calculating a vector scaling factor of the vector based on the vector, the distortion strength, and a distortion scaling factor determined by the distortion radius; The vector is scaled using the vector scaling factor, and based on the scaled vector and the current center position, a first distortion coordinate of the texture coordinate mapped to the spherical lens is determined.
3. The wallpaper processing method according to claim 2, characterized in that: The distortion scaling factor is associated with the smaller of the distortion radius and a radius threshold.
4. The wallpaper processing method according to claim 2, characterized in that: The calculating, based on the vector, the distortion intensity and the distortion scaling coefficient determined by the distortion radius, a vector scaling factor of the vector comprises: determining an intensity scaling factor for the texture coordinate based on the vector and the distortion intensity; A vector scaling factor for the vector is determined based on an intensity scaling factor for the texture coordinate and a distortion scaling factor determined by the distortion radius.
5. The wallpaper processing method according to claim 2, characterized in that: Before determining the texture coordinates based on the scaled vector and the current center position and mapping them to the first distorted coordinates under the spherical lens, the method further includes: Determining a width scaling factor of the texture coordinates in a width direction of the main display area based on an aspect ratio of the main display area of the electronic device; Based on the width scaling factor, the component of the texture coordinate in the width direction of the main display area is adjusted.
6. The wallpaper processing method according to claim 2, characterized in that: The determining the current center position of the spherical lens based on the initial center position of the spherical lens, the center offset, and the aspect ratio of the main display area of the electronic device comprises: Based on the aspect ratio of the main display area of the electronic device, determining a width scaling factor of the center position coordinate of the spherical lens in the width direction of the main display area; Taking the center point of the main display area as the initial center position of the spherical lens, and determining a candidate center position of the spherical lens based on the initial center position of the spherical lens and the center offset of the spherical lens; Based on the width scaling factor, the component of the candidate center position in the width direction of the main display area is adjusted to obtain the current center position of the spherical lens.
7. The wallpaper processing method according to claim 2, characterized in that: The first lens parameter also includes a rotation angle, and the rotation angle changes periodically as the electronic device changes from a lock screen interface or a main display interface to a screen-off interface; The step of mapping the texture coordinates to first distorted coordinates under the spherical lens to generate the spherical wallpaper comprises: Based on the center offset of the spherical lens and the rotation angle, translating and rotating the first distorted coordinates to obtain current spherical coordinates; Based on the current spherical coordinates, a spherical wallpaper at the current moment is generated.
8. The wallpaper processing method according to claim 7, characterized in that: The translating and rotating the first distorted coordinates based on the center offset of the spherical lens and the rotation angle to obtain current spherical coordinates includes: Mapping the first distorted coordinates from a first interval to a second interval; Based on the center offset, the first distorted coordinates in the second interval are translated to obtain translated second distorted coordinates; offsetting the translated second distorted coordinates to obtain offset second distorted coordinates, wherein the offset degree is determined according to a deviation between a rotation center and the current center position; Adjusting the texture coordinate density of the offset second distorted coordinates in the width direction of the main display area using the aspect ratio of the main display area of the electronic device to obtain third distorted coordinates; Rotating the third distorted coordinates based on the rotation angle to obtain rotated third distorted coordinates; Restoring the texture coordinate density of the rotated third distorted coordinates in the width direction of the main display area and canceling the offset of the rotated third distorted coordinates; The third distorted coordinates after the texture coordinate density is restored and the offset is canceled are mapped back to the first interval to obtain the current spherical coordinates.
9. The wallpaper processing method according to claim 1, characterized in that: Also includes: A shadow is superimposed on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens.
10. The wallpaper processing method according to claim 9, characterized in that: Also includes: Based on the center offset of the spherical lens and the shadow rotation angle, the original shadow texture coordinates corresponding to the spherical lens are offset and rotated to obtain the shadow texture coordinates.
11. The wallpaper processing method according to claim 10, characterized in that: The method of offsetting and rotating the original shadow texture coordinates corresponding to the spherical lens based on the center offset of the spherical lens and the shadow rotation angle to obtain the shadow texture coordinates includes: Mapping the original shadow texture coordinates from the first interval to a third interval, and translating the shadow texture coordinates in the third interval based on the center offset of the spherical lens to obtain shadow translation coordinates; Scaling the shadow translation coordinates based on the aspect ratio of the main display area of the electronic device and the distortion radius of the spherical lens to obtain shadow scaling coordinates; Based on the shadow rotation angle, the shadow scaling coordinates are rotated to obtain shadow rotation coordinates; The shadow rotation coordinates are mapped back to the first interval to obtain the shadow texture coordinates.
12. The wallpaper processing method according to claim 9, characterized in that: The step of superimposing a shadow on the spherical wallpaper based on the shadow texture coordinates corresponding to the spherical lens comprises: Based on the first distorted coordinates, sampling color information from the texture image of the plane wallpaper; Based on the shadow texture coordinates, sampling shadow intensity information from a shadow texture corresponding to the spherical lens; Based on the shadow intensity information and the shadow ratio, the color information and black are mixed; The shadow ratio increases as the electronic device changes from the lock screen interface or the main display interface to the screen off interface.
13. The wallpaper processing method according to claim 12, characterized in that: The step of sampling color information from the texture image of the plane wallpaper based on the first distorted coordinates includes: Based on the first distorted coordinates, sampling original color information from the blurred texture image of the plane wallpaper; Based on the shadow ratio, the saturation of the original color information is adjusted to obtain the color information.
14. The wallpaper processing method according to claim 1, characterized in that: The step of performing distortion processing on the texture coordinates of the plane wallpaper based on the first lens parameter to obtain first distortion coordinates of the texture coordinates mapped to the spherical lens includes: Based on the first lens parameters, the texture coordinates of the blurred texture image of the plane wallpaper are distorted to obtain first distorted coordinates of the texture coordinates mapped to the spherical lens; The blur radius used for the blurring process increases as the electronic device changes from the lock screen interface or the main display interface to the screen off interface.
15. The wallpaper processing method according to any one of claims 1 to 14, characterized in that: The step of obtaining the first lens parameter of the spherical lens used for converting the spherical wallpaper comprises: Obtaining a first lens parameter under the current animation progress from a parameter range corresponding to the animation progress of converting the plane wallpaper into the spherical wallpaper; The step of generating the spherical wallpaper comprises: Generate a spherical wallpaper under the current animation progress.
16. The wallpaper processing method according to claim 1, characterized in that: Also includes: In response to triggering a screen-on instruction on a screen-off interface of the electronic device, obtaining second lens parameters, wherein the second lens parameters include a center offset, a distortion radius, and a distortion strength of the spherical lens, the center offset and the distortion strength decrease as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface, and the distortion radius increases as the electronic device changes from the screen-off interface to the lock screen interface or the main display interface; A second process of converting the spherical wallpaper to the flat wallpaper is displayed in the sub-display area of the electronic device.
17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the wallpaper processing method according to any one of claims 1 to 16 is implemented.
18. 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 wallpaper processing method according to any one of claims 1 to 16 is implemented.