Transverse and vertical screen switching method, electronic equipment, readable medium and program product
By taking screenshots and performing scaling and rotation processing, combined with bottom panel overlay and gradient transparency technology, the problem of smoothness when electronic devices switch between horizontal and vertical screens is solved, and smooth transition and clarity of the displayed image are achieved.
Patent Information
- Application Number
- CN202410605732.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2044-05-15
AI Technical Summary
In the prior art, when electronic devices switch between landscape and portrait screens, the displayed images are not smooth enough, especially when the user's holding method changes, a smooth image transition cannot be achieved.
By taking a screenshot and performing scaling and rotation processing, combined with bottom plate overlay and gradient transparency technology, a smooth transition between horizontal and vertical screen display modes is achieved.
Ensure that the display is smooth and clear during the switching between horizontal and vertical screens, avoid ghosting, and provide a better user experience.
Smart Images

Figure CN120743398A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of display technology, and in particular to a method for switching between horizontal and vertical screens, an electronic device, a computer program product, and a computer-readable storage medium. Background Art
[0002] Currently, when electronic devices display images or play videos, the image display state or video playback state varies depending on how the user holds the phone. For example, if the user holds the phone vertically, the electronic device displays the image or plays the video in portrait mode; if the user holds the phone horizontally, the electronic device displays the image or plays the video in landscape mode.
[0003] When an electronic device is displaying an image or playing a video, if the user adjusts the way they hold the device, the device can automatically switch between landscape and portrait modes. For example, if the user adjusts the grip from portrait to landscape, the device automatically switches from portrait to landscape mode. A landscape-to-portrait switching solution is needed that allows for smoother display when switching between landscape and portrait modes. Summary of the Invention
[0004] The present application provides a method for switching between horizontal and vertical screens, an electronic device, a computer program product, and a computer-readable storage medium, which can achieve smoother display when the electronic device switches between horizontal and vertical screen display.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] In the first aspect, the present application provides a method for switching between horizontal and vertical screens, including: an electronic device displays a first interface in a first display mode, and the first interface displays an image; when the electronic device receives an operation to switch from the first display mode to the second display mode, the electronic device obtains a screenshot of the first interface, and scales and rotates the first display window along the first direction to obtain a second display window; wherein, the first display window refers to the window when the electronic device displays an image in the second display mode, the long side of the screenshot of the first interface is in the same direction as the long side of the first display window, the long side of the second display window is in the same direction as the short side of the first display window, and the size of the image displayed in the second display window is the same as the size of the image in the screenshot of the first interface; in the process of switching from the first display mode to the second display mode, the electronic device displays a motion effect of transitioning from the screenshot of the first interface to the second interface, the second interface is obtained by restoring the second display window and rotating it along the second direction, the second direction is the reverse direction of the first direction, and the size of the image displayed on the second interface is the same as the size of the image displayed in the first display window.
[0007] It can be known that the first display mode and the second display mode refer to one of the vertical screen display mode and the horizontal screen display mode. Taking the first display mode as the vertical screen display mode and the second display mode as the horizontal screen display orientation as an example, in the horizontal and vertical screen switching method provided by the present application, when the electronic device displays the first interface in the vertical screen display mode, the first interface displays an image, which can be a static image or a frame image in the video; when the electronic device receives the operation of switching the vertical screen display mode to the horizontal screen display mode, a screenshot of the first interface is obtained, and the long side of the screenshot is in the same direction as the long side of the window displayed in the horizontal screen display mode, that is, the screenshot of the first interface is in the same direction as the window displayed in the horizontal screen display mode, and is an image displayed in horizontal mode; the horizontal screen display is also switched to the horizontal screen. A window for displaying an image in a first display mode (i.e., a first display window) is scaled and rotated to obtain a second display window. The purpose of scaling is to make the size of the image displayed in the second display window the same as the size of the image in the screenshot of the first interface. The purpose of rotating is to make the long side of the second display window and the short side of the first display window in the same direction, that is, the second display window is a window displayed in portrait mode. Moreover, during the process of switching from the first display mode to the second display mode, the electronic device displays a dynamic effect of transitioning from the screenshot of the first interface to the second interface. The second interface is obtained by restoring and reversely rotating the second display window. The purpose of restoring is to make the size of the image displayed in the second interface the same as the size of the image displayed in the first display window.
[0008] It can be seen from the above content that: the electronic device scales and rotates the first display window to obtain the second display window, and the size of the image in the scaled display window is the same as the size of the image in the screenshot of the first interface, and in the process of the electronic device switching from the first display mode to the second display mode, the display transitions from the screenshot of the first interface to the second interface. The second interface is obtained by restoring and reversely rotating the second display window, and the size of the image displayed in the restored second display window is the same as the size of the image displayed in the first display window, so that in the process of displaying the animation effect of transitioning from the screenshot of the first interface to the second interface, the second interface displayed on the screen is gradually transitioned from the second display window with the same size as the image in the screenshot of the first interface to the first display window, ensuring the smoothness of the animation display.
[0009] In one possible embodiment, the electronic device obtains a screenshot of the first interface, and the long side of the screenshot of the first interface is in the same direction as the long side of the first display window, including: the electronic device obtains an initial screenshot of the first interface when it is displayed in the first display mode; the electronic device rotates the initial screenshot along the first direction to obtain a screenshot of the first interface, so that the long side of the screenshot of the first interface is in the same direction as the long side of the first display window.
[0010] In one possible embodiment, the electronic device rotates the initial screenshot along the first direction to obtain a screenshot of the first interface, and the electronic device scales the first display window and rotates it along the first direction to obtain a second display window, including: the electronic device scales the first display window to obtain a third display window, the size of the image displayed in the third display window is the same as the size of the image in the initial screenshot, and then combines the initial screenshot and the third display window in such a way that the initial screenshot is located at the top layer and the third display window is located at the lower layer of the initial screenshot, and then rotates the combined initial screenshot and third display window along the first direction; wherein the second display window refers to the rotated third display window.
[0011] In one possible embodiment, the process of the electronic device combining the initial screenshot and the third display window in such a manner that the initial screenshot is located on the top layer and the third display window is located on the lower layer of the initial screenshot also includes: the electronic device setting a bottom plate on the lower layer of the third display window, and the size of the bottom plate is the same as the size of the initial screenshot; wherein the electronic device rotates the combined initial screenshot and the third display window along the first direction includes: the electronic device rotates the combined initial screenshot, the third display window and the bottom plate along the first direction.
[0012] In a possible implementation, after the electronic device sets a bottom plate in the lower layer of the third display window, the electronic device further includes: the electronic device sets a background color of the window for the bottom plate; the background color of the window refers to the background color of the image in the first interface.
[0013] In one possible embodiment, when the electronic device switches from the first display mode to the second display mode, the electronic device displays a dynamic effect of transitioning from the screenshot of the first interface to the second interface, including: when the electronic device switches from the first display mode to the second display mode, the electronic device first displays the combined screenshot of the first interface and the second display window, and then controls the combined screenshot of the first interface and the second display window to rotate along the second direction, and during the process of rotating the combined screenshot of the first interface and the second display window along the second direction, the screenshot of the first interface gradually becomes transparent, and the size of the second display window gradually returns to the size of the first display window; wherein: the combination of the screenshot of the first interface and the second display window includes: the screenshot of the first interface is at the top layer, and the second display window is at the lower layer of the screenshot of the first interface.
[0014] In the above possible implementation manner, in the process of switching from the first display mode to the second display mode, since the size of the image displayed in the second display window is the same as the size of the image in the screenshot of the first interface, in the combined screenshot of the first interface and the second display window, the image content of the screenshot of the first interface can completely cover the image content in the second display window, and there is no ghosting between the two. Even when the screenshot of the first interface is translucent, the ghosting of the screenshot of the first interface and the second display window can be ignored because the second display window is gradually restored, thereby ensuring the clarity and smoothness of the dynamic effect picture.
[0015] In one possible embodiment, the lower layer of the combined screenshot of the first interface and the second display window also includes a bottom plate, and the size of the bottom plate is the same as the size of the screenshot of the first interface; controlling the combined screenshot of the first interface and the second display window to rotate along the second direction includes: controlling the combined screenshot of the first interface, the second display window and the bottom plate to rotate along the second direction; during the process of rotating the combined screenshot of the first interface, the second display window and the bottom plate along the second direction, the width of the bottom plate gradually changes to height, and the height gradually changes to width.
[0016] In one possible embodiment, during the process of rotating the combined screenshot of the first interface, the second display window and the bottom plate along the second direction, it also includes: cropping the area of the second display window that exceeds the bottom plate, so that the second display window is gradually restored to the size of the first display window with the regular size of the bottom plate.
[0017] In one possible embodiment, before the electronic device scales the first display window and rotates it along the first direction to obtain the second display window, it also includes: the electronic device determines that no pop-up window is displayed on the first interface and the image displayed on the first interface is not in an editing state, thereby avoiding the problem of wasting power consumption when the screenshot of the first interface with a pop-up window displayed or the image in an editing state cannot display an image of the same size as the second display window, and the first display window is scaled.
[0018] In one possible embodiment, the electronic device scaling the first display window includes: the electronic device scaling the first display window according to a scaling factor, where the scaling factor refers to the scaling factor of the image due to switching between the first display mode and the second display mode; the second interface is restored by the second display window, including: the second interface is restored by the second display window according to the scaling factor.
[0019] In a second aspect, the present application provides an electronic device comprising: one or more processors, a memory, and a display screen; the memory and the display screen are coupled to one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and when one or more processors execute the computer instructions, the electronic device executes the horizontal and vertical screen switching method described in the first aspect and any possible implementation method thereof.
[0020] In a third aspect, the present application provides a computer-readable storage medium for storing a computer program. When the computer program is executed, it is specifically used to implement the horizontal and vertical screen switching method as described in the first aspect and any possible implementation method thereof.
[0021] In a fourth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method for switching between horizontal and vertical screens as described in the first aspect and any one of its possible implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A scene diagram of a mobile phone switching from vertical screen display to horizontal screen display provided in an embodiment of the present application;
[0023] Figure 2 Another scene diagram of a mobile phone provided in an embodiment of the present application switching from vertical screen display to horizontal screen display;
[0024] Figure 3 and Figure 4 A diagram illustrating the technical concept of switching between horizontal and vertical screens provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of a combination of a screenshot and a display window provided in an embodiment of the present application;
[0026] Figure 6 A hardware structure diagram of an electronic device provided in an embodiment of the present application;
[0027] Figure 7 A software framework diagram of an electronic device provided in an embodiment of the present application;
[0028] Figure 8 This is an interactive diagram of the horizontal and vertical screen switching method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship.
[0030] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0031] The "multiple" involved in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the words "first" and "second" are only used for the purpose of distinguishing the description and cannot be understood as indicating or implying relative importance or order.
[0032] When an electronic device displays an image or plays a video, it can automatically switch the display mode based on how the user adjusts the way they hold the device. Figure 1 and Figure 2 Taking the display of images on a mobile phone as an example, the following interface diagrams show how the device automatically switches the image display mode when the user adjusts the way the device is held.
[0033] For example, the mobile phone is held vertically by the user, and the user selects an image in the gallery application of the mobile phone. The mobile phone responds to the user's selection operation, such as Figure 1 As shown in (a), the image 101 is displayed vertically. The user rotates the phone, adjusting it from vertical holding to horizontal holding, and the phone will follow the user's operation. Figure 1 As shown in (b), the image 101 is displayed horizontally.
[0034] User in Figure 1 The browsing interface input operation of the image 101 shown in (a) controls the mobile phone as follows Figure 2 As shown in (a), the image 101 is displayed vertically and in full screen (or immersive browsing image). The operation is, for example, a click operation input in the browsing interface of the image 101; or, other applications of the mobile phone save the image 101, and the user inputs an operation in the interface of the other application to browse the image 101, and the mobile phone responds to the operation, such as Figure 2 As shown in (a), the image 101 is displayed vertically and in full screen. Afterwards, the user adjusts the phone from vertical holding to horizontal holding. Following the user's operation, the phone will Figure 2 As shown in (b), the image 101 is displayed horizontally and in full screen.
[0035] Figure 1 and Figure 2 The display shows the phone switching from portrait to landscape orientation as the user adjusts the grip from portrait to landscape. Similarly, if the user adjusts the grip from landscape to portrait, the phone will also switch from landscape to portrait orientation.
[0036] An embodiment of the present application provides a horizontal / vertical screen switching solution, which can be applied to the horizontal / vertical screen switching scenario provided in the above content. It enables electronic devices such as mobile phones to follow the user's operation of adjusting the device holding method, and completes the horizontal / vertical display switching by displaying a rotating animation effect of the horizontal / vertical screen switching. The picture of the rotating animation effect is still smooth and clear.
[0037] The following Figure 1 Take the example of switching the vertical screen display image of the mobile phone to the horizontal screen display image, first combine Figure 3 and Figure 4 The technical concept of the horizontal and vertical screen switching solution provided in the embodiment of the present application is introduced.
[0038] See also Figure 3 At the first moment, the user holds the mobile phone vertically, and the mobile phone displays image 101 vertically.
[0039] At the second moment, the user begins to adjust the way they hold the phone, and at the third moment, adjusts the phone to a horizontal holding position. The phone detects the user's operation at the second moment and takes a screenshot of the interface displayed by the phone at the second moment, obtaining a first screen snapshot 301. Because the user only begins to adjust the way they hold the phone at the second moment, the interface displayed by the phone at the second moment is the same as the interface displayed at the first moment, which is an interface displaying image 101 in a vertical orientation. The phone then rotates the first screen snapshot from 0° to 90°, obtaining a second screen snapshot 302, where 0° refers to the vertical display state and 90° refers to the state rotated 90° clockwise. In some embodiments, the phone screen displays the second screen snapshot 302.
[0040] The mobile phone determines that the third moment is a horizontal display image. Therefore, the mobile phone obtains a display window corresponding to the horizontal display image 101, referred to as first display window 303. The mobile phone first scales first display window 303 and then rotates it 90° clockwise to obtain second display window 304. It will be understood that first display window 303 and second display window 304 include the image content of image 101 displayed horizontally; the image content of second display window 304 is the same size as the image content in second screenshot 302.
[0041] The mobile phone combines the second screen snapshot 302, the second display window 304 and the bottom plate in an overlapping manner, with the second screen snapshot 302 located in the upper layer, the second display window 304 located in the middle layer, and the bottom plate located in the lower layer.
[0042] Figure 4 The second screen shot 302, the second display window 304 and the bottom plate are rotated from 90° to 0°. To clearly show the changes of the second screen shot 302, the second display window 304 and the bottom plate during the rotation process, Figure 4 The baseplate shown is light grey, but this does not limit the baseplate background colour.
[0043] See also Figure 4 , second screenshot 302, second display window 304, and bottom panel 305 are superimposed. The phone controls the superimposed second screenshot 302, second display window 304, and bottom panel 305 to rotate counterclockwise 90°. During the rotation, second screenshot 304 gradually changes from opaque to completely transparent, second display window 304 returns to its pre-scaled size, and bottom panel 305 gradually adjusts from width to height and vice versa.
[0044] The mobile phone rotates the superimposed second screen snapshot 302, the second display window 304 and the bottom plate 305 counterclockwise by 90°. The second screen snapshot 302 becomes completely transparent, the content of the second display window 304 is fully displayed, and its size is restored, that is, the size is enlarged to the initial value of the window displaying the image 101 horizontally, the width of the bottom plate 305 is adjusted to the height, and the height is adjusted to the width. In this way, the mobile phone completes the switch from portrait to landscape display.
[0045] In some embodiments, when the superimposed second screenshot 302 , second display window 304 , and bottom plate 305 are rotated, the second display window 304 exceeds an area of the bottom plate 305 and is cropped.
[0046] It should be noted that the mobile phone scales the first display window 303 to the same size as the image content included therein and the image content in the second screenshot 302, that is, the image content of the second display window 304 is the same size as the image content in the second screenshot 302. The mobile phone overlaps the second screenshot 302 and the second display window 304 together, and the second screenshot 302 can completely cover the image content of the second display window 304. There will be no ghosting problem due to the image content in the second screenshot 302 and the image content in the second display window 304 not being completely aligned. This can ensure that during the process of the second screenshot 302 and the second display window 304 rotating together, the rotating animation effect is clear and smooth, that is, the rotating image viewed by the user slowly transitions from the image content in the second screenshot to the image content in the second display window. Since the image content in the two is the same size, the user will feel that the image is clear and smooth.
[0047] Figure 5 The diagram shows that the size of the first display window 303 is not scaled, the first display window 303 is rotated 90 degrees, and then overlapped with the second screen shot 302. Figure 5 It can be seen that the second screenshot 302 is located in the upper layer and the first display window 303 is located in the lower layer. Due to the different sizes of the image areas of the two, the second screenshot 302 cannot completely cover the image content of the first display window 303. When the second screenshot 302 transitions from an opaque state to a semi-transparent state, the image content in the second screenshot 302 and the image content in the second display window 304 have a ghost image. As a result, when the superimposed second screenshot 302, the second display window 304, and the bottom plate 305 rotate, the ghost image area will cause the image to be unclear and not smooth during the rotation.
[0048] The landscape / portrait switching solution provided in the embodiments of the present application can be applied to electronic devices with display screens, such as mobile phones and tablet computers. The electronic devices are not limited to mobile phones and tablet computers, but can also include personal digital assistants (PDAs), desktop computers, laptop computers, notebook computers, ultra-mobile personal computers (UMPCs), handheld computers, netbooks, and wearable devices. This application does not impose any specific restrictions on the type of electronic device.
[0049] Take mobile phones as an example. Figure 6 This is an example of the composition of an electronic device provided in an embodiment of the present application. Figure 6 As shown, the electronic device 100 may include a processor 110, an internal memory 120, a display screen 130, an audio module 140, a sensor module 150, and the like.
[0050] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. The electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0051] The processor 110 may include one or more processing units. For example, the processor 110 may include 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, a smart sensor hub, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0052] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0053] The internal memory 120 may be used to store computer executable program codes, where the executable program codes include instructions.
[0054] In some embodiments, the internal memory 120 stores instructions for a landscape / portrait switching solution. The processor 110 can execute the instructions stored in the internal memory 120 to enable the device to follow the user's adjustment of the device's grip, completing the landscape / portrait switching by displaying a rotational animation effect, with the rotational animation effect providing a smooth and clear image.
[0055] The electronic device implements display functionality through a GPU, display screen 130, and an application processor. A GPU is a microprocessor for image processing that connects display screen 130 and the application processor. The GPU performs mathematical and geometric calculations for image rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0056] The display screen 130 is used to display images, video interfaces, etc. In some embodiments, the electronic device may include 1 or N display screens 130 , where N is a positive integer greater than 1.
[0057] The electronic device can implement audio functions such as music playback and recording through the audio module 140 , the speaker 140A, the receiver 140B, the microphone 140C, the headphone jack 140D, and the application processor.
[0058] The audio module 140 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. Speaker 140A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device can listen to music or make hands-free calls through speaker 140A. Receiver 140B, also known as a "handset," is used to convert audio electrical signals into sound signals. When the electronic device receives a call or receives a voice message, the user can hold receiver 140B close to their ear to hear the voice. Microphone 140C, also known as a "microphone" or "speaker," is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by holding their mouth close to microphone 140C to input the sound signal into microphone 140C. Headphone jack 140D is used to connect a wired headset. Headphone jack 140D can be a USB interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, or a standard interface of the Cellular Telecommunications Industry Association of the USA (CTIA).
[0059] In sensor module 150, pressure sensor 150A is used to sense pressure signals and convert them into electrical signals. The electronic device determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to display screen 130, the electronic device detects the intensity of the touch operation using pressure sensor 150A. The electronic device can also calculate the touch location based on the detection signal from pressure sensor 150A.
[0060] Touch sensor 150B, also known as a "touch-sensitive device," can be provided on display screen 130. Touch sensor 150B and display screen 130 form a touch screen, also known as a "touchscreen." Touch sensor 150B is configured to detect touch operations applied to or near it. The touch sensor can transmit the detected touch operations to an application processor to determine the type of touch event. Visual output related to the touch operations can be provided via display screen 130.
[0061] The acceleration sensor 150C can detect the magnitude of the acceleration of the electronic device in various directions (generally three axes). When the electronic device is stationary, it can detect the magnitude and direction of gravity and can also be used to identify the posture of the electronic device.
[0062] The gyro sensor 150D may be used to determine the motion posture of the electronic device.
[0063] Electronic equipment in Figure 6 The hardware components shown also run an operating system. operating system, operating system, Operating system, etc. Applications such as gallery can be installed and run on the operating system.
[0064] Figure 7 A schematic diagram of the software structure of the electronic device provided in an embodiment of the present application.
[0065] The layered architecture divides the operating system of an electronic device into several layers, each with a clear role and division of labor. Layers communicate with each other via software interfaces. In some embodiments, the operating system of the electronic device is the Android system. The Android system can be divided into five layers: from top to bottom: the application (APP) layer, the application framework layer (FWK), the system library, the hardware abstraction layer (HAL), and the kernel layer.
[0066] The application layer can include a series of application packages. Figure 7 As shown, the application package may include applications such as gallery and video.
[0067] In some embodiments, the gallery includes two modules: photo management and video management, and may also include other modules. The photo management module is used to parse image data, calculate the zoom factor based on the image's width and height, and query the gallery to see whether the image is in an editing state, a pop-up window, or whether the gallery is in an immersive browsing state. Based on the query results, the module sends the zoom factor and the background color of the window to the window manager described below. The video management module is used to parse video data, calculate the zoom factor based on the width and height of a frame in the video, and query the gallery to see whether the video is in an editing state, a pop-up window, or whether the gallery is in an immersive browsing state. Based on the query results, the module sends the zoom factor and the background color of the window to the window manager described below.
[0068] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0069] like Figure 7 As shown, the application framework layer may include a window manager (WindowManager) and a view system, etc.
[0070] The window manager manages window programs. It can add, delete, show, and hide windows. The view system includes visual controls, such as those for displaying text and images. The view system can be used to build applications. In some embodiments, the window manager also adjusts the size of windows, adds animations to windows, and executes these animations.
[0071] The Android Runtime includes core libraries and a virtual machine. The Android Runtime is responsible for scheduling and management of the Android system. In some embodiments of the present application, an application cold start can be executed within the Android Runtime. The Android Runtime can then obtain the application's optimization file status parameters. The Android Runtime can then use these parameters to determine whether the optimization file has become outdated due to a system upgrade and return the determination result to the application management module.
[0072] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0073] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0074] The system library can include multiple functional modules, such as a surface manager, media libraries, and a 3D graphics processing library (such as OpenGL ES).
[0075] The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of various common audio and video formats, as well as static image files. The media library supports a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D drawing.
[0076] The kernel layer is the layer between hardware and software. It includes at least display drivers and sensor drivers. In some embodiments, the display driver controls the display screen's image display. The sensor driver controls the operation of multiple sensors, such as accelerometers, gyroscopes, pressure sensors, and touch sensors.
[0077] It should be noted that although the embodiments of the present application are based on The system is used as an example, but the basic principles are also applicable to Electronic devices with other operating systems.
[0078] The following describes the landscape / portrait switching solution provided by the embodiments of the present application in conjunction with the modules in the software structure of the electronic device. First, it should be noted that the following embodiments use the gallery application of the electronic device to display images, and the electronic device automatically switches from a vertical display image to a horizontal display image based on the user's adjustment of holding the device vertically to a horizontal hold as an example for explanation, but this does not constitute a limitation on the application scenarios of the landscape / portrait switching method.
[0079] like Figure 8 As shown, the method for switching between horizontal and vertical screens provided in the embodiment of the present application includes:
[0080] S801: The user inputs an image browsing operation.
[0081] An electronic device's gallery application stores images, and a user can enter an image browsing operation within the gallery application interface. In some embodiments, the image browsing operation can refer to the user selecting an image within the gallery application interface, or the user selecting an image within the gallery application interface, the electronic device displaying an image browsing interface in response to the user operation, and the user then entering a click operation within the image browsing interface to immersively browse the images.
[0082] It should be noted that other applications of the electronic device may also store images. Based on this, in other application scenarios, the image browsing operation input by the user may also refer to the image browsing operation input by the user in the interface of other applications.
[0083] S802: The gallery sends a message to the photo management system to notify the user to browse the image.
[0084] As described above, this embodiment is described by taking the gallery application displaying images as an example. The user inputs an image browsing operation in the gallery application interface, and the gallery application can detect the user's input image browsing operation based on a touch sensor or the like.
[0085] When the gallery application detects that the user has input an image browsing operation, on the one hand, the gallery application sends a message (which may be referred to as a first message) to the photo management, and the first message is used to notify the photo management that the user has input an image browsing operation. In some embodiments, the first message may carry the identifier of the image corresponding to the image browsing operation input by the user, and the image corresponding to the image browsing operation may be understood as the image specified by the user through the image browsing operation. On the other hand, the gallery application also displays an image browsing interface, which displays the image specified by the user through the image browsing operation. Exemplarily, Figure 1 (a) and Figure 2 (a) shows the image browsing interface of image 101.
[0086] It should be noted that photo management is a module of the gallery application. The gallery sends the first message to photo management. It can be understood that other modules of the gallery detect the user's input of the image browsing operation and send the first message to the photo management.
[0087] S803: Photo management obtains the width and height of the image.
[0088] The photo management receives the first message and learns that the user has entered an image browsing operation. Because the landscape / portrait switching method provided in this embodiment includes image scaling, the photo service first obtains the width w and height h of the image corresponding to the image browsing operation to obtain the image scaling factor.
[0089] In some embodiments, the photo management may obtain image data based on the identifier of the image carried in the first message, and then parse the image data to obtain the width w and height h of the image.
[0090] S804: The photo manager calculates a zoom factor n based on the width and height of the image.
[0091] The photo manager calculates the horizontal and vertical scaling ratios based on the width and height of the image, and then calculates the scaling factor n based on the horizontal and vertical scaling ratios. After the photo manager calculates the scaling factor n, it can cache it.
[0092] In some embodiments, the method for calculating the horizontal and vertical scaling ratios of the photo management includes: obtaining the width W and height H of the screen; calculating the vertical scaling ratio scale1 = min(w / W, h / H) and the horizontal scaling ratio scale2 = min(w / H, h / W). Alternatively, calculating the vertical scaling ratio scale1 = max(w / W, h / H) and the horizontal scaling ratio scale2 = max(w / H, h / W).
[0093] Among them, the vertical screen scaling ratio scale1 refers to: the scaling ratio of the image to be completely displayed in vertical mode on the screen of the vertical screen display interface, that is, after the image is scaled with the vertical screen scaling ratio scale1, it can be completely displayed on the screen of the vertical screen display interface; similarly, the horizontal screen scaling ratio scale2 refers to: the scaling ratio of the image to be completely displayed in horizontal mode on the screen of the horizontal screen display interface, that is, after the image is scaled with the horizontal screen scaling ratio scale2, it can be completely displayed on the screen of the horizontal screen display interface.
[0094] In some embodiments, the photo manager calculates a zoom factor n based on the horizontal and vertical zoom ratios as follows: n = scale2 / scale1. The zoom factor n calculated by the photo manager based on n = scale2 / scale1 can represent the zoom factor of the image due to the horizontal or vertical screen switching. Thus, the window manager scales the display window based on the zoom factor n, which can be understood as scaling the display window according to the zoom factor of the image due to the horizontal or vertical screen switching, ensuring that the scaled display window is the same size as the image area in the screenshot.
[0095] The width w and height h of the image, as well as the width W and height H of the screen are defined below.
[0096] The electronic device is located in the spatial coordinate system XYZ. The side of the screen located in the XOY plane is defined as the screen width W, and the side of the screen located in the XOZ plane is defined as the screen height H. The side of the image parallel to the screen width W is defined as the image width w, and the side of the image parallel to the screen height is defined as the image height h.
[0097] When the electronic device is held vertically or horizontally by a user, the width W and height H of the screen and the width w and height h of the image are different.
[0098] S805: The user inputs an operation to rotate the screen 90°.
[0099] In step S801, the user inputs an image browsing operation, and the gallery application controls the screen to display the image specified by the user through the image browsing operation. Subsequently, the user can adjust the grip of the electronic device. This embodiment uses the example of the user inputting the adjustment of the grip of the electronic device: the user rotates the screen 90° clockwise from portrait mode to landscape mode.
[0100] The electronic device receives the user input of rotating the screen 90° clockwise, and in response to the user operation, it can execute steps S806 and S807. There is no restriction on the execution order of steps S806 and S807. Figure 8 The execution of step S806 first and then step S807 is only an example.
[0101] S806: The window manager obtains a screenshot.
[0102] In some embodiments, the window manager can sense a user's operation of rotating the screen 90° clockwise via an accelerometer and / or a gyroscope. In response to the user's operation, the window manager takes a screenshot of the interface currently displayed on the screen, obtaining a screenshot. The interface currently displayed on the screen may refer to the interface displayed on the screen before the electronic device responds to the user input of the operation of rotating the screen 90° to adjust the image display state.
[0103] In this example, before the user inputs the operation of rotating the screen 90° in step S805, the screen displays the image corresponding to the image browsing operation in portrait mode. After the user inputs step S805, because the screen needs to gradually transition from displaying the image in portrait mode to displaying the image in landscape mode, the window manager obtains a screenshot of the interface displaying the image corresponding to the image browsing operation in portrait mode. In some embodiments, after obtaining the screenshot, the window manager may display the screenshot.
[0104] S807: The window manager sends a message to the gallery to notify the screen rotation.
[0105] In response to the user input of the operation of rotating the screen by 90°, the window manager sends a message (which may be called a second message) to the gallery, where the second message is used to notify the gallery that the user inputs the operation of rotating the screen by 90°.
[0106] In some embodiments, the second message may carry a parameter for rotating the screen by 90°, such as a parameter indicating whether to rotate the screen by 90° clockwise or counterclockwise.
[0107] S808: The gallery sends a message to the photo management system to notify the user of screen rotation.
[0108] The gallery receives the second message sent by the window manager and may forward the second message to the photo manager.
[0109] S809: The photo manager queries the gallery to see whether the image is in an editing state or a pop-up state.
[0110] After the photo manager receives the second message, it can execute steps S809 and S812. There is no restriction on the execution order of steps S809 and S812. Figure 8 The execution of step S809 first and then step S812 is only an example.
[0111] The photo manager queries the gallery through step S809 whether the image is in an edit state or a pop-up state. In some embodiments, the photo manager sends a request message to the gallery, the request message being used to request whether the image is in an edit state or a pop-up state.
[0112] The image is in the editing state, which means the user clicks Figure 1 In the image browsing interface shown in (a), the gallery controls the image to be in an edit state in response to the click of the "Edit" button. In some embodiments, the gallery application controls the image to be in an edit state and can synchronously record the image in the edit state with a parameter. Based on this, the gallery can query the parameter to determine whether the image is in the edit state.
[0113] The image is in a pop-up state, which means that a pop-up window is displayed on the image browsing interface. For example, when the user clicks Figure 1 In the image browsing interface shown in (a), the gallery displays a pop-up window in response to the click of the "Delete" button to remind the user whether to delete the image. In some embodiments, the gallery display of the pop-up window can also be recorded by parameters. Therefore, the gallery can also query the parameters to determine whether the image is in the pop-up window state.
[0114] S810: The image library sends a zoom factor n with a value of 0 to the window manager.
[0115] If the image is in the edit state or pop-up state, the zoom factor n sent to the window manager is 0. A zoom factor of 0 indicates that the window manager does not need to scale the display window. Of course, 0 is an example value. When the image is in the edit state or pop-up state, the zoom factor sent by the image library to the window manager can also be other values, as long as it is not the value calculated in step S804.
[0116] S811. The gallery returns the query result of the image status to the photo management.
[0117] The gallery queries whether the image is in editing state or pop-up state, and sends the query result to the photo management.
[0118] S812: The photo manager queries the photo library to see whether the photo manager is in an immersive image browsing state.
[0119] After receiving the second message, the photo manager queries the gallery in step S812 whether the gallery is in the immersive browsing state. In some embodiments, the photo manager sends a request message to the gallery, the request message being used to request whether the gallery is in the immersive browsing state.
[0120] S813. Based on the query result, the gallery returns the background color of the window to the photo manager.
[0121] The gallery receives a request message from the photo management, and in response to the request message, queries the gallery to be in an immersive browsing image state. The immersive browsing image state may refer to the gallery control screen displaying the image in full screen without displaying other interface elements such as buttons. For example, Figure 2 As shown in (a) or (b) in the figure. It should be noted that due to the difference between image size and screen size, full-screen display of an image does not mean that the image content fills the entire screen. Instead, it means that the screen only displays the image content and background, without displaying other interface elements such as buttons.
[0122] Users can Figure 1 In the image browsing interface shown in (a), a click operation is input, and the gallery responds to the operation and displays the following Figure 2 The immersive image browsing interface shown in (a) of FIG. Synchronously, the gallery application records a parameter to indicate that the gallery is in the immersive image browsing state. The gallery application can query this parameter to determine whether it is in the immersive image browsing state.
[0123] Depend on Figure 1 (a) and Figure 2 As can be seen in (a), the background color of images differs between non-immersive and immersive display modes. For example, in non-immersive display, the background color of the image is light, such as white or light gray; in immersive display, the background color of the image is dark, such as black. The background color of an image can be understood as the background color of the window displaying the image. Therefore, based on the query result indicating whether the gallery is in immersive browsing mode, the gallery application can return the background color of the window to the photo manager.
[0124] S814. The photo manager sends the zoom factor n and the background color of the window to the window manager.
[0125] The photo manager obtains through step S811 that the image is neither in the editing state nor in the pop-up state, and sets the zoom factor n to the cache value, that is, the value calculated in step S804. In this way, the photo manager sends the zoom factor n and the background color of the window to the window manager.
[0126] S815: The window manager determines whether n is greater than 0.
[0127] The window manager determines whether the zoom factor n is greater than 0. If the window manager determines that the zoom factor n is not greater than 0, step S815 may be executed; if the window manager determines that the zoom factor n is greater than 0, steps S816 to S819 may be executed.
[0128] S816: The window manager executes a normal process.
[0129] If the window manager determines that the zoom factor n is not greater than 0, it executes the normal process, which can be understood as combining the screenshot, display window and bottom plate in sequence, with the screenshot at the top layer; setting the color of the bottom plate to the background color of the window; rotating the screenshot, display window and bottom plate from 0° to 90°, and then rotating them back to 0° from 90°. During the rotation process, the screenshot slowly becomes transparent, the width of the bottom plate changes to its height, and the height changes to its width.
[0130] In some embodiments, the background color of the window may be obtained by the window manager from the image library, or may be obtained through other means.
[0131] It should be noted that when the window manager determines that the zoom factor n is not greater than 0, it means that the image is in the editing state or pop-up state. The window manager does not scale the display window and executes the normal process with the original size display window. The reason is that the image is in the editing state or pop-up state. The image content in the interface displayed before the screen is rotated (i.e., the image content in the screenshot) is different from the image content in the interface displayed after the screen is rotated (i.e., the image content in the display window). For example, the size and position of the pop-up window are different. The screenshot transitions to a semi-transparent state. There is a ghost between the image content in the screenshot and the image content in the display window. Even if the display window is scaled, the ghost still exists, which will still cause the image to be unclear and not smooth during the rotation process. In this way, scaling the display window is an ineffective action that only wastes power consumption.
[0132] S817. The window manager scales the display window to 1 / n, controls the screenshot to be located at the top layer, and the display window to be located at the next layer. A bottom plate is set at the bottom layer of the display window, and the color of the bottom plate is the background color of the window.
[0133] The window manager determines that the zoom factor n is greater than 0, indicating that the image is not in the editing state or the pop-up state. The window manager can first obtain the display window. The display window can be understood as the interface of the horizontal screen display image drawn by the electronic device in response to the user input of the screen rotation operation of 90 degrees. The display window displays the image content and can also display Figure 1 The status bar for "Share" and "Favorites" shown in (b) is shown in the figure. The display window includes multiple layers, with the top layer including the image content and the status bar.
[0134] The window manager first scales the display window to 1 / n. This ensures that the size of the image content in the display window is the same as the size of the image content in the screenshot, avoiding ghosting between the two. The window manager also adds a backplane to the display window. In some embodiments, the window manager uses the SurfaceControl.Transaction.setColor() method to set the background color of the backplane. The size of the backplane is the same as the size of the display window before scaling.
[0135] The screenshot, display window, and chassis window are arranged from top to bottom in this way: the screenshot is at the top, the display window is at the next level, and the chassis is at the bottom. The content in the upper level obscures the content in the lower level. Therefore, the screenshot obscures the display window, and the display window obscures the chassis.
[0136] In some embodiments, the window manager controls the screenshot to be located at the top layer and the display window to be located at the next layer. The window manager controls the display of the screenshot and controls the electronic device to draw the display window at the next layer of the screenshot.
[0137] It should be noted that when the window manager scales the display window to 1 / n, it means scaling the entire display window to 1 / n. The display window includes multiple layers, that is, multiple images are scaled to 1 / n. The image content and status bar included in the display window are both scaled to 1 / n.
[0138] It should also be noted that Figure 3 In the example shown, image 101 is an image shot in landscape mode. When it is displayed in portrait mode, the image area is smaller than when it is displayed in landscape mode. Figure 3 The size of the image 101 in the first screenshot 301 is smaller than the size of the image 101 in the first display window 303. In this case, the zoom factor n calculated by the photo manager 804 is a value greater than 1, and the window manager scales the display window to 1 / n, which means that the display window is reduced. Figure 3 The displayed first display window 303 is reduced and rotated to obtain the second display window 304 .
[0139] When the image is shot in portrait mode, the image area when displayed in portrait mode is larger than the image area when displayed in landscape mode. In this case, the zoom factor n calculated by the photo management 804 is a value less than 1, and the window manager scales the display window to 1 / n, which means enlarging the display window. Of course, the size of the image area of the enlarged display window is the same as the size of the image area of the screenshot.
[0140] S818. The window manager controls the screenshot and the display window to rotate 90°.
[0141] As described in step S805, the screen is rotated 90° clockwise by the user. To adapt the screenshot to the rotated screen, the window manager controls the screenshot and the display window to also rotate 90° clockwise. Furthermore, the screenshot is located above the display window, and the screen can display the screenshot.
[0142] It should be noted that steps S817 and 818 illustrate the execution order of the steps of the window manager controlling the display window to be scaled to 1 / n, controlling the display window to be rotated 90°, controlling the screenshot to be rotated 90°, controlling the screenshot to be located at the top layer and the display window to be located at the next layer, and setting a bottom plate at the bottom layer of the display window, with the bottom plate's color being the window's background color. However, this does not constitute a limitation on the execution order of these steps. For example, Figure 3 It also shows another execution order of the above steps.
[0143] In some embodiments, the window manager can also obtain a screenshot, scale the display window to 1 / n, control the screenshot to be on the top layer and the display window to be on the next layer, set a bottom plate on the lower layer of the display window, the color of the bottom plate is the background color of the window, and the size is the same as the screenshot, and then rotate the screenshot, display window and bottom plate 90° clockwise.
[0144] S819. The window manager adds a 90° to 0° rotation animation to the screenshot, display window, and bottom plate, adds a transparency animation from 1 to 0 to the screenshot, adds a width-to-height and height-to-width animation to the bottom plate, and adds a restore animation and a crop animation to the display window.
[0145] When the user rotates the screen 90°, the electronic device needs to gradually transition from a portrait display to a landscape display. Therefore, the electronic device uses a rotation animation to achieve this transition. Because the screenshot and display window are rotated 90° clockwise in step S818, the rotation animation added to the screenshot, display window, and baseplate includes a 90° to 0° rotation animation, i.e., a 90° counterclockwise rotation animation.
[0146] Because the screenshot is at the top layer and the display window is at the next layer, the display window is blocked by the screenshot. It is necessary to ensure that the screen can display the display window when the electronic device is adjusted to landscape mode. Therefore, the screenshot needs to slowly become transparent. Based on this, the window manager adds an animation of transparency from 1 to 0 to the screenshot; wherein, a transparency of 1 indicates opaqueness and a transparency of 0 indicates complete transparency. The animation of transparency from 1 to 0 includes: controlling the screenshot to slowly change from transparency 1 to transparency 0 in a certain step size. The step size can be a set value. Of course, 1 and 0 are values for exemplary display.
[0147] The bottom panel is located below the display window and has the same dimensions as the display window. When the bottom panel is rotated from 90° to 0°, the width of the bottom panel should gradually decrease to its height, and the height should gradually increase to its width. Based on this, the window manager adds an animation to the bottom panel in which the width changes to the height, and the height changes to the width. In some embodiments, the animation of the width changing to the height, and the height changing to the width of the bottom panel also changes in a certain step size, which can also be a set value.
[0148] Because the display window is scaled to 1 / n in step S817, the display window needs to be restored to its original size after the 90° to 0° rotation animation is completed. Therefore, the window manager adds a restoration animation to the display window. The restoration animation may refer to slowly adjusting the display window from 1 / n to 1 size, i.e., slowly expanding it by a factor of n. In some embodiments, the window manager also slowly expands the display window by a factor of n in a certain step size, which is a set value.
[0149] During the process of rotating the screenshot, display window and base plate according to the rotation animation from 90° to 0°, the screenshot will gradually become transparent and the display window will gradually expand. When the screenshot is in a semi-transparent state, the content of the display window can gradually become visible to the user. In order to ensure that the display window presented to the user on the screen is of a regular size, a cropping animation can be added to the display window. The cropping animation is used to crop the area of the display window that exceeds the base plate, so that the display window can gradually expand and present with the regular size of the base plate.
[0150] In some embodiments, the cropping width of the cropping animation gradually changes from d to 0, d = (H / nW) / 2, H is the height of the screen, W is the width of the screen, and n is the zoom factor. The cropping width can also gradually change from d to 0 in a certain step length, the step length is a set value, and the step length can be a linear relationship. d = (H / nW) / 2 can be understood as the calculated initial value of the cropping width, which is calculated by Figure 4 As shown in the first figure, H / n is the height of second display window 304, W is the width of the screen, that is, the height of second screenshot 302, and (H / nW) / 2 is the width of the area where the second display window protrudes from the bottom panel, that is, the height of second display window 304 protruding from the upper half of the bottom panel, and also the height of second display window 304 protruding from the lower half of the bottom panel. The electronic device crops the area where the second display window 304 protrudes from the bottom panel at the top and bottom of second display window 304, with the cropping width d gradually decreasing to 0.
[0151] It should be noted that the window manager adds a 90° to 0° rotation animation to the display window. When this rotation animation is executed, the entire display window rotates, that is, all the layers included in the display window rotate. Of course, the image content and status bar included in the display window also rotate, which avoids the limitation of rotating only the image content and not the status bar.
[0152] In addition, the window manager adds a 90° to 0° rotation animation and executes it. This can be understood as the system-level module of the electronic device executing the rotation animation. The rotation animation is not executed by the gallery application, which will not affect the operation of the main thread of the gallery application, will not bring operating pressure to the gallery application, and to a certain extent also ensures the smoothness of the rotation animation.
[0153] S820. The window manager performs the added animation on the screenshot, the display window, and the chassis.
[0154] After the window manager adds animation to the screenshot, the display window, and the backplane, the added animation is executed to achieve a smooth and clear transition from the vertical screen display image to the horizontal screen display image.
[0155] The horizontal and vertical screen switching method provided in the embodiment of the present application can also be applied to the scenario where an electronic device displays a video.
[0156] The user inputs the video browsing operation through step S801, and the gallery sends a first message to the video management to notify the video management that the user is browsing the video. The video management obtains the video data, and obtains the width and height of a frame image in the video, and calculates the zoom factor n based on the width and height of the image. After the window manager receives the user input of the 90° screen rotation operation through step S805, the gallery and the video management interactively execute steps S808 to S813; the video management also executes step S814. In this way, in the scenario where the electronic device displays a video through the gallery, the user rotates the screen to adjust the way of holding the device, and the screen presents the adjustment of the video display method with clear pictures and smooth motion effects.
[0157] It should be noted that in the embodiments of the present application, the rotation effect is executed by a system-level module such as a window manager, rather than by an application such as a gallery. This ensures that the landscape / portrait switching method provided by the embodiments of the present application can be applied to both image display and video playback scenarios. In particular, in video playback scenarios, the window manager executing the rotation effect ensures smooth display of the rotation effect while the video is playing.
[0158] Another embodiment of the present application further provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is executed on a computer or a processor, the computer or processor executes one or more steps in any of the above methods.
[0159] The computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, a non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0160] Another embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer or processor, causes the computer or processor to execute one or more steps in any of the above methods.
Claims
1. A method for switching between horizontal and vertical screens, characterized in that: include: The electronic device displays a first interface in a first display mode, where the first interface displays an image; When the electronic device receives an operation to switch from the first display mode to the second display mode, the electronic device obtains a screenshot of the first interface, and scales and rotates the first display window along a first direction to obtain a second display window; wherein the first display window refers to a window when the electronic device displays the image in the second display mode, the long side of the screenshot of the first interface is in the same direction as the long side of the first display window, the long side of the second display window is in the same direction as the short side of the first display window, and the size of the image displayed in the second display window is the same as the size of the image in the screenshot of the first interface; the first display mode and the second display mode refer to one of a portrait display mode and a landscape display mode; During the process of switching from the first display mode to the second display mode, the electronic device displays a dynamic effect of transitioning from a screenshot of the first interface to the second interface. The second interface is obtained by restoring the second display window and rotating along a second direction. The second direction is the opposite direction of the first direction. The size of the image displayed on the second interface is the same as the size of the image displayed in the first display window.
2. The method for switching between horizontal and vertical screens according to claim 1, wherein: The electronic device obtains a screenshot of the first interface, where a long side of the screenshot of the first interface is in the same direction as a long side of the first display window, including: The electronic device obtains an initial screen snapshot when the first interface is displayed in the first display mode; The electronic device rotates the initial screenshot along the first direction to obtain a screenshot of the first interface, so that the long side of the screenshot of the first interface is in the same direction as the long side of the first display window.
3. The method for switching between horizontal and vertical screens according to claim 2, wherein: The electronic device rotates the initial screenshot along the first direction to obtain a screenshot of the first interface, and the electronic device scales the first display window and rotates the first display window along the first direction to obtain a second display window, including: The electronic device scales the first display window to obtain a third display window, where the size of the image displayed in the third display window is the same as the size of the image in the initial screenshot, combines the initial screenshot and the third display window in such a manner that the initial screenshot is located on a top layer and the third display window is located below the initial screenshot, and rotates the combined initial screenshot and the third display window along the first direction; The second display window refers to the rotated third display window.
4. The method for switching between horizontal and vertical screens according to claim 3, wherein: The electronic device further comprises: combining the initial screenshot and the third display window in a manner that the initial screenshot is located at a top layer and the third display window is located at a lower layer of the initial screenshot. The electronic device is provided with a bottom plate in a lower layer of the third display window, wherein the size of the bottom plate is the same as the size of the initial screenshot; The electronic device rotating the combined initial screen snapshot and the third display window along the first direction includes: the electronic device rotating the combined initial screen snapshot, the third display window and the bottom plate along the first direction.
5. The method for switching between horizontal and vertical screens according to claim 4, wherein: After the bottom plate is provided on the lower layer of the third display window, the electronic device further includes: The electronic device sets a background color of a window for the bottom panel; the background color of the window refers to the background color of the image in the first interface.
6. The method for switching between horizontal and vertical screens according to any one of claims 1 to 5, wherein: The electronic device, during a process of switching from the first display mode to the second display mode, displays a transitional animation from a screenshot of the first interface to the second interface, including: During the process of switching from the first display mode to the second display mode, the electronic device first displays the combined screenshot of the first interface and the second display window, and then controls the combined screenshot of the first interface and the second display window to rotate along the second direction. During the process of rotating the combined screenshot of the first interface and the second display window along the second direction, the screenshot of the first interface gradually becomes transparent, and the size of the second display window gradually returns to the size of the first display window. The combination of the screenshot of the first interface and the second display window includes: the screenshot of the first interface is located at the top layer, and the second display window is located at the bottom layer of the screenshot of the first interface.
7. The method for switching between horizontal and vertical screens according to claim 6, wherein: The lower layer of the combined screenshot of the first interface and the second display window further includes a bottom plate, and the size of the bottom plate is the same as the size of the screenshot of the first interface; The controlling the combined screenshot of the first interface and the second display window to rotate along the second direction includes: controlling the combined screenshot of the first interface, the second display window, and the bottom plate to rotate along the second direction; During the process of the combined screenshot of the first interface, the second display window, and the bottom plate rotating along the second direction, the width of the bottom plate gradually changes to the height, and the height gradually changes to the width.
8. The method for switching between horizontal and vertical screens according to claim 7, wherein: The process of rotating the combined screenshot of the first interface, the second display window, and the bottom plate along the second direction further includes: cutting out an area of the second display window that exceeds the bottom plate.
9. The method for switching between horizontal and vertical screens according to claim 1, wherein: Before the electronic device scales the first display window and rotates it along a first direction to obtain a second display window, the electronic device further includes: The electronic device determines that no pop-up window is displayed on the first interface and the image displayed on the first interface is not in an editing state.
10. The method for switching between horizontal and vertical screens according to any one of claims 1 to 9, wherein: The electronic device scaling the first display window includes: the electronic device scaling the first display window according to a scaling factor, where the scaling factor refers to a scaling factor of the image due to switching between the first display mode and the second display mode; The second interface is restored by the second display window, including: the second interface is restored by the second display window according to the zoom factor.
11. An electronic device, characterized in that: include: one or more processors, memory, and display screens; The memory and the display screen are coupled to the one or more processors, the memory is used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the horizontal and vertical screen switching method as described in any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that Used to store a computer program, which, when executed, is specifically used to implement the horizontal and vertical screen switching method according to any one of claims 1 to 10.
13. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to execute the method for switching between horizontal and vertical screens according to any one of claims 1 to 10.
Citation Information
Patent Citations
Horizontal-vertical screen switching rotation control method for hand-held devices
CN102520842A
Interface switching method and interface switching system
CN103176689A
Game screen display method, storage medium and terminal
CN109126131A
Display interface switching method and device, storage medium and electronic device
CN110399064A
Interface dynamic effect display method and device
CN114640743A