WO2025256330A1 - 显示方法、电子设备、可读介质和程序产品 - Google Patents
显示方法、电子设备、可读介质和程序产品Info
- Publication number
- WO2025256330A1 WO2025256330A1 PCT/CN2025/094803 CN2025094803W WO2025256330A1 WO 2025256330 A1 WO2025256330 A1 WO 2025256330A1 CN 2025094803 W CN2025094803 W CN 2025094803W WO 2025256330 A1 WO2025256330 A1 WO 2025256330A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- display
- interface
- electronic device
- view
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72448—User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
- H04M1/72454—User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
- H04M1/72427—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for supporting games or graphical animations
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72469—User interfaces specially adapted for cordless or mobile telephones for operating the device by selecting functions from two or more displayed items, e.g. menus or icons
Definitions
- This application relates to the field of display technology, and more particularly to a display method, electronic device, computer program product, and computer-readable storage medium.
- a notched screen refers to a screen with a portion cut off from a non-notched screen, the cut-off area used to house components such as cameras and earpieces. Notched screens are used in mobile phones and other electronic devices. Electronic devices typically use a portion of the notched screen to display images, and this area generally avoids the mounting areas for components such as cameras and earpieces.
- the irregularly shaped screen can display window switching animations.
- the function of displaying window switching animations on irregularly shaped screens still needs improvement.
- This application provides a display method, electronic device, computer program product, and computer-readable storage medium, which enables the electronic device to rotate a window in response to user operation, and displays a rotation animation effect on an irregularly shaped screen during the window rotation.
- this application provides a display method for an electronic device.
- the display screen of the electronic device includes a first region and a second region, which do not overlap.
- the second region has a punch-hole area where a camera is installed.
- the display method includes: the display screen of the electronic device displays a first interface; a first image is displayed in a region corresponding to the first region of the first interface; the first image is displayed along a first direction; and a menu control is displayed in the second region.
- the menu control is used to process the first image, such as deleting the first image, saving the first image, or returning to the previous interface of the first interface.
- a user inputs an operation to rotate the device along a first rotation direction; in response to the rotation operation, the electronic device can acquire a snapshot of the first interface.
- the third image is displayed in the first region along the first direction.
- menu controls are continuously displayed in the second region.
- the first image, the second image, and the third image are all different images drawn by an electronic device.
- the first area of the display screen can be understood as the image display area.
- the electronic device displays the first interface 105 as shown in Figure 10A(a)
- the image in the first interface 105 is displayed along the first direction.
- the electronic device can respond to the user's operation by first acquiring a snapshot of the first interface and displaying it as shown in Figure 10A(c). In this way, when the electronic device rotates, the display screen first maintains the display content of the first interface.
- the image display area of the display screen first displays the second image along the third direction (as shown in Figure 10A(d)), and then displays the animation effect of transitioning from the second image to the third image.
- the third image is displayed along the direction of the first image (as shown in Figure 10A(d) to Figure 10B(j)). In this way, when the user adjusts the way he holds the electronic device, causing the screen to rotate, the image display area of the display screen can display the rotation animation effect of the image.
- the display method further includes: the electronic device determining the display position of the second image; and the electronic device drawing the second image in a first view corresponding to the first region based on the display position of the second image.
- the electronic device draws the second image on the second interface based on the display position of the second image on the view of the image display area.
- the view of the image display area does not need to change in size or angle. This avoids the problem that the size of the view and the image display area will not match due to the size change of the view, which would cause the electronic device to be unable to respond to the operation input by the user on the image display area. It also avoids the problem that the image displayed on the view cannot be displayed because the angle of the view changes but the angle of the view does not change with the view.
- the display method further includes: the electronic device creating a first view, the size of which is a first dimension; the electronic device determining the display position of a fourth image; and the electronic device drawing the fourth image in the first view based on the display position of the fourth image, the direction of which is a first direction.
- the electronic device responds to this operation and can display a rotation animation.
- the electronic device typically creates the first view corresponding to the first region only once. In some cases, the electronic device may also draw the first view corresponding to the first region multiple times, as long as the drawn first view has the same size as the first region and the angle does not change.
- first image, the second image, the third image, and the fourth image are also different images drawn by the electronic device.
- the snapshot's transparency transitions from a third value to a fourth value, where the third value is less than the first value and greater than the second value, and the fourth value is less than the third value and greater than the second value; during this transition, the fourth image is not visible to the user.
- both the third and fourth values are values between 0.1 and 1.
- the electronic device when the electronic device displays a snapshot, the electronic device creates a first view of the first area and draws the fourth image based on the display position of the fourth image in the first video.
- This can be understood as the electronic device drawing the fourth image in the background.
- the fourth image is not visible to the user, which can avoid the problem of screen flickering in the electronic device.
- the electronic device may also draw multiple frames of images in the first view, but none of the drawn images are visible to the user.
- the display method further includes: before determining the display position of the fourth image, the electronic device determines whether there is an animation effect; if it is determined that there is no animation effect, the display position of the fourth image is determined, and after a first delay, the startup animation effect is set.
- the display method further includes: before determining the display position of the second image, the electronic device determines whether there is a motion effect; wherein, if the electronic device determines that there is a motion effect, the display position of the second image is determined.
- the electronic device creates a first view by: setting the angle of the display screen to a first angle; and creating the first view based on the first angle.
- the method further includes: the electronic device initiating a window animation effect, the window animation effect being used to control the electronic device to display the snapshot, the snapshot's transparency transitioning from a first value to a fifth value, the fifth value indicating that the snapshot is completely transparent, the fifth value being less than or equal to a second value, and the duration of the transition from the first value to the fifth value being the second duration.
- the fifth value is 0.
- the electronic device launches a window animation to control the snapshot to change from opaque to fully transparent, which ensures that the electronic device can display the second interface when the snapshot changes to semi-transparent.
- the electronic device completes the rendering of the second image in the second interface and displays it on the screen; in this scenario, the second and fifth values are the same.
- the electronic device completes the rendering of the second image in the second interface and displays it on the screen; in this case, the fifth value is less than the second value.
- the method before the display screen of the electronic device displays the first interface, the method further includes: the electronic device setting the angle of the display screen to a second angle; the electronic device creating a second view of a first area based on the second angle, the size of the second view being a second dimension; the electronic device determining the display position of the first image; and the electronic device drawing the first interface in the second view based on the display position of the first image.
- determining the display position of the second image includes: calculating the scaling ratio, offset, and display angle of the second image; the display angle of the second image is used to indicate a third direction; the scaling ratio of the second image is used to indicate the proportional relationship between the second image and the first region; the offset of the second image is used to indicate the display area of the second image in the first region; and the display position of the second image is determined based on the scaling ratio, offset, and display angle of the second image.
- calculating the scaling ratio, offset, and display angle of the second image includes: calculating the rate of change of the image's scaling ratio, the rate of change of the offset, and the rate of change of the display angle; calculating the change value of the image's scaling ratio corresponding to one image drawing operation based on the total change of the image's scaling ratio and the rate of change of the image's scaling ratio, and using the scaling ratio of the fifth image and the sum of the changes in the image's scaling ratio as the scaling ratio of the second image; calculating the change value of the image's offset corresponding to one image drawing operation based on the total change of the image's offset and the rate of change of the image's offset, and using the offset of the fifth image and the sum of the changes in the image's offset as the offset of the second image; and calculating the change value of the image's display angle corresponding to one image drawing operation based on the total change of the image's display angle and the rate of change of the image's display angle, and using the
- the fifth image is drawn by the electronic device based on the previous drawing operation of the second image; the total change in the scaling ratio of the image refers to the difference between the scaling ratio of the first image and the scaling ratio of the third image; the total change in the offset of the image refers to the difference between the offset of the first image and the scaling ratio of the third image; the total change in the display angle of the image refers to the angle of rotation of the electronic device along the first rotation direction.
- the method for implementing the animation effect of the electronic device displaying a second image transitioning to a third image in a second interface includes: the electronic device drawing and displaying an image in a first view based on the display positions of images corresponding to multiple drawing operations; wherein the display positions of the images corresponding to the multiple drawing operations are used to indicate the transition of the image from the second image to the third image.
- the display position of the image obtained by the electronic device for each drawing operation is indicated by the image scaling ratio, offset, and display angle.
- the first image, the second image, and the third image correspond to the same image in the image library.
- an electronic device launches a camera application to capture an image and saves it to the image library.
- the user operates a component linked to the image library application on the camera browsing interface to input an operation to browse images.
- the electronic device displays the first interface.
- the first image, the second image, and the third image can all be understood as corresponding to the image captured by the electronic device and saved to the image library.
- the first image, the second image, and the third image correspond to different frame images in the same video.
- an electronic device launches a camera application to capture a video and saves it to the gallery.
- the user operates a component linked to the gallery application on the camera browsing interface to input an operation to browse the video.
- the electronic device displays the first interface.
- the first image, the second image, and the third image can be understood as corresponding to different frame images in the video captured by the electronic device and saved to the gallery.
- determining the display position of the second image includes: calculating the width and height of the second image display, and setting the display angle and offset of the second image through a matrix object; the display angle of the second image is used to indicate a third direction; the offset is used to indicate the display area of the second image in a first region; and the display position of the second image is determined based on the width and height of the second image display, the offset, and the display angle.
- setting the display angle and offset of the second image through a matrix object includes: constructing a first matrix object, the first matrix object storing the offset and display angle of the second image; and writing the offset and display angle of the second image to the second matrix object of the Transaction component through an interface between the Transaction component and the application layer of the electronic device.
- the Transaction component itself is a component of the framework layer that is not exposed to the application layer.
- Applications in the application layer cannot modify the matrix object within the Transaction component, making it impossible to write angles into the matrix object. Therefore, by setting an interface between the Transaction component and the application layer, applications in the application layer can modify the matrix object within the Transaction component.
- the electronic device sets data including angles and offsets from the matrix object within the Transaction component. Thus, the electronic device draws video frames based on this matrix object, and the video content can be rotated based on angles.
- the first image is displayed in the center of the area corresponding to the first region in the first interface; the second image is displayed in the center of the area corresponding to the first region in the second interface; and the third image is displayed in the center of the area corresponding to the first region in the second interface.
- the menu control includes one or more of a favorites control, a back control, and a delete control.
- the menu control is used to process the first image, including: if the menu control includes a favorites control, receiving an operation performed on the favorites control and adding the first image to the favorites album of the gallery; if the menu control includes a back control, receiving an operation performed on the back control and displaying a third interface, the third interface being the parent interface of the first interface; if the menu control includes a delete control, receiving an operation performed on the delete control and deleting the first image.
- this application provides a computer-readable storage medium for storing a computer program, which, when executed, is specifically used to implement the display method as described in any one of the first aspects and its possible embodiments.
- Figure 1 is a schematic diagram of a foldable mobile phone with a display screen folded horizontally according to an embodiment of this application;
- Figure 2 is a diagram illustrating four display postures of the foldable phone provided in the embodiments of this application.
- FIG. 8 is a hardware structure diagram of the electronic device provided in an embodiment of this application.
- Figure 12 is an interactive diagram of the display method in a foldable mobile phone display image scenario provided in an embodiment of this application;
- Figure 13 is a flowchart of the calculation of the scaling ratio, offset and display angle of the corresponding image drawn in one step during the animation process provided in the embodiment of this application;
- one or more refers to one, two, or more; "and/or” describes the relationship between related objects, indicating that three relationships may exist; for example, A and/or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural.
- the character "/” generally indicates that the preceding and following related objects are in an "or” relationship.
- references to "one embodiment” or “some embodiments” as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in still other embodiments,” etc., appearing in different parts of 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 “comprising,” “including,” “having,” and variations thereof mean “including but not limited to,” unless otherwise specifically emphasized.
- notched screens are created by cutting off a portion of a non-notched screen; the cut-off area is used to house components such as cameras and earpieces.
- foldable electronic devices that fold inwards include: a foldable first screen and a second screen visible to the user when the first screen is folded. Both the second and first screens can be notched screens.
- the display of a foldable electronic device can fold horizontally (similar to a traditional flip phone) or fold along the direction of gravity, with the horizontal direction perpendicular to the direction of gravity.
- Figure 1 shows a foldable phone with the display folded horizontally. It is understood that the foldable phone shown in Figure 1 is in a folded state, and the hinge 200 of the foldable phone is located at the top edge of the foldable phone.
- the foldable phone includes a foldable first screen and a second screen 100, as shown in Figure 1.
- the second screen 100 includes area A (which can be referred to as the second area) and area B (which can be referred to as the first area).
- Areas A and B can be understood as two areas of the second screen 100, not as two separate screens; areas A and B do not overlap.
- Area A is used to install a camera, while area B is used as the display area for images and the user interface.
- area A is used to display the image's operation menu, such as controls for saving, returning, and deleting
- area B is used to display the image content.
- area A can be referred to as the menu display area
- area B can be referred to as the image display area.
- the foldable phone when the foldable phone receives an operation on the favorites control, it can add the first image to the favorites album in the gallery; when the foldable phone receives an operation on the back control, it can display the previous level interface of the first interface; when the foldable phone receives an operation on the delete control, it can delete the first image.
- a vertical grip means that when the user holds the foldable phone, the hinge 200 is perpendicular to the direction of gravity, and the phone displays content in portrait mode.
- a horizontal grip means that when the user holds the foldable phone, the hinge 200 is parallel to the direction of gravity, and the phone displays content in landscape mode.
- the electronic device can automatically rotate the window when the user adjusts their grip. For example, if the user changes from holding the device vertically to horizontally, the electronic device will automatically rotate the window to switch the display from portrait to landscape mode. Furthermore, due to the limitations of the punch-hole area on the notch-shaped screen, when the electronic device rotates the window, areas A and B of the notch-shaped screen will display separate switching animations.
- the following section uses the foldable phone shown in Figure 1 as an example to introduce the switching scheme between landscape and portrait display on a non-standard screen.
- Figure 2 shows the interface of a foldable phone displaying images in landscape and portrait modes on its notch-shaped screen.
- the foldable phone maintains the image orientation for both landscape and portrait modes, and the image can also be located in the center of the image display area.
- this does not constitute a limitation on the display direction or display area of the image.
- the foldable phone can calculate the image scaling ratio and scale the image accordingly. Furthermore, the calculation rules for the image scaling ratio differ depending on whether the aspect ratio of the image is the same as or different from that of the image display area; please refer to step S908 below for details.
- the following section, referring to Figures 2 and 3, will introduce the interface for displaying images with three different aspect ratios in the image display area.
- the aspect ratio of the image is the same as that of the image display area, for example, both are 16:9.
- Figure 2 illustrates a user rotating the screen counter-clockwise to switch between portrait and landscape image display on the foldable phone's irregularly shaped screen, but this does not constitute a limitation on the application scenario of this application.
- the posture of the folding phone shown in Figure 2(a) can be defined as a vertical 0° posture.
- the user holds the foldable phone vertically, and the foldable phone is in a folded state, making the irregular screen 100 visible to the user.
- the menu display area 102 of the irregular screen 100 displays three controls: favorites, back, and delete, and also displays two punch-hole areas (represented by round holes in the figure).
- the image display area 103 displays image 101, which can be understood as an image saved by the gallery application.
- the aspect ratio of image 101 is the same as that of image display area 103, with the vertical direction as the height and the horizontal direction as the width, the height of image 101 can fill the entire image display area 103.
- the width of image 101 also fills the entire image display area 103.
- images can be scaled during display the height and width displayed by image 101 are not necessarily the height and width of the image recorded in the image library.
- the folding phone posture shown in Figure 2(b) can be defined as a 90° horizontal posture.
- the image display area 103 changes from portrait to landscape mode
- the menu display area 102 also changes from portrait to landscape mode.
- the image 101 only changes from portrait to landscape mode in the image display area 103; a smooth transition from portrait to landscape mode can also be achieved through a switching animation effect.
- the controls in the menu display area 102 also change from portrait to landscape mode; a smooth transition from portrait to landscape mode can also be achieved through a switching animation effect.
- the height of the image 101 shown in Figure 2(b) can fill the image display area 103, but the width of the image 101 does not fill the image display area 103. That is, along the horizontal direction, there are some areas of the image display area 103 where the image content of the image 101 is not displayed.
- the folding phone posture shown in Figure 2(c) can be defined as a vertical 180° posture.
- the height of image 101 fills the image display area 103, but the width of image 101 does not fill the image display area 103. That is, along the horizontal direction, there are some areas of image display area 103 where the image content of image 101 is not displayed.
- the irregular screen displays the image in the four postures shown in Figure 2.
- the height of the image 101 can fill the image display area 103, but the width of the image 101 may not fill the image display area 103.
- the side perpendicular to the axis of rotation is defined as the longer side of the image display area 103
- the side parallel to the axis of rotation is defined as the shorter side of the image display area 103.
- the length of the shorter side is less than the length of the longer side.
- the dimensions of the longer and shorter sides of the image display area can be the same, and the length of the shorter side can be greater than the length of the longer side. It can be understood that the height of the image 101 displays fills the image display area 103, but the width of the image 101 does not necessarily fill the image display area 103. In essence, the image content of the image 101 can fill the shorter side of the image display area 103.
- Figures 3 and 4 illustrate how irregularly shaped screens display images with other aspect ratios at 0° vertically and 90° horizontally.
- the aspect ratio of image 101 is greater than that of the image display area.
- the menu display area 102 of the irregularly shaped screen displays three controls: favorite, return, and delete, and also displays two punch-hole areas (represented by round holes in the figure).
- the image display area 103 displays image 101.
- the irregularly shaped screen displays image 101 vertically at 0°.
- the height of image 101 fills the image display area 103, but the width of image 101 does not fill the image display area 103.
- There is white space on both the left and right sides of image 101 shown as black in the figure).
- the display screen displays image 101 horizontally at 90°.
- the height of image 101 also fills the image display area 103, but the width of image 101 does not fill the image display area 103.
- the height of the image 101 fills the image display area 103, while the width of the image 101 does not fill the image display area 103.
- the aspect ratio of image 101 is smaller than that of image display area 103.
- the menu display area 102 of the irregularly shaped screen displays three controls: favorite, return, and delete, and also displays two punch-hole areas (represented by round holes in the figure).
- Image display area 103 displays image 101.
- the irregularly shaped screen displays image 101 vertically at 0°.
- the width of image 101 fills the image display area 103, but the height of image 101 does not fill the image display area 103.
- There is white space on both the top and bottom sides of image 101 shown in black in the figure).
- the display screen displays image 101 horizontally at 90°.
- the width of image 101 also fills the image display area 103, but the height of image 101 does not fill the image display area 103. There is white space on both the top and bottom sides of image 101 (shown in black in the figure). Similarly, in a scenario where an image 101 is displayed on a non-circular screen at 180° vertically and 270° horizontally, the width of the image 101 fills the image display area 103, but the height of the image 101 does not fill the image display area 103.
- the irregularly shaped screen of the foldable phone displays image 101 in image display area 103 at a vertical 0° angle.
- menu controls are displayed in menu display area 102.
- the view displaying image 101 has the same size as image 101.
- the view displaying image 101 will be referred to as the view of image 101.
- the user controls the folding phone to rotate 90° counterclockwise.
- the folding phone first controls the view of image 101 as shown in Figure 5(b), and then rotates 90° counterclockwise with the folding phone.
- the view of image 101 and image 101 are the same size.
- the folding phone controls the view of the image circled by the dashed box to rotate 90° clockwise and gradually shrink from the size shown in Figure 5(b) until the height of the image is the same as the short side of the image display area 103 (the white area in the figure).
- the dashed box is used to indicate the view of the image; the folding phone does not actually display the dashed box.
- the operation menu in the menu display area does not show the rotation animation.
- the foldable phone adjusts the width and height of the view of image 101 to match the size of the image display area 103 to complete the landscape display layout.
- the irregular screen displays the interface shown in Figure 5(d). In this interface, the image is not displayed in the correct orientation, nor is it centered in the image display area 103, and the image is not displayed in the manner shown in Figure 2(b).
- Figure 6(f) exemplarily shows that when the irregularly shaped screen of a foldable phone displays image 101 in a vertical 0° orientation, the size of image 101 and the size of view 104 of image 101 are the same.
- images 101 and view 104 of the same size are drawn as a single layer to illustrate the view 104 displaying image 101 (hereinafter referred to as view 104), but this does not constitute a limitation on the meaning of image 101 and view 104 of image 101.
- the foldable phone's irregularly shaped screen displays image 101 in a vertical 0° orientation.
- View 104 as shown in Figure 6(a), has a height of M, a width of N, and an angle of 0°.
- the foldable phone responds by first controlling view 104 to rotate from the vertical counterclockwise orientation shown in Figure 6(a) to the horizontal orientation shown in Figure 6(b).
- the width M of view 104 shown in Figure 6(b) is the same as the height M of view 104 shown in Figure 6(a), and the height N of view 104 shown in Figure 6(b) is the same as the width N of view 104 shown in Figure 6(a), with the angle of view 104 remaining at 0°.
- the folding phone controls view 104 as shown in Figure 6(c), rotating it 90° clockwise while gradually shrinking its size, until, as shown in Figure 6(d), view 104 is rotated 90° clockwise and shrunk so that the height h of the displayed image is the same as the height H of the image display area 103.
- the image display area 103 as described above, can refer to area B in Figure 1.
- the height h of the image displayed in view104 is the same as the height H of the image display area 103.
- the width w of the image displayed in view104 is smaller than the width W of the image display area 103. Since view104 and the image displayed in view104 are the same size, that is, the width w of view104 is smaller than the width W of the image display area 103, view104 does not fill the image display area 103. As a result, when the user performs a left or right swipe operation on the image display area 103 to switch images, the foldable phone cannot respond to the operation and cannot switch the image display.
- the foldable phone needs to adjust the width and height of view 104 shown in Figure 6(d) so that the width w of view 104 is equal to the width W of image display area 103 and the height h of view 104 is equal to the height H of image display area 103, so as to ensure that view 104 fills the image display area 103, thereby ensuring that the foldable phone can respond to the user's left and right swipe operations on image display area 103.
- the rotation and scaling process of view 104 shown in Figure 6(c) is essentially a rotation and scaling process of the projected view 104 obtained through matrix calculation; the actual size of view 104 is not adjusted. Therefore, adjusting the width and height of view 104 shown in Figure 6(d) on the foldable phone becomes an ineffective operation, resulting in view 104 remaining as shown in Figure 6(e), with an angle of 0°, a height M the same as the height M of view 104 shown in Figure 6(a), and a width N the same as the width N of view 104 shown in Figure 6(a).
- view 104 cannot be displayed in areas not located within the image display area 103; that is, the area below the dashed frame shown in Figure 6(e) cannot be displayed, ultimately causing the foldable phone's irregularly shaped screen to display the interface shown in Figure 5(d).
- view 104 can be smaller than or equal to the image display area 103. That is, the width M of view 104 shown in Figure 6(b) can be smaller than or equal to the width W of the image display area 103 shown in Figure 6(d), and the height N of view 104 shown in Figure 6(b) can be smaller than or equal to the height H of the image display area 103 shown in Figure 6(d).
- the foldable phone When switching from landscape to portrait mode on a foldable phone's irregularly shaped screen, issues arise with the displayed interface. For example, as shown in Figure 7(a), the foldable phone displays image 101 at a 90° horizontal angle in image display area 103, and menu controls in menu display area 102. When the user changes the phone's orientation from landscape to portrait, the phone responds by changing from a 90° horizontal angle to a 0° vertical angle. However, adjusting the width and height of the view of image 101 fails, resulting in the view of image 101 still displaying in landscape mode, as shown in Figure 7(b). Furthermore, due to the influence of menu display area 102, the area outside image display area 103, specifically the area to the right of the dotted line, cannot be displayed correctly.
- Figure 7(c) the view of image 101 is located in a portion of image display area 103, and image 101 is not centered. It is understood that Figure 7(b) is not an interface diagram of the irregular screen display of a foldable phone, but is only used to illustrate the relationship between the view of the image 101 and the image display area 103.
- this application provides a display solution.
- the display solution provided in this application can be applied to the foldable phone shown in Figure 1, as well as other types of electronic devices, such as tablet computers with irregularly shaped screens, personal digital assistants (PDAs), desktop, laptop, and notebook computers, ultra-mobile personal computers (UMPCs), handheld computers, netbooks, and wearable devices.
- PDAs personal digital assistants
- UMPCs ultra-mobile personal computers
- This application does not specifically limit the type of electronic device.
- the electronic device is not limited to foldable devices; it can also be a candybar device.
- Figure 8 shows an example of the composition of an electronic device provided in an embodiment of this application.
- the electronic device may include a processor 110, an internal memory 120, a display screen 130, an audio module 140, and a sensor module 150, etc.
- the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements.
- the illustrated components may be implemented in hardware, software, or a combination of both.
- Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, smart sensor hub, and/or neural network processing unit (NPU).
- AP application processor
- GPU graphics processing unit
- ISP image signal processor
- DSP digital signal processor
- NPU neural network processing unit
- Processor 110 may also include memory for storing instructions and data.
- Internal memory 120 can be used to store computer executable program code, which includes instructions.
- the internal memory 120 stores instructions for display schemes.
- the processor 110 can execute the instructions stored in the internal memory 120 to enable the electronic device to rotate its window in a scenario where the screen displays an image, following the user's adjustment of the device's grip.
- the screen displays a rotation animation effect, and it can also ensure that after the animation effect ends, the image is centered in the image display area and facing forward in the interface displayed on the screen.
- the GPU is a microprocessor for image processing, connected to the display screen 130 and the application processor.
- the GPU performs mathematical and geometric calculations for image rendering.
- the processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
- the display screen 130 is used to display images, video interfaces, etc.
- the electronic device may include one or N display screens 130, where N is a positive integer greater than 1.
- the electronic device includes one display screen, which is the irregularly shaped screen shown in FIG1.
- Electronic devices can implement audio functions, such as music playback and recording, through audio modules 140, speakers 140A, receivers 140B, microphones 140C, headphone jacks 140D, and application processors.
- pressure sensor 150A is used to sense pressure signals and convert them into electrical signals.
- the electronic device determines the pressure intensity based on changes in capacitance. When a touch operation is applied to display screen 130, the electronic device detects the intensity of the touch operation based on pressure sensor 150A. The electronic device can also calculate the touch position based on the detection signal from pressure sensor 150A.
- Touch sensor 150B also called a "touch device,” can be placed on display screen 130. Touch sensor 150B and display screen 130 together form a touch screen, also called a "touchscreen.” Touch sensor 150B is used to detect touch operations applied to or near it.
- the accelerometer 150C can detect the magnitude of acceleration in various directions (typically three axes) of an electronic device. When the electronic device is stationary, it can detect the magnitude and direction of gravity, and can also be used to identify the attitude of the electronic device.
- the gyroscope sensor 150D can be used to determine the motion attitude of the electronic device.
- the electronic device in addition to the hardware components shown in Figure 8, also runs an operating system.
- operating system For example... operating system, operating system, Operating system, etc.
- Applications such as image galleries can be installed and run on the operating system.
- Figure 9 is a schematic diagram of the software structure of the electronic device provided in the embodiment of this application.
- a layered architecture divides the operating system of an electronic device into several layers, each with a clear role and function. Layers communicate with each other through software interfaces.
- the operating system of the electronic device is the Android system.
- the Android system can be divided into four layers, from top to bottom: the application (APP) layer, the application framework layer (FWK), the system libraries, and the kernel layer.
- the application layer can include a series of application packages. As shown in Figure 9, an application package can include applications such as a gallery.
- the gallery application includes an activity component, a presenter component, and a View component, etc.
- the functions of the activity component, the presenter component, and the View component are as described in the embodiments corresponding to Figures 12 and 13 below, and will not be elaborated here.
- the gallery application also includes a VideoTouchView component, a handler component, and a SurfaceView component.
- the functions of the VideoTouchView component, the handler component, and the SurfaceView component are as described in the embodiments corresponding to Figures 17 and 18 below, and will not be elaborated here.
- the application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer.
- the application framework layer includes some predefined functions. As shown in Figure 9, the application framework layer may include a window manager, a doFream component, a transaction component, and a view system, etc.
- the window manager is used to manage window applications. It allows for adding, deleting, showing, and hiding windows.
- the doFream component is used to draw the content displayed on the screen when the screen refreshes.
- the Transaction component controls the SurfaceView component to draw video images.
- the view system includes visual components, such as components that display text and components that display images.
- the Android Runtime consists of the core libraries and the virtual machine.
- the Android runtime is responsible for the scheduling and management of the Android system.
- the core libraries consist of two parts: one part contains the functionalities that the Java language needs to call, and the other part contains the core Android libraries.
- the application layer and application framework layer run in the virtual machine.
- the system library can include multiple functional modules. For example: a surface manager, media libraries, a 2D graphics engine, and a 3D graphics processing library (e.g., OpenGL ES).
- the surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications.
- the media libraries support playback and recording of various common audio and video formats, as well as still image files.
- the media libraries support various 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 graphics.
- the kernel layer is the layer between hardware and software.
- the kernel layer includes at least display drivers and sensor drivers.
- the embodiments of this application take the operation of a foldable phone adjusting from a vertical grip to a horizontal grip based on the user's operation, and the switching from a vertical screen display image to a horizontal screen display image through rotation animation as an example for illustration, but this does not constitute a limitation on the application scenarios of the display method.
- the notched screen of the foldable phone displays the interface 105 (which can be called the first interface) in a vertical 0° orientation.
- the interface 105 includes an image 101a and three controls for favorites, return, and delete.
- the image 101a is located in the image display area 103 (which can be called the first area), and the three controls for favorites, return, and delete are located in the menu display area 102 (which can be called the second area).
- the menu display area 102 also has a cutout area for mounting a camera.
- image 101a is displayed in an upward direction (which may be referred to as the first direction) and is typically located in the center of image display area 103; the view of image 101a and the size of image 101a are the same.
- the user will be used as the reference point to describe the image display direction.
- Interface 106 can be understood as the interface 105 shown in Figure 10A(a) after being rotated 90° counterclockwise.
- Interface 106 includes an image 101b and three controls for favorites, back, and delete.
- Image 101b is located in the image display area 103, while the favorites, back, and delete controls are located in the menu display area 102.
- image 101b is displayed in a leftward direction (referred to as the second direction) and is usually located in the center of the image display area 103; the view of image 101b and the size of image 101b are also the same.
- the interface 106 shown in Figure 10A(b) provides the interface content for the initial interface of the rotation animation.
- the foldable phone takes a snapshot of the interface 106 shown in Figure 10A(b) to obtain the interface snapshot 107 shown in Figure 10A(e).
- the interface content of the interface snapshot 107 is the same as that of the interface 106 shown in Figure 10A(b), and will not be described here.
- the foldable phone can display interface snapshot 107, and based on the interface snapshot 107 shown in Figure 10A(e), the foldable phone obtains a window animation effect. Based on this window animation effect, the foldable phone displays interface snapshot 107 with its transparency gradually transitioning from 1 to 0. For example, the transition time can be 100ms. Of course, 1 and 0 are exemplary values. If the transparency of interface snapshot 107 is 1, it indicates that interface snapshot 107 is completely opaque; if the transparency of interface snapshot 107 is 0, it indicates that interface snapshot 107 is completely transparent.
- the foldable phone draws interface 108 as shown in Figure 10A(f) in the background.
- Interface 108 includes image 101c and three controls: favorite, back, and delete.
- the image 101c circled by the dashed box, is displayed in an upward direction (with the user as the reference point) and is usually located in the center of the image display area.
- the display angle can be understood as 0°.
- Interface 108 shown in Figure 10A(f) serves as the end interface for the rotation animation effect.
- the dashed box is for indicating image 101c; the foldable phone does not actually draw a dashed box. Furthermore, the three controls for favorites, back, and delete in the foldable phone's interface 108 are not the focus of this embodiment and will not be elaborated upon. It can be understood that the foldable phone can set the angle of the three menu controls displayed in the menu display area 102 to 0°.
- interface 108 shown in Figure 10A(f) is the same interface shown in Figure 2(b).
- the view of image 101c is drawn in white in interface 108.
- interface 106 shown in Figure 10A(b) provides the interface content for the starting interface of the rotation animation.
- the foldable phone can draw interface 109 shown in Figure 10A(g) in the background based on the interface content of interface 106 shown in Figure 10A(b), which is the starting interface of the rotation animation.
- Interface 109 includes image 101d and three controls: favorite, return, and delete.
- image 101d is displayed in the left direction, and the display angle can be understood as -90°.
- the foldable phone can also set the angle of the three menu controls displayed in the menu display area 102 to -90°.
- the three controls of favorite, return, and delete in interface 108 drawn by the foldable phone will not be described in detail.
- the background rendering of the interface 109 shown in Figure 10A(g) of the foldable phone includes: background rendering of the image 101d displayed in the interface 109 shown in Figure 10A(g), and background rendering of the menu controls displayed in the interface 109 shown in Figure 10A(g).
- background rendering of the image 101d displayed in the interface 109 shown in Figure 10A(g) can be understood as drawing the image 101d on the view based on the display position of the image 101b in the interface 106 shown in Figure 10A(b), without changing the view itself. Therefore, background rendering is a rendering operation that is not visible to the user.
- the irregular screen can display interface 109.
- the foldable phone displays interface 109, which includes an image 101d and three controls for favorites, back, and delete.
- Image 101d is located in the image display area 103, and the favorites, back, and delete controls are located in the menu display area 102.
- image 101d is displayed to the left and is usually located in the center of the image display area 103; the view of image 101d and the image display area 103 have the same size.
- the transparency of the snapshot 107 shown in Figure 10A(c) may not change to 0.
- it can continue to draw the interface 109 shown in Figure 10A(g) in the background to transition to the interface 108 shown in Figure 10A(f).
- the transparency of the snapshot 107 shown in Figure 10A(c) changes to 0, the transition from the interface 109 shown in Figure 10A(g) to a certain interface in the interface 108 shown in Figure 10A(f) drawn in the background can be displayed through the irregular screen.
- the display direction of the image is one of the leftward direction of the image in interface 109 shown in Figure 10A(g) and the upward direction of the image in interface 108 shown in Figure 10A(f), and the image is usually located in the center of the image display area 103.
- the foldable phone will draw and display the rotation animation effect of the transition from the starting interface shown in Figure 10A(d) to the ending interface shown in Figure 10B(j).
- Figure 10A(f) shows the final interface 108 with the rotation animation effect.
- Figure 10B(j) can be understood as showing the final interface 108 being drawn again by the folded phone and displayed on the screen after the final interface 108 is completed.
- the interface 108 includes an image 101c and three controls for favorite, return, and delete.
- the image 101c is located in the image display area 103, and the three controls for favorite, return, and delete are located in the menu display area 102.
- the view of the image 101c and the image display area 103 have the same size.
- Figure 10B exemplarily shows two interfaces in the rotation animation effect from the starting interface shown in Figure 10A(d) to the ending interface shown in Figure 10B(k), but this does not constitute a limitation on the display interface of the rotation animation effect.
- the foldable phone's irregularly shaped screen display interface 110 includes an image 101e and three controls for favorites, return, and delete.
- the image 101e is located in the image display area 103, and the three controls for favorites, return, and delete are located in the menu display area 102.
- the image 101e is displayed along a first upper-left direction, which can be understood as a direction in the process of transitioning from the left to the up direction; the view of the image 101e and the image display area 103 have the same size.
- the foldable phone's irregularly shaped screen display interface 111 includes an image 101f and three controls for favorites, return, and delete.
- the image 101f is located in the image display area 103, and the three controls for favorites, return, and delete are located in the menu display area 102.
- the image 101f is displayed along the second upper-left direction.
- the second upper-left direction can be understood as another direction in the process of transitioning from the leftward direction to the upward direction, and the second upper-left direction is closer to the upward direction.
- the view of the image 101f and the image display area 103 have the same size.
- the first upper-left direction and the second upper-left direction can be understood as third directions.
- the multiple interfaces in the process of transitioning from the starting interface shown in Figure 10A(d) to the ending interface shown in Figure 10B(j) on a foldable phone all include: drawing the image displayed on the interface and menu controls.
- the drawing of the image can be understood as drawing the image on the view based on the calculated display position, without changing the view itself.
- the drawing of the menu controls can be understood as controlling the rotation of the menu controls from -90° to 0°, in the same direction as the rotation of the image.
- images 101a, 101b, 101c, 101d, 101e, and 101f can be understood as containing the same image content.
- Interfaces 109, 110, 111, and 108 can be understood as the same interface, only the content of the interface has changed, and can be called the second interface.
- Figure 11(f) also exemplarily shows that when the irregularly shaped screen of a foldable phone displays image 101a at a vertical 0° angle, the size of image 101a and the size of view 104 of image 101a are the same. Also for ease of drawing, in Figure 11(a), image 101a and view 104 of the same size are drawn as a single layer to illustrate view 104 displaying image 101a, but this does not constitute a limitation on the meaning of image 101a and view 104.
- the image is displayed vertically at 0° on the folded phone, as shown in view104 in Figure 11(a), with an angle of 0°.
- the user controls the folding phone to rotate 90° counterclockwise from 0° vertically.
- the folding phone responds to this operation, maintaining view 104 unchanged at 0°.
- view 104 has rotated 90° counterclockwise as shown in Figure 11(b).
- the folding phone records the display angle, scaling ratio, and offset of image 101d within view 104 shown in Figure 11(b). Therefore, the display angle, scaling ratio, and offset of image 101d within view 104 shown in Figure 11(b) can be used to indicate the display position of image 101d within view 104 shown in Figure 11(b).
- the display position can include the display area and display orientation.
- the foldable phone draws view 104 as shown in Figure 11(c) in the background, as well as the image 101c displayed in view 104.
- image 101c is circled by a dashed box. Since view 104 does not change, the angle of view 104 is still 0°.
- the foldable phone in response to the screen rotating 90° counterclockwise from 0° vertically, the foldable phone typically sets view104 only once, based on the size of the image display area, as detailed in step S918 below.
- view104 is not reset. This ensures that the size of view104 remains the same as the image display area, filling the entire display area. Consequently, when the user performs a left or right swipe operation on the image display area to switch images, the foldable phone can respond to this operation.
- view104 gradually shrinks in size while rotating 90° clockwise. Therefore, the foldable phone repeatedly adjusts the size of view104, and the size and angle change accordingly. This results in view104 not filling the image display area and failing to respond to user swipes (left or right) on the image display area. Furthermore, since adjusting the size of view104 after scaling is ineffective, any attempt to resize the scaled view104 to match the image display area is also invalid.
- the foldable phone also records the display angle, scaling ratio, and offset of image 101c in view 104 shown in Figure 11(c). It can also be seen that the display angle, scaling ratio, and offset of image 101c in view 104 shown in Figure 11(c) can also be used to indicate the display position of image 101c in view 104 shown in Figure 11(c).
- the foldable phone calculates multiple display positions of the image during the transition from the display position shown in Figure 11(b) to the display position shown in Figure 11(c).
- each display position is also indicated by the display angle, scaling ratio and offset of the image in view 104 calculated by the foldable phone.
- Figures 11(d) and (e) show two display positions of the image on view 104 during the above transition process. Since view 104 does not change, the angle is still 0°.
- the display position of image 101e in Figure 11(d) can be found in Figure 10B(h), and the display position of image 101f in Figure 11(e) can be found in Figure 10B(i). They will not be described in detail here.
- the foldable phone draws an image in view104 based on the calculated display angle, scaling ratio, and offset of the image in view104 each time, thus completing the rotation animation effect of the image display area transitioning from the starting interface shown in Figure 10A(d) to the ending interface shown in Figure 10B(j).
- the application scenario of the display method described below is also: displaying images in the gallery application of a foldable phone.
- the foldable phone switches from vertical to horizontal image display through rotation animation based on the user's operation of adjusting the device from a vertical grip to a horizontal grip.
- this does not constitute a limitation on the application scenario of the display method, nor does it constitute a limitation on the executor of the display method.
- the display method provided in this embodiment includes:
- the foldable phone is in a vertical 0° position, and the user inputs and browses image 101 on the irregular screen.
- image 101 refers to image 101a displayed in the image browsing interface shown in Figure 10A(a).
- the size of image 101 is 1418 ⁇ 2520.
- the foldable phone is in a 0° vertical orientation and is in a folded state.
- the notched screen of the foldable phone is enabled for display.
- the user inputs an operation to start the camera, and the irregularly shaped screen displays a camera preview interface.
- the user inputs an operation on the camera preview interface to capture image 101, which is saved to the gallery application.
- the user inputs an operation to browse image 101 by operating a component linked to the gallery application on the camera browsing interface.
- the user inputs an action to launch the gallery application, and the gallery application's interface is displayed on the irregularly shaped screen, showing a thumbnail of image 101.
- the user selects image 101 in the gallery application's interface to input an action to browse image 101.
- This embodiment uses the example of a user operating a component linked to a gallery application on the camera browsing interface, specifically the operation of inputting and browsing image 101.
- the window manager detects the user's input to browse image 101 and sets the display angle to 0°.
- the window manager can monitor the user's input image browsing operation 101 based on touch sensors, etc., and set the display angle of the window to 0°, that is, the display angle of the window is 0°.
- the irregularly shaped screen is enabled for display, that is, the screen controlled as the display content.
- the window manager can record the value of the parameter of the folding phone display mode, which is used to indicate the screen for display.
- the window manager may also determine the orientation of the foldable phone based on components such as accelerometers and gyroscopes, and set the display angle of the window according to the determined orientation. As described in step S901, when the foldable phone is in a vertical 0° orientation, the window manager determines that it is in a vertical 0° orientation through accelerometers, gyroscopes, etc., and sets the display angle of the window to 0°.
- the window manager After the window manager detects the user's input to browse image 101, since image 101 is saved in the gallery and needs to be displayed using the gallery application, the window manager can also start the gallery to run.
- the activity component controls the window manager to set window animation effects.
- the window animation effect is a fade-in/fade-out animation effect.
- the window manager configures the parameters of the window animation effect based on the type of the window animation effect.
- View component sets the size of the view.
- the user inputs an operation to browse image 101 in step S901, and the foldable phone needs to display image 101 on the irregular screen, that is, display the browsing interface of image 101.
- the View component of the gallery application needs to create a view for the browsing interface of image 101.
- the menu display area 101 in the browsing interface of image 101 displayed on the irregular screen is used to display the menu
- the image display area 102 is used to display image 101. That is to say, the view of the browsing interface of image 101 can be understood as the view of the parent layout, which includes the child view of the menu display area and the child view of the area displaying image 101.
- the View component includes a parent layout ViewPager (i.e., the parent layout's layout manager), whose size can be set according to the dimensions of irregularly shaped screens, such as a width x height of 1080 x 1200.
- the parent layout's view might have dimensions of 1092 x 1200.
- the height of the child view displaying the area of image 101 is the same as the height of the parent layout view, while the width of the child view displaying the area of image 101 is less than the width of the parent layout view.
- the parent layout ViewPager can also set the difference between the left margin of the child view displaying the area of image 101 and the left margin of the parent layout view; that is, the width difference between the child view displaying the area of image 101 and the parent layout view.
- the View component sets the size of the child view displaying the area of image 101 based on the difference in the left margin set by the parent layout ViewPager. For example, if the parent layout ViewPager sets the difference in the left margin to 417, the size of the child view displaying the area of image 101 is: width x height 675 x 1200.
- the gallery app also includes a browser component, which manages the view and data, enabling users to switch between images displayed on irregularly shaped screens by swiping left or right in the gallery app's interface.
- the View component calculates and records the scaling ratio and offset of image 101, and records the display angle of image 101 as 0°.
- the width and height of image 101 may not match the width and height of the subviews displaying image 101. Therefore, image 101 needs to be adjusted.
- the onDraw component of the View component calculates the scaling ratio and offset of image 101.
- the onDraw component can adjust the size of image 101 using the scaling ratio and adjust the display position of image 101 in the subviews displaying image 101 using the offset.
- the scaling ratio of an image is calculated as follows:
- the widthRatio of the subviews displaying the area of image 101 to the width of image 101 is calculated based on Formula 1.
- widthRatio viewWidth/imageWidth
- viewWidth refers to the width of the subview of the area displaying image 101
- imageWidth refers to the width of image 101
- the heightRatio of the subviews displaying image 101 and the height of image 101 is calculated based on Formula 2.
- viewHeight refers to the height of the subview of the area displaying image 101
- imageHeight refers to the height of image 101.
- the scaling ratio currentScale of image 101 is obtained, which is the smaller value between the width ratio and the height ratio.
- the rule for calculating the image scaling ratio is:
- the aspect ratio of the image is 16:9.
- the scaling ratio of the image satisfies that the size of the image after scaling is the same as the size of the view, as shown in Figure 2(a) and (c).
- the aspect ratio of the image is greater than 16:9, and the scaling ratio of the image is such that the height of the image displayed fills the height of the view, as shown in Figure 3;
- the aspect ratio of the image is less than 16:9, and the scaling ratio of the image is such that the width of the image fills the width of the view, as shown in Figure 4.
- the image after the image is scaled, it does not perfectly fit the subviews of the area displaying image 101.
- the height of the scaled image is the same as the height of the subviews of the area displaying image 101, but their widths are different; or, the height of the scaled image is the same as the width of the subviews of the area displaying image 101, but their heights are different.
- the calculation of the image offset translate(x, y) includes: calculating the image offset on the x-axis and y-axis respectively based on Formula 4.
- the dimensions of image 101 are 1418 x 2520 (width x height); the view dimensions of the area displaying image 101 are 675 x 1200 (width x height).
- the View component determines that no animation effect exists, it determines the display position of image 101 in the child view based on the display angle, scaling ratio, and offset of image 101.
- This child view refers to the child view of the area where image 101 is displayed.
- the View component Since the foldable phone is currently displaying the browsing interface of image 101, and the foldable phone is not rotating, the View component will determine that there is no animation effect. In some embodiments, the View component can determine whether there is an animation effect based on whether the animation effect parameter is empty; of course, if the parameter is empty, there is no animation effect, and vice versa.
- the motion effect mentioned in this embodiment can be called rotation motion effect, which refers to the motion effect when the user rotates the folded phone and the folded phone displays the interface 109 shown in Figure 10A(d) transitions to the interface 108 shown in Figure 10B(j).
- the View component determines the display position of image 101 in the child view based on the display angle, scaling ratio, and offset of image 101, including:
- the component that performs step S909 can be the onDraw component in a View component.
- the View component determines the display position of image 101 in the child view based on the display angle, scaling ratio, and offset of image 101. This is one way to determine the display position of image 101 in the child view. It can be seen that the View component can also determine the display position of image 101 in the child view based on other parameters.
- the S910 and doFream components draw and display the interface shown in Figure 10A(a) on the screen.
- the doFream (draw refresh) component draws the view of the browsing interface of image 101, as well as the image display area of the view of image 101. Based on the scaling ratio and offset, image 101 is drawn. After the drawing is completed and displayed on the screen, the irregular screen can display the interface shown in Figure 10A(a).
- steps S902 to S910 can be understood as: the folding phone responds to the user's input to browse image 101, initializes the view of the browsing interface of image 101, and draws and displays the initial state of the view of the browsing interface of image 101.
- Steps S912 to S921 below describe the implementation scheme for displaying the interface shown in Figure 10A(b) after the irregularly shaped screen switches from displaying image 101 in portrait mode to displaying image 101 in landscape mode, and for drawing Figure 10A(f) in the background; steps S922 to S927 describe the implementation scheme for displaying the animation effect that transitions from Figure 10A(d) to Figure 10B(j) on the irregularly shaped screen.
- the window manager detects the user's input to rotate the screen counterclockwise by 90° and sets the display angle to 90°.
- the window manager can determine that the foldable phone has been rotated 90 degrees counterclockwise based on components such as accelerometer and gyroscope sensor, and based on this, the window manager sets the display angle of the window to 90°.
- the window manager will not record the window's display angle as 90° in this scenario.
- the window manager will also trigger the gallery application to execute the system callback onConfigChange to perform the following steps S914, S915 to S917, S918, and S920.
- the window manager can also determine whether the foldable phone has a notch screen and whether the notch screen is enabled.
- the window manager can determine whether the foldable phone has a notch screen based on the foldable phone's configuration parameters, and also determine whether the notch screen is enabled based on the value of the parameters recording the foldable phone's display mode.
- This application uses the example of a user rotating the screen counterclockwise by 90° to illustrate the concept, but this does not constitute a limitation on setting the window display angle in this case. It is understood that when a user rotates the screen counterclockwise by 180°, the window manager sets the window display angle to 180°.
- the window manager obtains a snapshot of the interface displayed on the screen and displays the interface shown in Figure 10A(c) on the screen.
- the irregularly shaped screen displays the interface shown in Figure 10A(a), and after the rotation, it displays as shown in Figure 10A(b).
- the window manager takes a screenshot of the interface shown in Figure 10A(b) to obtain an interface snapshot, and then displays the interface snapshot.
- the window manager can display the interface snapshot in the form of window animation through the following step S916.
- the window manager can also take a screenshot of the interface displayed on the irregularly shaped screen while the screen is rotated 90° counterclockwise, thus obtaining an interface snapshot.
- the window manager displays a snapshot of the interface on the display screen. This can be understood as the window manager creating another view, which is the same size as the image display area, to draw a snapshot of the interface.
- the window manager is configured with animation parameters. After the window manager sets the window display angle to 90°, the window animation corresponding to the parameter is activated, and the interface snapshot is displayed using the window animation corresponding to the animation parameter.
- the duration of the activated window animation is 100ms, which can be referred to as the second duration.
- the window animation can be a fade-in/fade-out type, controlling the transparency of the interface snapshot to gradually transition from 1 to 0, thus making the interface snapshot slowly transition from opaque to transparent.
- 1 and 0 are just example values.
- the window manager can discard the interface snapshot.
- the irregularly shaped screen displays the window animation.
- the folding phone performs steps S917 to S921 below, which involves drawing the window in the background but not displaying the drawn window on the irregularly shaped screen.
- the irregularly shaped screen directly displays the interface shown in Figure 10A(f) drawn in steps S917 to S921 below, resulting in the screen flickering problem.
- steps S913, S914 and S916 is not limited to the order shown in Figure 12.
- the presenter component calculates the animation start angle -90°, and records the start scaling ratio and start offset.
- the interface displayed on the irregularly shaped screen rotates 90° accordingly.
- the presenter needs to calculate the window display angle at the start of the animation, called the animation start angle, and also record the initial scaling ratio and initial offset of image 101. Because the interface displayed on the irregularly shaped screen rotates with the screen but is not redrawn, the initial scaling ratio and initial offset of image 101 in the interface displayed on the irregularly shaped screen should be the same as the scaling ratio and offset of image 101 before the screen rotation.
- the presenter component calculates the animation start angle by obtaining the display angle lastRotation before screen rotation and the display angle currentRotation after rotation; and then using the following rules to obtain the animation start angle.
- the animation starting angle animRotation 90°.
- the starting angle of the animation can also indicate the direction of rotation; a negative value indicates counterclockwise rotation, and a positive value indicates clockwise rotation.
- the initial scaling and offset of image 101 in the animation should be the scaling and offset of image 101 when it was displayed before the screen rotation.
- the initial scaling and offset of image 101 recorded by the presenter component are: the scaling and offset of image 101 when it was displayed in portrait mode.
- the presenter component calculates the starting angle of image 101 as -90°, the starting scaling ratio of image 101 as 0.47619048, and the starting offset as (0, 0).
- the presenter component can also send a message with a 50ms delay to the handler.
- the 50ms delay is merely an example and can be referred to as the initial duration.
- the purpose of the presenter component sending the 50ms delay message to the handler is to wait for the View component to use the delay time to complete the view of the browsing interface for image 101 at the end of the animation.
- the presenter component can also trigger a redraw of the view.
- the presenter component triggers a redraw of the view of image 101 by setting the invalidate flag for the view of the browsing interface of image 101.
- the doFream component determines that the screen refresh time has been reached, it draws the view of the browsing interface of image 101 based on the invalidate flag.
- the size of the view of the browsing interface of the redrawn image 101, the scaling ratio and offset of the image 101 when displayed in the child view, and the display angle of the image 101 are obtained by the following steps S918 and S919. It is understood that the View component can execute the following steps S918 and S919 within the aforementioned delay period.
- View component sets the size of the view.
- the View component needs to reset the size of the view of the browsing interface of image 101, that is, set the size of the window displaying image 101 in landscape mode.
- the parent layout ViewPager sets the size of the landscape window.
- the size of the view of the browsing interface of image 101 i.e., the view of the parent layout
- the size of the view of the browsing interface of image 101 is: width x height 1200 x 1092.
- the width of the child view displaying image 101 is the same as the width of the parent layout's view, but the height of the child view displaying image 101 is less than the height of the parent layout's view.
- the parent layout's ViewPager can also set the difference between the bottom edge of the child view displaying image 101 and the bottom edge of the parent layout's view, which is the height difference between the child view displaying image 101 and the parent layout's view.
- the View component sets the size of the child view displaying image 101 based on this difference in bottom edges set by the parent layout's ViewPager. For example, if the parent layout's ViewPager sets the difference in bottom edges to 417, the size of the view displaying image 101 will be: width x height 1200 x 675.
- the View component calculates and records the scaling ratio and offset of image 101, and records the display angle of image 101 as 0°.
- the irregularly shaped screen switches from portrait to landscape display.
- the irregularly shaped screen displays image 101 in landscape mode, meaning the window displaying image 101 is a horizontal window.
- the View component needs to calculate the scaling ratio and offset of image 101 when it's displayed in landscape mode. Furthermore, even though image 101 is displayed in landscape mode, it's still facing forward, and the View component records the display angle of image 101 as 0°.
- the presenter component uses Formulas 1 to 3 to calculate the scaling ratio of image 101 when the irregularly shaped screen displays image 101 in landscape mode, and uses Formula 4 to calculate the offset of image 101.
- the View component determines the display position of image 101 in the child view based on the display angle, scaling ratio, and offset of image 101.
- the child view refers to the child view of the area where image 101 is displayed.
- the motion effect mentioned in step S920 can also be called a rotation motion effect, which refers to the motion effect of the user rotating the folded phone and the folded phone displaying interface 109 shown in Figure 10A(d) transitioning to interface 108 shown in Figure 10B(j).
- the View component determines that no animation effect exists. Furthermore, the View component determines the display position of image 101 within the child view based on the display angle, scaling ratio, and offset of image 101.
- the method by which the View component determines the display position of image 101 within the view based on the display angle, scaling ratio, and offset of image 101 can be described as in step S909 above, and will not be repeated here.
- the component that performs the action in step S920 can be the onDraw component in the View component.
- the View component determines the display position of image 101 in the child view based on the display angle, scaling ratio, and offset of image 101. This is one way to determine the display position of image 101 in the child view. It can be seen that the View component can also determine the display position of image 101 in the child view based on other parameters.
- the doFream component draws the interface shown in Figure 10A(f) in the background.
- the doFream component draws the view for displaying the image in landscape mode, as well as the image display area within the view for displaying the image in landscape mode. It draws image 101 based on the scaling ratio and offset of image 101, but does not display it on the screen.
- the irregularly shaped screen continues to display the window animation started by the window manager.
- the interface shown in Figure 10A(f), drawn in the background by the doFream component is not visible to the user because the view for displaying the image in landscape mode and the view for drawing the snapshot created in step S913 are superimposed and sent to the display screen, and are superimposed along a direction perpendicular to the screen (i.e., the Z-axis).
- the Z-axis value of the view for drawing the snapshot is greater than the Z-axis value of the view for displaying the image in landscape mode.
- the view for drawing the snapshot is opaque, it obscures the interface shown in Figure 10A(f) drawn in the background by the doFream component, and therefore the user will not see the interface shown in Figure 10A(f).
- the presenter component records the animation ending angle (0°), the ending scaling ratio, and the ending offset, and then sets the animation effect.
- the handler component receives a message from the presenter component. Upon receiving the message, the handler component controls the presenter component to record the animation end angle, as well as the end scaling ratio and end offset of image 101 in the animation.
- the handler component controls the presenter component to record the animation end angle, as well as the end scaling ratio and end offset of image 101 in the animation.
- image 101 on the irregularly shaped screen transitions from Figure 10A(d) to Figure 10B(j).
- Image 101c displayed in Figure 10B(j) exhibits a vertical 0° display effect; therefore, the animation end angle is 0°.
- the animation end angle can be understood as the display angle of image 101 at the end of the animation.
- image 101c is displayed horizontally. Therefore, the scaling ratio and offset of image 101 when the landscape display window displays image 101, calculated in step S919, are the scaling ratio and offset of image 101 at the end of the animation.
- the ending angle of image 101 is 0°
- the ending scaling ratio of image 101 is 0.26785713
- the ending offset of image 101 is (410.0893, 0.0).
- the animation mentioned in this step can be understood as the process of drawing image 101 in the view of image 101 within a certain period of time, based on the display angle, scaling ratio and offset of image 101.
- an animation effect includes multiple renderings of image 101 within a certain duration, based on the display angle, scaling ratio, and offset of image 101. Constructing an animation effect can be understood as obtaining the display angle, scaling ratio, and offset of image 101 corresponding to each rendering within a certain duration, where the certain duration refers to the execution duration of the animation effect.
- the duration of the animation execution should be less than or equal to the total duration of the animation.
- the scaling ratio of each corresponding image drawn is between 0.47619048 and 0.26785713.
- the start and end angles are recorded by the presenter component as described in steps S917 and S922.
- the display angle is between -90° and 0°.
- the range is 0 to 410.0893.
- ⁇ getInterpolation(runingTime/duration) ⁇ refers to the rate of change of the x-axis offset returned by the interpolator
- ⁇ getInterpolation(runingTime/duration) ⁇ change ⁇ refers to the product of the rate of change of the x-axis offset and the total change of the x-axis offset, which is the amount by which the x-axis offset should change in the current drawing
- ⁇ startValue ⁇ refers to the starting offset of the x-axis. At the start of the second drawing, ⁇ startValue ⁇ refers to the x-axis offset corresponding to the previous drawing.
- ⁇ getInterpolation(runingTime/duration) ⁇ refers to the rate of change of the y-axis offset returned by the interpolator
- ⁇ getInterpolation(runingTime/duration) ⁇ change ⁇ refers to the product of the rate of change of the y-axis offset and the total change of the y-axis offset, which is the amount by which the y-axis offset should change in the current drawing
- ⁇ startValue ⁇ refers to the starting offset of the y-axis. At the start of the second drawing, ⁇ startValue ⁇ refers to the y-axis offset corresponding to the previous drawing.
- step S1006 the flag of the animation is set to empty. This can control that after the current image drawing is completed, the display angle, scaling ratio and offset of the image 101 corresponding to the previous drawing in the animation process will not be calculated again.
- the View component determines the display position of image 101 in the view based on the display angle, scaling ratio, and offset of the corresponding image 101 drawn at each stage of the animation process.
- the View component calculates the display angle, scaling ratio, and offset of image 101 corresponding to one drawing during the animation execution process. Based on these parameters, the View component also determines the display position of image 101 within the view.
- the method by which the View component determines the display position of image 101 based on its display angle, scaling ratio, and offset is as described in step S909 above, and will not be repeated here.
- the View component determines the display position of image 101 in the view based on the display angle, scaling ratio, and offset of the corresponding image 101 drawn in each animation process. This is one way to determine the display position of image 101 in the view. It can be seen that the View component can also determine the display position of image 101 in the view based on other parameters.
- the window manager responds to a 100ms window animation by gradually changing the snapshot's transparency from 1 to 0.
- the window manager in response to the 100ms window animation, gradually changes the transparency of the displayed interface snapshot from 1 to 0. This ensures that the interface drawn by the doFream component in step S926 is visible to the user.
- 100ms is just an example of the window animation duration.
- steps S925 and S926 is not limited to the order shown in Figure 12.
- S926 and the doFream component sequentially draw the interfaces shown in Figure 10A(d) to Figure 10B(j) according to the display position of the image.
- the doFream component draws the display angle, scaling ratio, and offset of the image 101 corresponding to one drawing in the animation execution process calculated by the View component, the window animation started by the window manager has not yet ended, but it is also coming to an end.
- the content drawn by the doFream component in the first few times could not be displayed on the screen. That is, the images in Figure 10A (d) and the following frames may not be visible to the user, but it does not affect the user's perception that the irregular screen transitions from the interface in Figure 10A (d) to the interface in Figure 10B (j).
- the user controls the screen to switch from vertical 0° to horizontal 90°.
- the foldable phone completes the drawing of the horizontal display window by executing steps S918 to S920 through the View component, thus obtaining the view when displaying image 101 in landscape mode.
- the display angle, scaling ratio, and offset of image 101 during the transition from vertical to horizontal display window are obtained by executing steps S923 to S924 through the View component.
- the foldable phone draws image 101 on the view when displaying image 101 in landscape mode through the doFream component, based on the display angle, scaling ratio, and offset of image 101.
- the view of image 101 does not scale and always fills the image display area, which can ensure that it responds to the user's left and right swipe operations on the image display area.
- the irregularly shaped screen of the foldable phone displays a frame of image 201 from the video at a vertical 0° orientation.
- the foldable phone responds by controlling the view displaying image 201, as shown in Figure 14(b), to rotate 90° counterclockwise along with the foldable phone.
- the image displayed in the view of image 201 does not rotate. This will be explained below with reference to Figure 15.
- Figure 15(d) exemplarily illustrates a foldable phone's irregularly shaped screen displaying a frame of image 201 from a video at a vertical 0° angle.
- the size of image 201 and the size of view 202 of image 201 are the same.
- image 201 and view 202 of image 201 which are of the same size, are drawn as a single layer to indicate the display of view 202 of image 201 (hereinafter referred to as view 202).
- view 202 the display of view 202 of image 201
- this does not constitute a limitation on the meaning of image 201 and view 202 of image 201.
- the folding phone when the user controls the folding phone to rotate 90° counterclockwise from 0° vertically, the folding phone needs to control the view to rotate 90° counterclockwise in response to the operation. That is: when the folding phone responds to the operation of rotating 90° counterclockwise from 0° vertically, it controls the view 202 shown in Figure 15(a) to be adjusted to the way shown in Figure 15(b) in Figure 15(c).
- this application also provides another display method.
- the display method provided in this application embodiment can also be applied to electronic devices including irregularly shaped screens.
- the type of electronic device can be diverse and there are no specific limitations.
- the components of the electronic device are shown in Figure 8, and the software structure is shown in Figure 9, which will not be described in detail here.
- the notched screen of the foldable phone displays interface 105 (which can be referred to as the first interface) at a vertical 0° angle.
- Interface 105 includes a frame image 201a of a video, and three controls for favorites, back, and delete.
- Image 201a is located in image display area 103 (which can be referred to as the first area), and the three controls for favorites, back, and delete are located in menu display area 102 (which can be referred to as the second area).
- Menu display area 102 also has a cutout area (represented by a circular hole in the figure) for mounting a camera.
- the video can be in playback.
- image 201a in the video is displayed in an upward direction (which can be referred to as the first direction) and is usually located in the center of image display area 103; the view of image 201a has the same size as image 201a.
- the foldable phone when the foldable phone receives an operation on the favorites control, it can add the first image to the favorites album in the gallery; when the foldable phone receives an operation on the back control, it can display the previous level interface of the first interface; when the foldable phone receives an operation on the delete control, it can delete the first image.
- Interface 106 can be understood as the interface 105 shown in Figure 16A(a) after being rotated 90° counterclockwise. Because the video is playing, the video displayed on interface 106 may change after the user controls the foldable phone to rotate 90°, as shown in Figure 16A(b).
- Interface 106 includes another frame image 201b of the video, and three controls for favorite, return, and delete. Image 201b is located in image display area 103, and the three controls for favorite, return, and delete are located in menu display area 102.
- the foldable phone takes a snapshot of the interface 106 shown in Figure 16A(b) to obtain the interface snapshot 107 shown in Figure 16A(e).
- the interface content of the interface snapshot 107 is the same as that of the interface 106 shown in Figure 16A(b), and will not be described here.
- the foldable phone also generates a window animation based on the interface snapshot 107 shown in Figure 16A(e). As shown in Figure 16A(c), based on this window animation, the foldable phone displays the interface snapshot 107 gradually transitioning from an opacity of 1 to 0. For example, the transition duration can be 100ms. Of course, 1 and 0 are exemplary values. An opacity of 1 indicates that the interface snapshot 107 is completely opaque, and an opacity of 0 indicates that the interface snapshot 107 is completely transparent. When the interface snapshot 107 is completely transparent, the foldable phone can discard the interface snapshot 107.
- the folding phone displays a window animation based on the interface snapshot 107, which interrupts the video playback.
- the duration of the window effect is very short, at the millisecond level, the video content before and after the interruption is basically the same, and the user will not be aware that the video playback has been interrupted.
- the foldable phone background draws the interface 108 shown in Figure 16A(f).
- Interface 108 includes another frame image 201c from the video, and three controls: favorite, back, and delete.
- the image 201c circled by the dashed box is displayed in an upward direction, and the display angle can be understood as 0°.
- the interface 108 shown in Figure 16A(f) serves as the ending interface for the rotation animation effect.
- the dashed box is for indicating image 201c; the foldable phone does not actually draw a dashed box. Furthermore, the three controls for favorites, back, and delete in the foldable phone's interface 108 are not the focus of this embodiment and will not be explained in detail. It can be understood that the foldable phone can set the angle of the three menu controls displayed in the menu display area to 0°.
- interface 106 shown in Figure 16A(b) provides the interface content for the starting interface of the rotation animation.
- the foldable phone can draw interface 109 shown in Figure 16A(g) in the background based on the interface content of interface 106 shown in Figure 16A(b), which is the starting interface of the rotation animation.
- Interface 109 includes another frame image 201d in the video, and three controls: favorite, return, and delete.
- image 201d is displayed in the left direction, and the display angle can be understood as -90°.
- the foldable phone can also set the angle of the three menu controls displayed in the menu display area to -90°.
- the background rendering of the interface 109 shown in Figure 16A(g) of the foldable phone includes: background rendering of the image 201d displayed in the interface 109 shown in Figure 16A(g), and background rendering of the menu controls displayed in the interface 109 shown in Figure 16A(f).
- background rendering of the image 201d displayed in the interface 109 shown in Figure 16A(g) can be understood as rendering another frame of the video image 201d on the view based on the display position of image 201b in the interface 106 shown in Figure 16A(b), without changing the view itself. Therefore, background rendering is a rendering operation that is invisible to the user.
- the foldable phone displays interface 109, which includes another frame image 201d from the video, and three controls for favorites, back, and delete.
- Image 201d is located in the image display area 103, and the three controls for favorites, back, and delete are located in the menu display area 102.
- image 201d is displayed to the left and is usually located in the center of the image display area 103; the view of image 201d and the image display area 103 have the same size.
- the foldable phone draws and displays a rotational animation as the starting interface shown in Figure 16A(d) transitions to the ending interface shown in Figure 16B(j).
- Figure 16A(f) shows the final interface 108 with the rotation animation effect.
- Figure 16B(j) can be understood as showing the interface displayed on the screen after the folded phone redraws the final interface 108.
- the interface 108 includes an image 201c and three controls for favorite, return, and delete.
- the image 201c is located in the image display area 103, and the three controls for favorite, return, and delete are located in the menu display area 102.
- the view of the image 201c has the same size as the image display area 103.
- Figure 16B exemplarily shows two interfaces in the rotation animation effect where the starting interface shown in Figure 16A(d) transitions to the ending interface shown in Figure 16B(j), but this does not constitute a limitation on the display of interfaces in the rotation animation effect.
- the foldable phone's irregularly shaped screen display interface 110 includes another frame image 201e from the video, and three controls for favorites, back, and delete.
- Image 201e is located in the image display area 103, and the three controls for favorites, back, and delete are located in the menu display area 102.
- image 201e is displayed along a first upper-left direction, which can be understood as a direction in the process of transitioning from the left to the up direction; the view of image 201e and the image display area 103 have the same size.
- the foldable phone's irregularly shaped screen display interface 111 includes another frame image 201f of the video, and three controls for favorites, back, and delete.
- Image 201f is located in the image display area 103, and the three controls for favorites, back, and delete are located in the menu display area 102.
- image 201f is displayed along a second upper-left direction.
- the second upper-left direction can be understood as another direction in the process of transitioning from the leftward direction to the upward direction, and the second upper-left direction is closer to the upward direction.
- the view of image 201f and the image display area 103 have the same size.
- the first upper-left direction and the second upper-left direction can be understood as third directions.
- the display direction of the image is one of the leftward direction of the image in the interface 109 shown in Figure 16A(g) and the upward direction of the image in the interface 108 shown in Figure 16A(f), and the image is usually located in the center of the image display area 103.
- the multiple interfaces in the process of transitioning from the starting interface shown in Figure 16A(d) to the ending interface shown in Figure 16B(j) of the foldable phone drawing process all include: the video content displayed on the drawing interface and menu controls.
- the video content displayed on the drawing interface can be understood as drawing video content on the view based on the calculated display position of the video content.
- the view itself does not change, but the video content drawn on the view can change as the video plays.
- the menu controls can be understood as controlling the rotation of the menu controls from -90° to 0°.
- images 201a, 201b, 201c, 201d, 201e, and 201f are images from the video.
- the image content of images 201a, 201b, 201c, 201d, 201e, and 201f is the same.
- the video can continue playing while the foldable phone displays a rotation animation.
- the video content displayed on the foldable phone's irregularly shaped screen can change.
- the display method provided in this embodiment includes:
- video refers to the video displayed on the video browsing interface shown in Figure 16(a).
- the size of a single frame in the video is 1418 ⁇ 2520.
- the foldable phone is in a 0° vertical orientation and is in a folded state.
- the notched screen of the foldable phone is enabled for display.
- user input activates the camera, displaying a camera preview interface on the irregularly shaped screen.
- the user inputs actions on the camera preview interface to capture video, which is then saved to the gallery app.
- the user then interacts with components linked to the gallery app on the camera browsing interface to view the video.
- the user inputs an action to launch the gallery application, and the gallery application interface is displayed on the irregularly shaped screen, showing thumbnails of videos.
- the user selects a video in the gallery application interface to input an action to browse the video.
- This embodiment uses the example of a user browsing a video by operating a component linked to the gallery application on the camera browsing interface.
- the window manager detects user input to browse video and sets the display angle to 0°.
- the window manager can monitor the user's video browsing operations based on touch sensors and other means.
- the window manager sets the display angle to 0°, meaning the window's display angle is 0°.
- the irregularly shaped screen is enabled for display, and the window manager can record the value of the parameter of the folding phone display mode, which is used to indicate the screen for display.
- the window manager can also determine the orientation of the foldable phone based on components such as accelerometers and gyroscopes, and set the display angle of the window according to the determined orientation. As described in step S1201, when the foldable phone is in a vertical 0° orientation, the window manager determines that it is in a vertical 0° orientation through accelerometers, gyroscopes, etc., and sets the display angle of the window to 0°.
- the window manager After the window manager detects the user's input to browse videos, since the videos are stored in the gallery and need to be displayed using the gallery application, the window manager can also launch the gallery application.
- the activity component controls the window manager to set window animation effects.
- the window animation effect is a fade-in/fade-out animation effect.
- the window manager configures the parameters of the window animation effect based on the type of the window animation effect.
- VideoTouchView the container for the video player
- the user inputs the operation to browse the video in step S1201, and the foldable phone then needs to display the video browsing interface on the notch screen.
- the menu display area in the video browsing interface displayed on the notch screen is used to display the menu
- the image display area is used to display the video content. That is to say, the view of the video browsing interface can be understood as the view of the parent layout, which includes a child view of the menu display area and a child view of the video content display area.
- the child view of the video content display area is used to display the image 201a shown in Figure 16(a).
- creating the video view involves setting the size of the video browsing interface view, which in turn sets the size of the parent layout view.
- the SurfaceView component includes a parent layout ViewPager (i.e., the parent layout's layout manager), which can set the size of the parent layout's view based on the screen's dimensions, for example, a width x height of 1080 x 1200.
- the parent layout's view might have dimensions of 1092 x 1200.
- the height of the child view displaying the video content area is the same as the height of the parent layout view, while the width of the child view displaying the video content area is less than the width of the parent layout view.
- the parent layout ViewPager can also set the difference between the left margin of the child view displaying the video content area and the left margin of the parent layout view; this difference represents the width difference between the child view displaying the video content area and the parent layout view.
- the SurfaceView component sets the size of the child view displaying the video content area based on this difference in left margin settings from the parent layout ViewPager. For example, if the parent layout ViewPager sets the left margin difference to 417, the size of the child view displaying the video content area will be: width x height 675 x 1200.
- the SurfaceView component calculates and records the scaling ratio and offset of the video, and records the display angle of the video as 0°.
- the ⁇ updateVideoView ⁇ component of the ⁇ SurfaceView ⁇ component calculates the scaling ratio and offset of the image in the video.
- the ⁇ updateVideoView ⁇ component can adjust the size of the image in the video using the scaling ratio and adjust the display position of the image in the subview within the area displaying the video content using the offset.
- updateVideoView component calculates the scaling ratio and offset of the images in the video, as well as the method of recording the display angle of the video, which can be found in step S908 of the aforementioned embodiment, and will not be repeated here.
- the SurfaceView component determines that there is no animation effect, it sets the width and height of the video content to the Transaction component, as well as sets a matrix carrying the display angle and offset.
- the SurfaceView component will determine that there is no animation effect.
- the SurfaceView component can determine whether an animation effect exists based on whether the animation effect parameter is empty; of course, if the parameter is empty, there is no animation effect, and vice versa.
- the motion effect mentioned in this embodiment can be called rotation motion effect, which refers to the motion effect of the user rotating the folded phone and the folded phone displaying interface 109 shown in Figure 16A(d) transitioning to interface 108 shown in Figure 16B(j).
- the SurfaceView component sets the width and height of the video content to the Transaction component, and sets the matrix carrying the display angle and offset, as shown in Figure 18, including:
- the matrix object after setting the angle can be expressed as matrix.setRotate(rotation).
- the angle set in the matrix object refers to the display angle of the video recorded by the SurfaceView component in step S1208, which is 0°.
- the matrix object after setting the angle is a matrix object with angle.
- the function ⁇ matrixArray matrix.getValues(matrixArray) ⁇ retrieves an array from the matrix object.
- the 2nd and 5th positions of this array are used to set the x-axis and y-axis offsets, respectively.
- the 2nd and 5th positions of the array carry the x-axis and y-axis offsets, respectively.
- the 2nd and 5th positions are just examples; the x-axis offset and y-axis offset can also be carried in other positions of the array.
- the x-axis offset and y-axis offset refer to the offset of the image in the video recorded by the SurfaceView component proposed in step S1208.
- the width and height of the video content refer to the following: based on the scaling ratio of the image in the video recorded by the SurfaceView component proposed in step S1208, the width and height of the image in the video are scaled up, that is, the width and height of the image displayed in the video.
- the width and height of the image in the video mentioned below refer to the width and height of the image displayed.
- Step S1304 can be expressed as setMatrix(Matrix matrix).
- the Transaction component includes a matrix object that does not include angles. In the native flow, the Transaction component uses this matrix object to control the SurfaceView component to draw the video frame. However, because the matrix object does not include angles, the video content cannot be rotated when the view is drawn.
- the application layer can modify the matrix object in the Transaction component.
- the interface between the Transaction component and the application layer is set by encapsulating the function corresponding to the matrix object in the Transaction component into a function that can be modified by the application layer.
- the SurfaceView component sets up an interface between the Transaction component and the application layer, setting data of a matrix object including angles and offsets to the matrix object in the Transaction component. In this way, the Transaction component controls the SurfaceView component to draw the video frame based on the matrix object, and the video content can be rotated based on the angle.
- the SurfaceView component sets the width, height, offset, and display angle of the video image to the Transaction component through steps S1303 and S1304.
- the Transaction component can then execute Transaction.apply() for subsequent operations. These subsequent operations can refer to the content of step S1210 below.
- the component that performs step S1209 can be the updateVideoView component within the SurfaceView component.
- the Transaction component controls the handler component to perform drawing operations through the SurfaceView component.
- the Transaction component can control the handler component to perform drawing operations based on a matrix object via a SurfaceView component.
- This matrix object may include the width and height of the video image, its offset, and the display angle.
- the Transaction component can send the matrix object's data to the SurfaceView component, which then controls the handler component to perform drawing operations based on this data.
- the matrix object's data may include the width and height of the video image, its offset, and the display angle.
- the handler component draws and displays the interface shown in Figure 16A(a) on the display screen.
- the Transaction component controls the handler component through the SurfaceView component to draw the view of the video browsing interface, as well as the subviews of the view's image display area (i.e., the area where the video content is displayed). Based on the width and height of the video image and the offset, the video image is drawn. After drawing is completed and displayed on the screen, the irregularly shaped screen can display the interface shown in Figure 16A(a). The display direction of the image in the video in the image display area can be indicated by the display angle.
- the display position of an image in a video can be determined based on its width, height, offset, and display angle.
- the display position of an image in a video can also be determined based on other parameters, and is not limited to the image's width, height, offset, and display angle.
- steps S1202 to S1211 can be understood as: the folding phone responds to the user's input to browse the video, initializes the view of the video browsing interface, and draws and displays the initial state of the view of the video browsing interface.
- the SurfaceView component includes an onLayout component, which is controlled by the Transaction component and in turn controls the handler component to draw and display the interface shown in Figure 16A(a).
- the onLayout component may send a message to the handler component to notify it to update the view in order to draw the interface shown in Figure 16A(a).
- Steps S1213 to S1223 below are the implementation scheme for displaying the interface shown in Figure 16A(b) after the irregularly shaped screen switches from displaying video in portrait mode to displaying video in landscape mode, and for drawing Figure 16A(g) in the background; steps S1224 to S1230 are the implementation scheme for displaying the animation effect that transitions from Figure 16A(d) to Figure 16B(j) on the irregularly shaped screen.
- the window manager detects the user's input of rotating the screen counterclockwise by 90° and sets the display angle to 90°.
- step S1213 can be found in step S912 of the aforementioned embodiment, and will not be repeated here.
- the window manager obtains a snapshot of the interface displayed on the screen and displays the interface shown in Figure 16A(c) on the screen.
- step S1214 can be found in step S913 of the aforementioned embodiment, and will not be repeated here.
- step S1217 can be found in step S916 of the aforementioned embodiment, and will not be repeated here.
- the VideoTouchView component calculates the starting angle of the animation -90°, and records the starting scaling ratio and starting offset.
- step S1218 of the VideoTouchView component For details on the specific implementation of step S1218 of the VideoTouchView component, please refer to step S917 in the aforementioned embodiment, which will not be repeated here.
- the VideoTouchView component can also send a 50ms delayed message to the handler component.
- the 50ms delay is merely an example.
- the purpose of the VideoTouchView component sending the 50ms delayed message to the handler component is to wait for the SurfaceView component to use the delay time to complete the view of the video when the animation ends.
- the VideoTouchView component can also trigger a view redraw.
- the VideoTouchView component triggers a view redraw by setting the invalidate flag on the video browsing interface view. Then, the handler component draws the video browsing interface view based on the invalidate flag.
- the size of the view in the redrawn video browsing interface, the scaling ratio and offset of the image displayed in the view, and the display angle of the image in the video are obtained by steps S1219 and S1221 below. It is understood that the SurfaceView component can execute steps S1219 and S1221 within the aforementioned delay period.
- the View component needs to reset the size of the view in the video browsing interface, that is, set the size of the window displaying the video in landscape mode.
- step S918 please refer to step S918 in the aforementioned embodiment, which will not be repeated here.
- the view of the image display area is typically set only once.
- the view of the image display area does not change and therefore cannot be reset. This ensures that the size of the view remains the same as the image display area, filling the entire image display area. Consequently, when the user performs a left or right swipe operation on the image display area to switch images, the foldable phone can respond to this operation.
- the S1220 and SurfaceView components calculate and record the video's scaling ratio and offset, and record the video's display angle as 0°.
- the irregularly shaped screen switches from portrait to landscape display.
- the irregularly shaped screen displays video in landscape mode, meaning the video window is horizontal.
- the SurfaceView component needs to calculate the scaling and offset of the image in the video when the video is displayed in landscape mode. Furthermore, even though the video is displayed in landscape mode on the irregularly shaped screen, it is still viewed upright, and the SurfaceView component records the video's display angle as 0°.
- step S919 of the aforementioned embodiment The method by which the SurfaceView component calculates and records the scaling ratio and offset of images in the video can be found in step S919 of the aforementioned embodiment, and will not be repeated here.
- the SurfaceView component determines that there is no animation effect, it sets the width and height of the video content to the Transaction component, as well as sets a matrix carrying the display angle and offset.
- the SurfaceView component determines that no animation effect exists. Furthermore, based on the video's display angle, scaling ratio, and offset, the SurfaceView component sets the width and height of the video content in the Transaction component, and also sets a matrix carrying the display angle and offset.
- the method by which the SurfaceView component sets the width and height of the video content in the Transaction component, and sets the matrix carrying the display angle and offset, can be as described in step S1209 above, and will not be repeated here.
- the motion effect mentioned in step S1221 can also be called rotation motion effect, which refers to the motion effect of the user rotating the folded phone and the folded phone displaying interface 109 shown in Figure 16A(d) transitioning to interface 108 shown in Figure 16B(j).
- the Transaction component controls the handler component to perform background drawing operations through the SurfaceView component.
- the handler component draws the landscape view and the image display area of the landscape view. It draws the video image based on the video display angle, width, height and offset, but does not display it on the screen and it is not visible to the user.
- the irregular screen continues to display the animation of the window manager starting.
- the display position of the image in the video can also be determined based on the width and height, offset, and display angle of the image in the video.
- the display position of the image in the video can also be determined based on other parameters.
- the VideoTouchView component records the ending angle of the animation (0°), the ending scaling ratio, and the ending offset after a 50ms delay, and then sets the animation effect.
- the handler component receives a message from the VideoTouchView component.
- the VideoTouchView component Upon receiving the message, the VideoTouchView component records the ending angle of the animation, as well as the ending scaling ratio and ending offset of the video during the animation.
- step S1224 of the VideoTouchView component For details on the specific implementation of step S1224 of the VideoTouchView component, please refer to step S922 in the aforementioned embodiment, which will not be repeated here.
- step S1225 of the SurfaceView component can be found in step S923 of the aforementioned embodiment, and will not be repeated here.
- the SurfaceView component calculates the display angle, scaling ratio, and offset of the video for each drawing during the animation execution process. Based on the display angle, scaling ratio, and offset of the video for each drawing, the SurfaceView component also sets the width and height of the video content and sets a matrix carrying the display angle and offset to the Transaction component.
- the SurfaceView component sets the width and height of the video content to the Transaction component based on the video's display angle, scaling ratio, and offset.
- the method of setting the matrix carrying the display angle and offset can be as described in step S1209 above, and will not be repeated here.
- the Transaction component controls the handler component to perform drawing operations through the SurfaceView component.
- step S1227 of the SurfaceView component can be found in the aforementioned step S1210, and will not be repeated here.
- the window manager responds to a 100ms window animation by gradually changing the snapshot's transparency from 1 to 0.
- the window manager In response to the 100ms window animation, gradually changes the transparency of the displayed interface snapshot from 1 to 0. This ensures that the interface drawn by the handler component in step S1229 is visible to the user.
- 100ms is just an example of the window animation duration.
- steps S1228 and S1229 are not limited to the order shown in Figure 17.
- the handler component sequentially draws the interfaces shown in Figure 16A(d) to Figure 16B(j) according to the width and height of the video content corresponding to each drawing operation, as well as the matrix carrying the display angle and offset.
- the SurfaceView component After the SurfaceView component obtains the width, height, display angle, and offset of the video content corresponding to each drawing operation during the animation process, it can also set an invalidate flag for the view corresponding to the video.
- the Transaction component based on the invalidate flag, controls the handler component through the SurfaceView component to draw the view corresponding to the video.
- the display position of the image in the video can also be determined.
- the display position of the image in the video can also be determined based on other parameters.
- each drawing operation performed by the handler component during the animation process is displayed on the screen through the irregular screen, which can then display the animation transition from (d) in Figure 16A to (j) in Figure 16B.
- the window manager initiates a 100ms window animation in step S1217. 50ms after the window animation starts, the folded phone sets the animation through the VideoTouchView component and calculates the display angle, scaling ratio, and offset of the video corresponding to one drawing operation during the animation execution process through the SurfaceView component.
- the actions of the VideoTouchView component and the SurfaceView component also take a certain amount of time. By the time the Transaction component controls the handler component to draw based on the display angle, width, height, and offset of the video corresponding to one drawing operation during the animation execution process calculated by the SurfaceView component, the window animation initiated by the window manager has most likely ended.
- the content drawn by the handler component each time can be displayed through the irregular screen, presenting the animation transition from Figure 16A(d) to Figure 16B(j).
- the window animation started by the window manager has not yet ended, but it is also coming to an end.
- the content drawn by the handler component in the first few times cannot be displayed on the screen. That is, the images in Figure 16A(d) and the following frames may not be visible to the user, but it does not affect the user's perception that the irregular screen transitions from the animation in Figure 16A(d) to the animation in Figure 16B(j).
- Another embodiment of this application provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps of any of the above methods.
- Computer-readable storage media can be non-transitory computer-readable storage media, such as read-only memory (ROM), random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage devices.
- ROM read-only memory
- RAM random access memory
- CD-ROM compact disc-read only memory
- magnetic tape magnetic tape
- floppy disk magnetic tape
- optical data storage devices optical data storage devices
- Another embodiment of this application provides a computer program product containing instructions.
- the computer program product When the computer program product is run on a computer or processor, it causes the computer or processor to perform one or more steps of any of the methods described above.
Landscapes
- Engineering & Computer Science (AREA)
- Environmental & Geological Engineering (AREA)
- Human Computer Interaction (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
本申请提供一种显示方法、电子设备、可读介质和程序产品,电子设备的显示屏包括不重合的第一区域和第二区域,第二区域设置有挖孔区域,挖孔区域安装有摄像头,第一区域是图像显示区域,电子设备显示第一界面时,用户输入沿第一旋转方向旋转设备的操作,电子设备可响应于用户的操作,先获取第一界面的快照并将其显示,可实现电子设备旋转时,显示屏先维持显示第一界面的界面内容。在第一界面的快照的透明度小于第二值时,图像显示区域先沿第三方向显示的第二图像,再显示由图第二图像过渡为第三图像的动效,第二图像沿第一图像的方向显示,实现了用户控制屏幕发生旋转时,显示屏的图像显示区域可显示图像的旋转动效。
Description
本申请要求于2024年06月28日提交中国专利局、申请号为202410869806.8、发明名称为“显示方法、电子设备、可读介质和程序产品”,以及要求于2024年06月13日提交中国专利局、申请号为202410768142.6、发明名称为“显示方法、电子设备、可读介质和程序产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及显示技术领域,尤其涉及一种显示方法、电子设备、计算机程序产品和计算机可读存储介质。
异形屏是指在非异形屏的基础上切掉部分,被切掉的区域用来安放摄像头、听筒等部件。异形屏可应用于手机等电子设备上。电子设备通常利用异形屏的部分区域显示图像,该区域一般要避开摄像头、听筒等部件的安装区域。
异形屏显示内容的过程中,为跟随用户调整电子设备的握持方式,例如竖向握持调整为横向握持,电子设备的异形屏可显示窗口的切换动效。但电子设备在异形屏上显示窗口的切换动效的功能还有待完善。
本申请提供了一种显示方法、电子设备、计算机程序产品和计算机可读存储介质,可实现电子设备响应用户操作进行窗口旋转,且在窗口旋转过程中由异形屏显示旋转动效。
为了实现上述目的,本申请提供了以下技术方案:
第一方面,本申请提供了一种应用于电子设备的显示方法,该电子设备的显示屏包括第一区域和第二区域,第一区域和第二区域不重合,第二区域设置有挖孔区域,挖孔区域安装有摄像头。该显示方法包括:电子设备的显示屏显示第一界面,第一界面中对应第一区域的区域内显示第一图像,第一图像沿第一方向显示,在第二区域中显示菜单控件,菜单控件用于处理第一图像,例如用于删除第一图像,收藏第一图像或者返回第一界面的上一界面。用户输入沿第一旋转方向旋转设备的操作,电子设备可响应于沿第一旋转方向旋转的操作,获取第一界面的快照。电子设备显示快照,显示的快照中第一图像沿第二方向显示,第二方向与第一方向具有第一夹角,第一夹角例如为90°,快照的透明度为第一值(示例性的为1)。在快照的透明度值小于第二值时,电子设备显示第二界面,第二界面中对应第一区域的区域内显示第二图像,第二图像沿第三方向显示,第三方向为第二方向过渡为第一方向过程中的方向,第二值小于第一值,快照的透明度为第二值可指示快照较为透明,电子设备显示的快照的下层界面可被用户看到;电子设备在第二界面中显示第二图像过渡为第三图像的动效,电子设备显示第三图像时,第三图像在第一区域沿第一方向显示;在电子设备的显示屏的第一区域显示第二图像和第二图像过渡为第三图像的动效的过程中,持续在第二区域中显示菜单控件。
可理解,上述技术方案中,第一图像,第二图像和第三图像均为电子设备绘制的不同图像。
在上述技术方案中:显示屏的第一区域可以理解成是图像显示区域,电子设备显示如图10A中(a)所示的第一界面105时,第一界面105中的图像沿第一方向显示。用户输入沿第一旋转方向旋转设备的操作(如逆时针旋转90°),电子设备可响应于用户的操作,先获取第一界面的快照并将其如图10A中(c)显示,如此可实现电子设备旋转时,显示屏先维持显示第一界面的界面内容。因第一界面的快照的透明度可变化,且可由不透明变化为透明,因此,在第一界面的快照的透明度小于第二值(第二值为趋近于0的值,示例性的为0.1)的情况下,显示屏的图像显示区域先沿第三方向显示的第二图像(如图10A中(d)所示),再显示由图第二图像过渡为第三图像的动效,第三图像沿第一图像的方向显示(如图10A中(d)至图10B中(j)所示),如此则实现了用户调整电子设备的握持方式致使屏幕发生旋转时,显示屏的图像显示区域可显示图像的旋转动效。
基于第一方面,在一个可能的实施方式中,电子设备显示快照之后,显示第二界面之前,显示方法还包括:电子设备确定第二图像的显示位置;电子设备基于第二图像的显示位置,在第一区域对应的第一视图中绘制第二图像。
在本实施方式中,电子设备采用在图像显示区域的视图上,基于第二图像的显示位置绘制第二图像的方式,在第二界面上绘制第二图像,图像显示区域的视图不需要发生尺寸或角度的变化,可避免视图发生尺寸变化导致视图与图像显示区域的尺寸不匹配,导致电子设备无法响应用户在图像显示区域上输入的操作的问题,还可以避免视图发生角度变化,但视图显示的图像不跟随视图发生角度变化导致无法显示旋转动效的问题。
基于第一方面,在一个可能的实施方式中,电子设备显示快照之后,显示方法还包括:电子设备创建第一视图,第一视图的尺寸为第一尺寸;电子设备确定第四图像的显示位置;电子设备基于第四图像的显示位置,在第一视图中绘制第四图像,第四图像的方向为第一方向。可理解,用户沿第一旋转方向旋转电子设备之后,电子设备响应该操作,可显示旋转动效。并且,电子设备显示旋转动效的过程中,通常仅创建一次第一区域对应的第一视图。在一些情况下,电子设备也可绘制多次第一区域对应的第一视图,只要能保证绘制的第一视图与第一区域尺寸相同,且角度不发生变动即可。
可理解:第一图像、第二图像、第三图像和第四图像也是电子设备绘制的不同图像。
基于第一方面,在一个可能的实施方式中,在第一视图中绘制第四图像的过程中,在快照的透明度为由第三值过渡为第四值,第三值小于第一值且大于第二值,第四值小于第三值且大于第二值;在快照的透明度为第三值过渡为第四值的过程中,第四图像对用户不可见。示例性的,第三值和第四值均为0.1和1之间的值。
在本实施方式中,在电子设备显示快照时,电子设备创建第一区域的第一视图,且在第一视频基于第四图像的显示位置绘制第四图像,可以理解成电子设备是后台绘制第四图像,第四图像对用户不可见,可以避免电子设备出现闪屏的问题。
在一些实施例中,快照的透明度为第三值过渡为第四值的过程中,电子设备还可在第一视图中绘制多帧图像,但绘制的图像均对用户不可见。
基于第一方面,在一个可能的实施方式中,在快照的透明度为第一值过渡为第二值的过程中,电子设备在第一视图中绘制的图像对用户不可见。其中,第二值为趋近于0的值,用于指示快照较为透明,用户可看到快照遮挡的下一层界面。因此,在快照的透明度在第一值到第二值的过程中,电子设备在第一视图绘制的图像,均被快照遮挡,无法被用户看见。
基于第一方面,在一个可能的实施方式中,显示方法还包括:确定第四图像的显示位置之前,电子设备确定是否存在动效;在确定不存在动效的情况下,确定第四图像的显示位置,以及延迟第一时长后,设置启动动效。
基于第一方面,在一个可能的实施方式中,显示方法还包括:确定第二图像的显示位置之前,电子设备确定是否存在动效;其中,在电子设备确定存在动效的情况下,确定第二图像的显示位置。
基于第一方面,在一个可能的实施方式中,电子设备创建第一视图,包括:设置显示屏的角度为第一角度;基于第一角度,创建第一视图。
基于第一方面,在一个可能的实施方式中,获取第一界面的快照之后,还包括:电子设备启动窗口动效,窗口动效用于控制电子设备显示快照时,快照的透明度由第一值过渡为第五值,第五值指示快照完全透明,第五值小于或等于第二值,第一值过渡为第五值的时长为第二时长。示例性的,第五值为0。
在本实施方式中,电子设备启动窗口动效以控制快照由不透明变化为完全透明,可以保证快照变化为半透明时,电子设备可显现出第二界面。
在一些场景中,快照的透明度过渡到0,电子设备绘制完成第二界面中的第二图像且通过显示屏显示,该场景中,第二值和第五值为同一数值。在一些场景中,快照的透明度过渡到趋近于0的值时,例如0.1,电子设备则绘制完成第二界面中的第二图像且通过显示屏显示,第五值则小于第二值。
基于第一方面,在一个可能的实施方式中,电子设备的显示屏显示第一界面之前,还包括:电子设备设置显示屏的角度为第二角度;电子设备基于第二角度,创建第一区域的第二视图,第二视图的尺寸为第二尺寸;电子设备确定第一图像的显示位置;电子设备基于第一图像的显示位置,在第二视图绘制第一界面。
基于第一方面,在一个可能的实施方式中,确定第二图像的显示位置,包括:计算得到第二图像的缩放比、偏移量和显示角度;第二图像的显示角度用于指示第三方向;第二图像的缩放比用于指示第二图像和第一区域的比例关系;第二图像的偏移量用于指示第二图像在第一区域的显示区域;基于第二图像的缩放比、偏移量和显示角度,确定第二图像的显示位置。
基于第一方面,在一个可能的实施方式中,计算得到第二图像的缩放比、偏移量和显示角度,包括:计算得到图像的缩放比的变化率、偏移量的变化率和显示角度的变化率;基于图像的缩放比的总变化量和图像的缩放比的变化率,计算得到一次图像绘制操作对应的图像的缩放比的变化值,将第五图像的缩放比和图像的缩放比的变化量的和,作为第二图像的缩放比;基于图像的偏移量的总变化量和图像的偏移量的变化率,计算得到一次图像绘制操作对应的图像的偏移量的变化值,将第五图像的偏移量和图像的偏移量的变化量的和,作为第二图像的偏移量;基于图像的显示角度的总变化量和图像的显示角度的变化率,计算得到一次图像绘制操作对应的图像的显示角度的变化值,将第五图像的显示角度和图像的显示角度的变化量的和,作为第二图像的显示角度;
其中,第五图像由电子设备基于第二图像的绘制操作的前一次绘制操作绘制得到;图像的缩放比的总变化量指代:第一图像的缩放比和第三图像的缩放比的差值;图像的偏移量的总变化量指代:第一图像的偏移量和第三图像的缩放比的差值;图像的显示角度的总变化量指代:电子设备沿第一旋转方向旋转的角度。
基于第一方面,在一个可能的实施方式中,电子设备在第二界面中显示第二图像过渡为第三图像的动效的实现方式,包括:电子设备在第一视图,基于多次绘制操作对应的图像的显示位置,绘制并显示图像;其中,多次绘制操作对应的图像的显示位置用于指示图像由第二图像过渡为第三图像。一些实施例中,电子设备每一次绘制操作得到的图像的显示位置,由图像的缩放比、偏移量和显示角度来指示。
基于第一方面,在一个可能的实施方式中,第一图像,第二图像,第三图像对应于图库中的同一个图像。一个应用场景中,电子设备启动相机应用运行拍摄图像,并保存于图库,用户通过操作相机浏览界面上链接图库应用的组件,输入浏览图像的操作,电子设备响应于该操作,显示第一界面。第一图像,第二图像和第三图像均可以理解成对应于电子设备拍摄且保存到图库的该图像。
基于第一方面,在一个可能的实施方式中,第一图像,第二图像,第三图像对应于同一视频中的不同帧图像。一个应用场景中,电子设备启动相机应用运行拍摄视频,并保存于图库,用户通过操作相机浏览界面上链接图库应用的组件,输入浏览视频的操作,电子设备响应于该操作,显示第一界面。第一图像,第二图像和第三图像可以理解成对应于电子设备拍摄且保存到图库的该视频中的不同帧图像。
基于第一方面,在一个可能的实施方式中,确定第二图像的显示位置,包括:计算第二图像显示的宽和高,以及通过矩阵对象设置第二图像的显示角度和偏移量;第二图像的显示角度用于指示第三方向;偏移量用于指示第二图像在第一区域的显示区域;基于第二图像显示的宽和高、偏移量和显示角度,确定第二图像的显示位置。
基于第一方面,在一个可能的实施方式中,通过矩阵对象设置第二图像的显示角度和偏移量的方式,包括:构建第一矩阵对象,所述第一矩阵对象存储有第二图像的偏移量和显示角度;通过事务Transaction组件和电子设备的应用程序层之间接口,向Transaction组件的第二矩阵对象写入第二图像的偏移量和显示角度。
在本实施方式中,Transaction组件本身属于框架层不向应用程序层开放的组件,应用程序层的应用无法修改Transaction组件中的矩阵对象,致使无法在矩阵对象中写入角度。基于此,通过在Transaction组件和应用程序层之间设置接口,实现应用程序层的应用可修改Transaction组件中的矩阵对象。电子设备通过Transaction组件和应用程序层之间设置接口,将包括角度和偏移量的矩阵对象的数据,设置给Transaction组件中的矩阵对象,如此,电子设备基于该矩阵对象绘制视频的画面,视频内容可基于角度进行旋转。
基于第一方面,在一个可能的实施方式中,第一图像显示在第一界面中对应第一区域的区域内的居中位置;第二图像显示在第二界面中对应第一区域的区域内的居中位置;第三图像显示在第二界面中对应第一区域的区域内的居中位置。
基于第一方面,在一个可能的实施方式中,电子设备在第二界面中显示第二图像过渡为第三图像的动效的过程中,电子设备还在第二区域显示菜单控件由第三方向过渡为第一方向的动效。
基于第一方面,在一个可能的实施方式中,菜单控件包括收藏控件、返回控件和删除控件中的一个或多个,菜单控件用于处理第一图像,包括:在菜单控件包括收藏控件的情况下,接收到作用于收藏控件的操作,将第一图像添加到图库的收藏相册中;在菜单控件包括返回控件的情况下,接收到作用于返回控件的操作,显示第三界面,第三界面为第一界面的上一级界面;在菜单控件包括删除控件的情况下,接收到作用于删除控件的操作,删除第一图像。
第二方面,本申请提供了一种电子设备,包括:一个或多个处理器、存储器以及显示屏;存储器和显示屏与一个或多个处理器耦合,存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,电子设备执行如第一方面及其可能的实施方式中任意一项所述的显示方法。
第三方面,本申请提供了一种计算机可读存储介质,用于存储计算机程序,计算机程序被执行时,具体用于实现如第一方面及其可能的实施方式中任意一项所述的显示方法。
第四方面,本申请提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行如第一方面及其可能的实施方式中中任意一项所述的显示方法。
图1为本申请实施例提供的显示屏沿水平方向折叠的折叠手机的示意图;
图2为本申请实施例提供的折叠手机的四种显示姿态的展示图;
图3和图4为本申请实施例提供的折叠手机以竖向0°和横向90°展示其他高宽比的图像的示意图;
图5至图7为折叠手机横竖屏切换时,异形屏显示图像异常的原理展示图;
图8为本申请实施例提供的电子设备的硬件结构图;
图9为本申请实施例提供的电子设备的软件框架图;
图10A,图10B和图11为本申请实施例提供的折叠手机显示图像场景中,折叠手机显示横竖屏切换动效的原理展示图;
图12为本申请实施例提供的折叠手机显示图像场景中的显示方法的交互图;
图13为本申请实施例提供的计算得到动效过程中一次绘制对应的图像的缩放比、偏移量和显示角度的流程图;
图14和图15为折叠手机横竖屏切换时,异形屏显示视频异常的原理展示图;
图16A和图16B为本申请实施例提供的折叠手机播放视频场景中,折叠手机显示横竖屏切换动效的原理展示图;
图17为本申请实施例提供的折叠手机播放视频场景中的显示方法的交互图;
图18为本申请实施例提供的向Transaction设置视频内容和矩阵数据的流程图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括例如“一个或多个”这种表达形式,除非其上下文中明确地有相反指示。还应当理解,在本申请实施例中,“一个或多个”是指一个、两个或两个以上;“和/或”,描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
本申请实施例涉及的多个,是指大于或等于两个。需要说明的是,在本申请实施例的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。
随着屏幕技术的发展,为了追求设备具有更高的屏占比,异形屏应运而生。异形屏是在非异形屏的基础上切掉部分,被切掉的区域用来安放摄像头、听筒等部件。在一些应用场景中,朝内翻折的可折叠电子设备包括:可折叠的第一屏,以及在第一屏处于折叠态时对用户可见的第二屏。第二屏可采用异形屏,第一屏也可采用异形屏。在使用时,在用户持握方式不发生变化的情况下,可折叠电子设备的显示屏可以是沿水平方向折叠(类似于传统的翻盖手机),也可以是沿重力方向折叠,水平方向与重力方向相垂直。
示例性的,图1展示了一种显示屏沿水平方向折叠的折叠手机。可以理解的是,图1展示的折叠手机处于折叠态,且折叠手机的转轴200位于折叠手机的顶边。
折叠手机包括可折叠的第一屏,以及第二屏100,如图1所示,折叠手机处于折叠态,用户可见第二屏100。第二屏100包括A区(可称为第二区域)和B区(可称为第一区域),A区和B区可以理解成是第二屏100的两个区域,并非指代两块单独的屏幕,A区和B区不重合;A区可用来挖孔安装摄像头,B区可用来作为图像、界面的显示区域。以第二屏100显示一张图像为例,A区用于显示图像的操作菜单,例如收藏、返回和删除等控件,B区用于显示图像内容。下述内容中,A区可以称呼为菜单显示区域,B区可以称呼为图像显示区域。
一些实施例中,折叠手机接收到作用于收藏控件的操作,可将第一图像添加到图库的收藏相册中;折叠手机接收到作用于返回控件的操作,可显示第一界面的上一级界面;折叠手机接收到作用于删除控件的操作,可删除第一图像。
用户可采用两种握持方式来握持电子设备,该两种握持方式通常称呼为横向握持和竖向握持。电子设备以图1所示的折叠手机为例,竖向握持可以理解成用户握持折叠手机时,折叠手机的转轴200垂直于重力方向,用户竖向握持折叠手机,折叠手机竖屏显示内容,横向握持可以理解成用户握持折叠手机时,折叠手机的转轴200平行于重力方向,用户横向握持折叠手机,折叠手机横屏显示内容。
异形屏显示图像或播放视频时,用户调整握持方式,电子设备能自动旋转窗口,例如用户从竖向握持调整为横向握持,电子设备则自动旋转窗口使其由竖屏显示画面切换为横屏显示画面。并且,基于异形屏的挖孔区域的限制,电子设备在旋转窗口时,异形屏的A区和B区会单独显示切换动效。
以下以图1展示的折叠手机为例,对异形屏横屏显示图像和竖屏显示图像的切换方案进行介绍。
示例性的,图2展示了折叠手机的异形屏横屏显示图像以及竖屏显示图像的界面。需要说明的是,为了方便用户查阅图像,折叠手机的异形屏横屏显示图像以及竖屏显示图像,折叠手机均维持图像正向显示,且图像还可位于图像显示区域的中间区域,当然,这并不构成对图像的显示方向和显示区域的限制。
图像和图像显示区域的尺寸可能并不适配,因此,折叠手机在图像显示区域显示图像之前,可先计算图像的缩放比,并基于图像的缩放比对图像进行缩放。并且,图像的高宽比与图像显示区域的高宽比相同或不同的情况下,折叠手机计算图像的缩放比的计算规则并不相同,具体可参见下述步骤S908处的内容。以下先结合图2至图3,对三种高宽比的图像显示在图像显示区域的界面进行介绍。
图2展示示例中,图像的高宽比和图像显示区域的高宽比相同,例如均是16:9。并且,图2展示的是用户逆时针旋转屏幕,控制折叠手机的异形屏进行竖屏显示图像和横屏显示图像的切换,但这并不构成本申请方案的应用场景的限制。
图2中(a)展示的折叠手机的姿态可以定义为竖向0°的姿态。
如图2中(a)所示,用户竖向握持折叠手机,折叠手机处于折叠态,异形屏100对用户可见。异形屏100的菜单显示区域102显示有收藏、返回和删除三种控件,还显示有两个挖孔区域(图中以圆孔表示),图像显示区域103显示有图像101,图像101可以理解为图库应用保存的一张图像。
因图像101的高宽比和图像显示区域103的高宽比相同,因此,以图中展示的竖直方向为高的方向,水平方向为宽的方向,图像101显示的高可布满图像显示区域103。图像101显示的宽也布满图像显示区域103。因图像在显示时可被缩放,故图像101显示的高和显示的宽,并不一定是图库记录的图像的高和宽。
图2中(b)展示的折叠手机的姿态可以定义为横向90°的姿态。
如图2中(b)所示,用户控制折叠手机由图2中(a)展示的竖向0°逆时针旋转90°,对应的,图像显示区域103由竖屏显示调整为横屏显示,菜单显示区域102也由竖屏显示调整为横屏显示。并且,图像101仅在图像显示区域103由竖屏显示调整为横屏显示,还可通过切换动效实现由竖屏显示平滑的调整为横屏显示;菜单显示区域102中的控件也是在菜单显示区域102由竖屏显示调整为横屏显示,同理,也可通过切换动效实现竖屏显示平滑的调整为横屏显示。
图2中(b)展示的图像101显示的高可布满图像显示区域103,但图像101显示的宽没有布满图像显示区域103,即图像显示区域103沿水平方向,存在部分区域未显示图像101的图像内容。
图2中(c)展示的折叠手机的姿态可以定义为竖向180°的姿态。
如图2中(c)所示,用户控制折叠手机由图2中(b)展示的横向90°逆时针旋转90°,对应的,图像显示区域103由横屏显示调整为竖屏显示,菜单显示区域102也由横屏显示调整为竖屏显示。同理,图2中(c)中,图像101仅在图像显示区域由横屏显示调整为竖屏显示,且通过切换动效完成过渡;菜单显示区域102中的控件也是在菜单显示区域102由横屏显示调整为竖屏显示,且通过切换动效完成过渡。
图2中(c)展示的图像101显示的高布满图像显示区域103,图像101显示的宽也布满图像显示区域103。
需要说明的是,用户控制折叠手机由竖向0°逆时针旋转180°,折叠手机的异形屏也需要由图2中(a)展示的界面,过渡为图2中(c)展示的界面。并且,图像101也是在图像显示区域通过切换动效完成过渡。
图2中(d)展示的折叠手机的姿态可以定义为横向270°的姿态。
如图2中(d)所示,用户控制折叠手机由图2中(c)展示的竖向180°逆时针旋转90°,对应的,图像显示区域103由竖屏显示调整为横屏显示,菜单显示区域102也由竖屏显示调整为横屏显示。同理,图2中(d)中,图像101仅在图像显示区域由竖屏显示调整为横屏显示,且通过切换动效完成过渡;菜单显示区域102中的控件也是在菜单显示区域102由竖屏显示调整为横屏显示,且通过切换动效完成过渡。
图2中(d)展示的图像101显示的高布满图像显示区域103,但图像101显示的宽没有布满图像显示区域103,即图像显示区域103沿水平方向,存在部分区域未显示图像101的图像内容。
需要说明的是,用户控制折叠手机由竖向0°顺指针旋转90°,或者控制折叠手机由竖向0°逆时针旋转270°,或者控制折叠手机由横向90°逆时针旋转180°,折叠手机的异形屏均会过渡到图2中(d)展示的界面,且图像101也是在图像显示区域通过切换动效完成过渡。
由图2可以看出:在图像的高宽比和异形屏中的图像显示区域的高宽比相同的情况下,异形屏以图2展示的四种姿态显示图像,图像101显示的高可以布满图像显示区域103,但图像101显示的宽不一定能布满图像显示区域103。
在图像显示区域103的两条相交的边中,垂直于转轴的边定义为图像显示区域103的长边,平行于转轴的边定义为图像显示区域103的短边,短边的长度小于长边的长度。当然,在一些实施例中,图像显示区域的长边和短边的尺寸也可相同,图像显示区域短边的长度也可以大于长边的长度。可以理解:图像101显示的高布满图像显示区域103,但图像101显示的宽不一定布满图像显示区域103,其实质是:图像101的图像内容均可以布满图像显示区域103的短边。
图3和图4展示了异形屏以竖向0°和横向90°展示其他高宽比的图像的示意图。
图3中,图像101的高宽比大于图像显示区域的高宽比。如图3中的(a)所示,异形屏的菜单显示区域102显示有收藏、返回和删除三种控件,还显示有两个挖孔区域(图中以圆孔表示),图像显示区域103显示有图像101。异形屏以竖向0°显示图像101,图像101的显示的高布满图像显示区域103,图像101显示的宽并没有布满图像显示区域103,图像101的左右两侧均有留白(图中以黑色展示留白)。如图3中的(b)所示,显示屏以横向90°显示图像101,图像101显示的高度的高也布满图像显示区域103,图像101显示的宽也没有布满图像显示区域103。同理,在异形屏以竖向180°和横向270°显示图像101的场景中,图像101显示的高布满图像显示区域103,图像101显示的宽没有布满图像显示区域103。
因此,在图像101的高宽比大于图像显示区域103的高宽比的场景中,异形屏以竖向0°,横向90°,竖向180°和横向270°的四种姿态显示图像101时,图像101显示的高布满图像显示区域103,但图像101显示的宽不会布满图像显示区域103。
图4中,图像101的高宽比小于图像显示区域103的高宽比。如图4中的(a)所示,异形屏的菜单显示区域102显示有收藏、返回和删除三种控件,还显示有两个挖孔区域(图中以圆孔表示),图像显示区域103显示有图像101。异形屏以竖向0°显示图像101,图像101显示的宽布满图像显示区域103,图像101显示的高并没有布满图像显示区域103,图像101的上下两侧均有留白(图中以黑色展示留白)。如图4中的(b)所示,显示屏以横向90°显示图像101,图像101显示的宽也布满图像显示区域103,图像显示的高也没有布满图像显示区域103,图像101的上下两侧均有留白(图中以黑色展示留白)。同理,在异形屏以竖向180°和横向270°显示图像101的场景中,图像101显示的宽布满图像显示区域103,图像101显示的高没有布满图像显示区域103。
因此,在图像101的高宽比小于图像显示区域103的高宽比的场景中,异形屏以竖向0°,横向90°,竖向180°和横向270°的四种姿态显示图像101时,图像101显示的宽布满图像显示区域103,但图像101显示的高不会布满图像显示区域103。
以下结合图5,以图2展示的折叠手机由竖向0°显示图像调整成横向90°显示图像为例,对异形屏100的图像显示区域103由竖屏显示切换为横屏显示的一种实现方案进行介绍,但同样这并不构成对本案的应用场景的限制。
如图5中(a)所示,折叠手机的异形屏以竖向0°的姿态在图像显示区域103显示图像101,同理,菜单显示区域102显示菜单控件。图5中(a)中,显示图像101的视图(view)和图像101的尺寸相同。下文中,显示图像101的view均称呼为图像101的view。
用户控制折叠手机逆时针旋转90°,折叠手机响应该操作,先控制图像101的view如图5中(b)所示,跟随折叠手机逆时针旋转90°,图5中(b)中,图像101的view和图像101的尺寸也相同。
之后,如图5中(c)所示,折叠手机控制以虚线框圈出的图像的view顺时针旋转90°并由图5中(b)展示的尺寸逐渐缩小至图像的高与图像显示区域103(图中的白色区域)的短边尺寸相同。可理解:图5中(c)中,虚线框是为了指示图像的view,折叠手机实际并不显示虚线框;并且,为绘图简单,菜单显示区域的操作菜单并未展示旋转动效。
再之后,折叠手机调整图像101的view的宽和高,使其能够与图像显示区域103的尺寸相同以完成横屏显示布局的操作。但是,折叠手机执行调整图像101的view的宽和高之后,异形屏会显示图5中(d)所示的界面,该界面中,图像不是正向显示,也没有处于图像显示区域103的居中位置,没有实现以图2中(b)展示的方式显示图像。
究其原因发现:
折叠手机执行调整图像101的view的宽和高操作,因图像101的view处于缩放状态,如此则导致折叠手机调整图像101的view的宽和高不能生效,即:折叠手机并没有成功完成调整图像101的view的宽和高的操作。以下结合图6对此进行说明。
首先需要说明的是,图像的view用于显示图像,图6中(f)示例性的展示了折叠手机的异形屏以竖向0°的姿态显示图像101时,图像101的尺寸和图像101的view104的尺寸相同。出于绘图方便的目的,图6中的(a)到(e)中,将尺寸相同的图像101和view104绘制成一层来示意显示有图像101的view104(以下简称为view104),但这并不构成对图像101和图像101的view104的含义的限制。
折叠手机的异形屏以竖向0°的姿态显示图像101,view104如图6中(a)所示,高为M,宽为N,角度为0°。用户控制折叠手机由竖向0°逆时针旋转90°,折叠手机响应于该操作,先控制view104由图6中(a)展示的竖向逆时针旋转为图6中(b)所示的横向,图6中(b)展示的view104的宽M与图6中(a)所示的view104的高M相同,图6中(b)展示的view104的高N与图6中(a)所示的view104的宽N相同,且view104的角度为0°。之后,折叠手机再控制view104如图6中(c)所示,顺时针旋转90°的同时逐渐缩小尺寸,直至如图6中(d)所示,view104被顺时针旋转到90°,且view104被缩小到其显示的图像的高h与图像显示区域103的高H相同。图像显示区域103如前述内容,可指代图1中的B区。
如图6中(d)可知:view104显示的图像的高h与图像显示区域103的高H相同,但view104显示的图像的宽w小于图像显示区域103的宽W,且因view104和view104显示的图像的尺寸相同,即view104的宽w小于图像显示区域103的宽W,如此则导致view104未撑满图像显示区域103,进而导致用户对图像显示区域103执行左滑、右滑操作以切换图像时,折叠手机无法响应该操作,不能实现图像的切换显示。
因此,折叠手机需要调整图6中(d)展示的view104的宽和高,以希望实现view104的宽w等于图像显示区域103的宽W,view104的高h等于图像显示区域103的高H,保证view104撑满图像显示区域103,进而保证折叠手机能够响应用户对图像显示区域103执行左滑、右滑操作。
但是,图6中(c)展示的view104的旋转和缩小过程,其实质通过矩阵计算的方式得到的投射的view104的旋转和缩小过程,真实的view104的尺寸并未发生调整。因此,折叠手机调整图6中(d)展示的view104的宽和高则会变成无效操作,导致view104还会如图6中(e)所示,角度为0°,高M与图6中(a)所示的view104的高M相同,宽N与图6中(a)所示的view104的宽N相同。并且,view104没有位于图像显示区域103的区域则无法显示,即图6中(e)所示的虚线框以下的区域无法显示,最终导致折叠手机的异形屏显示图5中(d)所示的界面。
需要说明的是,view104可以小于或者等于图像显示区域103,即图6中(b)展示的view104的宽M可小于或等于图6中(d)展示的图像显示区域103的宽W,图6中(b)展示的view104的高N可小于或等于图6中(d)展示的图像显示区域103的高H。
再进一步的:
折叠手机的异形屏横屏显示图像切换为竖屏显示图像时,异形屏显示的界面也存在问题。例如,折叠手机如图7中(a)所示,以横向90°在图像显示区域103显示图像101,菜单显示区域102显示菜单控件,用户调整折叠手机由横向握持为竖向握持,折叠手机响应于用户的操作,由横向90°显示图像调整成竖向0°显示图像,折叠手机也因调整显示图像101的view的宽和高的操作无法生效,导致显示图像101的view如图7中(b)所示,还是横屏显示,且由于菜单显示区域102的影响,显示图像101的view在图像显示区域103外部的区域,即处于虚线右侧的区域不能正常显示。折叠手机显示图7中(c)所示,显示图像101的view在图像显示区域103的部分区域,且图像101不是居中显示。可理解,图7中(b)不是折叠手机的异形屏显示的界面图,仅用于说明显示图像101的view和图像显示区域103的关系。
为了解决用户调整电子设备的握持方式,异形屏自动旋转窗口过程中,电子设备缩放图像的view导致无法响应用户的滑动操作,以及窗口旋转后,异形屏显示的界面出现图像不居中且不正向显示的问题,本申请实施例提供了一种显示方案。
本申请实施例提供的显示方案,可以适用于图1展示的折叠手机,也可以适用于其他类型的电子设备,如具有异形屏的平板电脑,平板电脑,个人数字助理(personal digital assistant,PDA),桌面型、膝上型、笔记本电脑,超级移动个人计算机(ultra-mobile personal computer,UMPC),手持计算机,上网本以及可穿戴设备等。本申请对电子设备的类型不做具体限制。电子设备也不限制于折叠形态的设备,也可以是直板设备。
以手机为例,图8为本申请实施例提供的一种电子设备的组成示例。如图8所示,电子设备可以包括处理器110、内部存储器120、显示屏130、音频模块140以及传感器模块150等。
可以理解的是,本实施例示意的结构并不构成对电子设备的具体限定。电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,智能传感集线器(sensor hub)和/或神经网络处理器(neural-network processing unit,NPU)等。处理器110中还可以设置存储器,用于存储指令和数据。
内部存储器120可以用于存储计算机可执行程序代码,可执行程序代码包括指令。
一些实施例中,内部存储器120存储的是用于显示方案的指令。处理器110可以通过执行存储在内部存储器120中的指令,实现电子设备的异形屏显示图像的场景中,电子设备跟随用户调整设备握持方式的操作进行窗口旋转,在窗口旋转过程中由异形屏显示旋转动效,还可以保证动效结束之后异形屏显示的界面中,图像位于图像显示区域的居中位置且朝正向显示。
电子设备通过GPU,显示屏130,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏130和应用处理器。GPU通过执行数学和几何计算,用于图像渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏130用于显示图像,视频界面等。在一些实施例中,电子设备可以包括1个或N个显示屏130,N为大于1的正整数。在一些实施例中,电子设备包括的1个显示屏为图1展示的异形屏。
电子设备可以通过音频模块140,扬声器140A,受话器140B,麦克风140C,耳机接口140D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
传感器模块150中,压力传感器150A用于感受压力信号,可以将压力信号转换成电信号。电子设备根据电容的变化确定压力的强度。当有触摸操作作用于显示屏130,电子设备根据压力传感器150A检测触摸操作强度。电子设备也可以根据压力传感器150A的检测信号计算触摸的位置。触摸传感器150B,也称“触控器件”。触摸传感器150B可以设置于显示屏130,由触摸传感器150B与显示屏130组成触摸屏,也称“触控屏”。触摸传感器150B用于检测作用于其上或附近的触摸操作。
加速度传感器150C可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向,还可以用于识别电子设备姿态。陀螺仪传感器150D可以用于确定电子设备的运动姿态。
电子设备在图8展示的硬件部件之上,还运行有操作系统。例如操作系统,操作系统,操作系统等。在操作系统上可以安装运行图库等应用程序。
图9为本申请实施例提供的电子设备的软件结构示意图。
分层架构将电子设备的操作系统分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,电子设备的操作系统为Android系统。Android系统可以分为四层,从上至下分别为应用程序(application,APP)层、应用程序框架层(简称为FWK)、系统库以及内核层。
应用程序层可以包括一系列应用程序包。如图9所示,应用程序包可以包括图库等应用程序。
在一些实施例中,图库应用包括:activity组件,presenter组件以及View组件等,其中,activity组件,presenter组件以及View组件的功能如下述图12和图13对应的实施例内容,此处不展开说明。
另一些实施例中,图库应用还包括:VideoTouchView组件,handler组件和SurfaceView组件,VideoTouchView组件,handler组件和SurfaceView组件的功能如下述图17和图18对应的实施例内容,此处不展开说明。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。如图9所示,应用程序框架层可以包括窗口管理器(WindowManager),doFream组件,Transaction(事务)组件和视图系统等。
窗口管理器用于管理窗口程序。窗口管理器可以实现窗口的添加、删除、显示和隐藏控制等。doFream组件用于在屏幕刷新时刻,绘制屏幕显示内容。Transaction组件用于控制SurfaceView组件运行以绘制视频的图像。视图系统包括可视组件,例如显示文字的组件,显示图片的组件等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。应用程序层和应用程序框架层运行在虚拟机中。
系统库可以包括多个功能模块。例如:表面管理器(surface manager)、媒体库(Media Libraries)、二维图形引擎、三维图形处理库(例如:OpenGL ES)等。表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。三维图形处理库用于实现三维图形绘图,图像渲染、合成和图层处理等。二维图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动以及传感器驱动等。
需要说明的是,本申请实施例虽然以系统为例进行说明,但是其基本原理同样适用于基于等操作系统的电子设备。
以下先结合图10A,图10B和图11,对本申请实施例提供的显示方法的实现原理进行介绍。
首先需要说明的是,本申请实施例以折叠手机基于用户竖向握持设备调整成横向握持的操作,通过旋转动效实现由竖屏显示图像切换为横屏显示图像为例进行说明,但这并不构成对显示方法的应用场景的限制。
如图10A中(a)所示,折叠手机的异形屏以竖向0°的姿态显示界面105(可称呼为第一界面),界面105包括图像101a,收藏、返回和删除三种控件,图像101a位于图像显示区域103(可称为第一区域),收藏、返回和删除三种控件位于菜单显示区域102(可称为第二区域),菜单显示区域102还设置有挖孔区域,用于安装摄像头。
图10A中(a)中,相对于同一参照物,例如用户,图像101a沿向上方向(可称为第一方向)显示,且通常位于图像显示区域103的居中位置;图像101a的view和图像101a的尺寸相同。下文中,均以用户为参照物来说明图像的显示方向。
用户控制折叠手机逆时针旋转90°(可称为第一旋转方向),折叠手机响应该操作,以横向90°的姿态显示界面106,界面106可以理解成由图10A中(a)显示的界面105经逆时针旋转90°之后的界面。界面106包括图像101b,收藏、返回和删除三种控件,图像101b位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图10A中(b)中,相对于用户,图像101b沿向左方向(可称为第二方向)显示,且通常位于图像显示区域103的居中位置;图像101b的view和图像101b的尺寸也相同。其中,图10A中(b)所示的界面106用于提供旋转动效的起始界面的界面内容。
之后,折叠手机获取图10A中(b)展示的界面106的快照,得到图10A中(e)所示的界面快照107,界面快照107的界面内容与图10A中(b)展示的界面106相同,此处不再对其进行介绍。
然后如图10A中(c)所示折叠手机可以显示界面快照107,并且,折叠手机还基于图10A中(e)所示的界面快照107,得到窗口动效。折叠手机基于该窗口动效,显示界面快照107由透明度由1逐渐过渡为0,示例性的,过渡时长可为100ms。当然,1和0为示例性的数值,界面快照107的透明度为1,则指示界面快照107完全不透明,界面快照107的透明度为0,则指示界面快照107完全透明。在折叠手机显示基于界面快照107得到的窗口动效的过程中,折叠手机后台绘制图10A中(f)所示的界面108,界面108包括图像101c,收藏、返回和删除三种控件。图10A中(f)中,虚线框圈出的图像101c沿向上方向显示(以用户为参照物),且通常位于图像显示区域的居中位置,显示角度可以理解为0°。图10A中(f)所示的界面108作为旋转动效的结束界面。
图10A中(f)图中,虚线框是为了指示图像101c,折叠手机实际并不绘制虚线框。并且,折叠手机绘制界面108中的收藏、返回和删除三种控件,并不是本实施例介绍的重点,因此不展开说明。可理解:折叠手机可设置菜单显示区域102显示的三种菜单控件的角度为0°。
需要说明的是,图10A中(f)所示的界面108与图2中(b)展示的界面为同一界面,出于在界面108清楚展示图像101c的view的目的,界面108中以白色绘示图像101c的view。
如前述内容,图10A中(b)所示的界面106用于提供旋转动效的起始界面的界面内容,基于此,在折叠手机显示基于界面快照107得到的窗口动效的过程中,折叠手机可基于图10A中(b)所示的界面106的界面内容,后台绘制图10A中(g)所示的界面109,即旋转动效的起始界面,界面109包括图像101d,收藏、返回和删除三种控件。图10A中(g)中,以用户为参照物,图像101d沿向左方向显示,显示角度可以理解为-90°。折叠手机还可设置菜单显示区域102显示的三种菜单控件的角度为-90°。并且,折叠手机绘制界面108中的收藏、返回和删除三种控件,也不展开介绍。
需要说明的是,折叠手机后台绘制图10A中(g)所示的界面109包括:后台绘制图10A中(g)所示的界面109显示的图像101d,和后台绘制图10A中(g)所示的界面109显示的菜单控件。其中,后台绘制图10A中(g)所示的界面109显示的图像101d,可以理解成,基于图10A中(b)所示的界面106中的图像101b的显示位置,在view上绘制图像101d,view不发生变化。可理解,后台绘制属于对用户不可见的绘制操作。
折叠手机后台绘制图10A中(g)所示的界面109完成之后,通过异形屏显示该界面。并且,在图10A中(c)展示的快照107的透明度变化为0时,异形屏可显示界面109。如图10A中(d)所示,折叠手机显示界面109,界面109包括图像101d,收藏、返回和删除三种控件,图像101d位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。以用户为参照物,图像101d沿向左方向显示,且通常位于图像显示区域103的居中位置;图像101d的view和图像显示区域103的尺寸相同。
需要说明的是,快照107的透明度为0之后,折叠手机可丢弃该快照107。
需要说明的是,折叠手机后台绘制图10A中(g)所示的界面109之后,折叠手机如图10中(c)展示的快照107的透明度也可能没有变化为0。并且,折叠手机后台绘制图10A中(g)所示的界面109之后,还可继续后台绘制图10A中(g)展示的界面109过渡到图10A中(f)展示的界面108的界面。在一些情况下,折叠手机如图10中(c)展示的快照107的透明度变化到0时,折叠手机后台绘制的图10A中(g)展示的界面109过渡到图10A中(f)展示的界面108中的某一界面,可通过异形屏显示。
当然,该界面中,以用户为参照物,图像的显示方向为图10A中(g)展示的界面109中的图像的向左方向和图10A中(f)展示的界面108中图像的向上方向之间的一个方向,且通常图像位于图像显示区域103的居中位置。
再之后,结合图10B,介绍折叠手机则绘制并显示图10A中(d)所示的起始界面过渡到图10B中(j)所示的结束界面的旋转动效。
如前述内容,图10A中(f)展示了旋转动效的结束界面108,图10B中(j)可理解成展示出:折叠手机再绘制一次结束界面108,并在结束界面108绘制完成之后通过显示屏显示的界面。如图10B中(j)所示,界面108包括图像101c,收藏、返回和删除三种控件,图像101c位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图像101c的view和图像显示区域103的尺寸相同。
需要说明的是,图10B示例性的展示了图10A中(d)所示的起始界面过渡到图10B中(k)所示的结束界面的旋转动效中的两个界面,但这并不构成对旋转动效展示界面的限制。
如图10B中(h)所示,折叠手机的异形屏显示界面110,界面110包括图像101e,收藏、返回和删除三种控件,图像101e位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图10B中(h)中,以用户为参照物,图像101e沿向第一左上方向显示,第一左上方向可以理解成是向左方向过渡到向上方向过程中的一个方向;图像101e的view和图像显示区域103的尺寸相同。
如图10B中(i)所示,折叠手机的异形屏显示界面111,界面111包括图像101f,收藏、返回和删除三种控件,图像101f位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图10B中(i)中,以用户为参照物,图像101f沿向第二左上方向显示,第二左上方向可以理解成是向左方向过渡到向上方向过程中的另一个方向,且第二左上方向更靠近于向上方向;图像101f的view和图像显示区域103的尺寸相同。第一左上方向和第二左上方向可以理解成第三方向。
需要说明的是,折叠手机绘制图10A中(d)所示的起始界面过渡到图10B中(j)所示的结束界面过程中的多个界面,均包括:绘制界面显示的图像和菜单控件,其中,绘制界面显示的图像可以理解成,基于计算出的图像的显示位置,在view上绘制图像,view不发生变化。绘制菜单控件可以理解成控制菜单控件由-90°旋转为0°,与图像的旋转方向相同。
还需要说明的是,折叠手机后台绘制图10A中(f)所示的界面108,且其异形屏显示基于图10A中(c)所示的界面快照107得到的窗口动效的目的是:为了避免异形屏显示图10A中(b)后直接显示图10A中(f),导致出现闪屏问题。
并且,折叠手机基于窗口动效展示图10A中(c)所示的界面快照107的过程中,界面快照107的透明度趋近于0时,折叠手机绘制的图10A中(d)所示的起始界面过渡到图10B中(j)所示的结束界面过程中的多个界面,则逐渐对用户可见。
上述内容中,图像101a,图像101b,图像101c,图像101d,图像101e和图像101f,可以理解成其包括的图像内容相同。
界面109,界面110,界面111和界面108,可以理解成是同一个界面,只是界面的内容发生了变化,可称为第二界面。
以下结合图11,对图10A中(d)所示的起始界面过渡到图10B中(j)所示的结束界面的图像显示区域的旋转动效,进行介绍。
与图6中(f)相同的是,图11中(f)也示例性的展示了折叠手机的异形屏以竖向0°的姿态显示图像101a时,图像101a的尺寸和图像101a的view104的尺寸相同。同样出于绘图方便的考虑,图11中(a)中,将尺寸相同的图像101a和view104绘制成一层来示意显示有图像101a的view104,但这也并不构成对图像101a和view104的含义的限制。
折叠手机竖向0°显示图像,view104如图11中(a)所示,角度为0°。
用户控制折叠手机由竖向0°逆时针旋转90°,折叠手机响应该操作,维持view104不变,角度还为0°。因折叠手机由竖向0°逆时针旋转90°,因此,view104如图11中(b)所示逆时针旋转了90°。并且,折叠手机还会记录图像101d在图11中(b)所示的view104中的显示角度,缩放比和偏移量。可知:图像101d在图11中(b)所示的view104中的显示角度,缩放比和偏移量,可用于指示图像101d在图11中(b)所示的view104的显示位置。其中,显示位置可包括显示区域和显示方向。
需要说明的是,折叠手机响应于屏幕由竖向0°逆时针旋转90°,view104如图11中(b)所示逆时针旋转了90°可以理解成:折叠手机绘制横屏显示的view104,且通常设置角度是0°。
之后,折叠手机在后台绘制图11中(c)所示的view104,以及view104显示的图像101c。(c)图中,图像101c由虚线框圈出,由于view104并不发生变化,因此view104的角度还为0°。
并且,折叠手机响应于屏幕由竖向0°逆时针旋转90°,通常仅设置一次view104,当然是基于图像显示区域的尺寸来设置,具体可参见下述步骤S918的内容。在折叠手机计算图像由图11中(b)所示的显示位置,过渡到图11中(c)所示的显示位置的过程中的多个显示位置时,view104不会被重新设置,如此可以保证view104的尺寸可以维持与图像显示区域相同,能够撑满图像显示区域,进而导致用户对图像显示区域执行左滑、右滑操作以切换图像时,折叠手机可以响应该操作。
如图6中(c)所示,view104顺时针旋转90°的同时逐渐缩小尺寸,因此,折叠手机会多次设置view104的尺寸,且尺寸发生变化,角度也发生变化,如此则导致view104与图像显示区域不相同,不能够撑满图像显示区域,无法响应用户对图像显示区域执行左滑、右滑操作。还由于view104的尺寸缩放之后,设置view104的尺寸实质并不能生效,进而导致重新设置缩放后的view104的尺寸,以使其与图像显示区域相同的操作,也是无效操作。
当然,折叠手机还记录图像101c在图11中(c)所示的view104中的显示角度,缩放比和偏移量。也可知:图像101c在图11中(c)所示的view104中的显示角度,缩放比和偏移量,也可用于指示图像101c在图11中(c)所示的view104的显示位置。
再之后,折叠手机计算出图像由图11中(b)所示的显示位置,过渡到图11中(c)所示的显示位置的过程中的多个显示位置,当然,每个显示位置也是通过折叠手机计算出的图像在view104中的显示角度,缩放比和偏移量来指示。
示例性的,图11中(d)和(e)展示了在上述过渡过程中,图像在view104的两种显示位置,view104因不发生变化,角度均还为0°。其中,图11中(d)中的图像101e的显示位置可参见图10B中(h)的内容,图11中(e)中的图像101f的显示位置可参见图10B中(i)的内容,此处不再展开介绍。
折叠手机基于每一次计算得到的图像在view104中的显示角度,缩放比和偏移量,在view104绘制图像,则完成了折叠手机显示图10A中(d)所示的起始界面过渡到图10B中(j)所示的结束界面的图像显示区域的旋转动效。
以下结合电子设备的软件结构中的模块,对本申请实施例提供的显示方法进行介绍。同样,在下述介绍的显示方法的应用场景也是:折叠手机的图库应用显示图像,折叠手机基于用户竖向握持设备调整成横向握持设备的操作,通过旋转动效实现由竖屏显示图像切换为横屏显示图像,但这也并不构成对显示方法的应用场景的限制,也并不构成对显示方法的执行方的限制。
如图12所示,本申请实施例提供的显示方法,包括:
S901、折叠手机处于竖向0°姿态,用户在异形屏上输入浏览图像101操作。
其中,图像101指代图10A中(a)展示的图像浏览界面展示的图像101a。示例性的,图像101的尺寸为1418×2520。
折叠手机处于竖向0°姿态,且处于折叠态。折叠手机的异形屏被使能进行屏显。
在一些实施例中,用户输入操作启动相机运行,异形屏显示相机预览界面。用户在相机预览界面输入操作以拍摄图像101,该图像101保存于图库应用。用户通过操作相机浏览界面上链接图库应用的组件,以输入浏览图像101的操作。
在另一些实施例中,用户输入操作启动图库应用,异形屏显示图库应用的界面,该界面显示有图像101的缩略图。用户在图库应用的界面选中图像101,以输入浏览图像101的操作。
本实施例中以用户通过操作相机浏览界面上链接图库应用的组件,以输入浏览图像101的操作为例进行介绍。
S902、窗口管理器检测到用户输入的浏览图像101的操作,设置display角度0°。
折叠手机处于竖向0°姿态,用户输入浏览图像101操作,窗口管理器可基于触摸传感器等监测用户输入的浏览图像101操作,窗口管理器设置display角度0°,即窗口的显示角度为0°。
在一些实施例中,异形屏被使能进行屏显,即被控制作为显示内容的屏幕,窗口管理器可记录折叠手机显示方式的参数的数值,该参数的数值用于指示进行屏显的屏幕。
在另一些实施例中,窗口管理器也可基于加速度传感器,陀螺仪传感器等部件,确定折叠手机的姿态,以根据确定的姿态,设定窗口的显示角度。如步骤S901所述,折叠手机处于竖向0°姿态,窗口管理器通过加速度传感器,陀螺仪传感器等确定其处于竖向0°姿态,设置窗口的显示角度为0°。
S903、窗口管理器启动图库运行。
窗口管理器监测到用户输入的浏览图像101的操作之后,因图像101保存于图库,且需要利用图库应用进行显示,因此,窗口管理器还可启动图库运行。
需要说明的是,在用户在图库应用的界面输入浏览图像101的操作的场景中,图库应用已处于启动状态,本步骤则可不执行。
S904、activity组件控制窗口管理器设置窗口动效。
图库被启动运行,图库的activity(活动)组件,会向窗口管理器设置窗口动效的类型,例如,该窗口动效为淡入淡出动效类型,窗口管理器基于窗口动效的类型,配置该类型的窗口动效的参数。
S905、presenter组件向窗口管理器获取显示角度lastDegree=0°。
S906、presenter组件记录显示角度lastDegree=0°。
图库应用启动运行,图库应用的presenter(主持人)组件初始化,初始化完成之后,则向窗口管理器获取窗口的显示角度,并记录窗口的显示角度。如步骤S902所述,窗口管理器设置的窗口的显示角度为0°,基于此,presenter组件记录的显示角度则为lastDegree=0°。
S907、View组件设置view的尺寸。
用户通过步骤S901输入浏览图像101的操作,折叠手机则需要在异形屏上显示图像101,即显示图像101的浏览界面。为实现在异形屏上显示图像101的浏览界面,图库应用的View组件需要创建图像101的浏览界面的view。如图10A中(a)所示,异形屏显示的图像101的浏览界面中的菜单显示区域101用于显示菜单,图像显示区域102用于显示图像101。也就是说:图像101的浏览界面的view可以理解成是父布局的view,其包括显示菜单区域的子view和显示图像101的区域的子view。
创建图像101的浏览界面的view包括设置图像101的浏览界面的view的尺寸,即设置父布局的view的尺寸。View组件包括父布局viewpager(即父布局的布局管理器),其可根据异形屏的尺寸,例如宽x高为1080x1200,设置父布局的view的尺寸。示例性的,父布局的view的尺寸是:宽x高为1092x1200。
显示图像101的区域的子view的高与父布局的view的高相同,显示图像101的区域的子view的宽小于父布局的view的宽。父布局viewpager还可设置显示图像101的区域的子view的左侧边,与父布局的view的左侧边的差,即显示图像101的区域的子view和父布局的view的宽度差。View组件基于父布局viewpager设置的左侧边距的差值,则设置显示图像101的区域的子view的尺寸。示例性的,父布局viewpage设置左侧边距的差值为417,显示图像101的区域的子view的尺寸则是:宽x高为675x1200。
当然,显示菜单区域的子view也需要创建,但因其不是本申请实施例介绍的重点,因此不展开说明。
图库应用还包括browser组件,用于管控view和数据,实现响应于用户在图库应用的界面输入左滑或右滑操作以切换异形屏显示的图像。
S908、View组件计算并记录图像101的缩放比和偏移量,记录图像101的显示角度0°。
图像101的宽和高与显示图像101的区域的子view的宽和高可能并不适配,基于此,需要调整图像101。在一些实施例中,View组件的onDraw(绘画)组件计算图像101的缩放比和偏移量,onDraw组件可用缩放比调整图像101的尺寸,用偏移量调整图像101在显示图像101的子view的显示位置。
在一些实施例中,图像的缩放比的计算方式包括:
基于公式1计算显示图像101的区域的子view和图像101的宽比率widthRatio;
公式1
widthRatio=viewWidth/imageWidth
公式1中,viewWidth指代显示图像101的区域的子view的宽,imageWidth指代图像101的宽。
基于公式2计算显示图像101的区域的子view和图像101的高比率heightRatio;
公式2
heightRatio=viewHeight/imageHeight
公式2中,viewHeight指代显示图像101的区域的子view的高,imageHeight指代图像101的高。
基于公式3,得到图像101的缩放比currentScale,即选择宽比率和高比率中的较小值。
公式3
currentScale=Math.min(widthRatio,heightRatio)
可理解的是,以显示图像101的区域的子view的高宽比为16:9为例,图像的缩放比的计算规则是:
1、图像的高宽比是16:9,图像的缩放比满足图像缩放后的尺寸与view的尺寸相同,如图2中(a)和(c)所示;
2、图像的高宽比大于16:9,图像的缩放比满足图像显示的高撑满view的高,如图3所示;
3、图像的高宽比小于16:9,图像的缩放比满足图像显示的宽撑满view的宽,如图4所示。
在一些应用场景中,图像被缩放之后,与显示图像101的区域的子view也不完全适配。被缩放之后的图像的高与显示图像101的区域的子view的高相同,但两者宽不相同,或者,被缩放之后的图像的高与显示图像101的区域的子view的宽相同,但两者的高不同,为了让图像能够在显示图像101的区域的子view是居中显示,则需要计算图像的偏移量。
在一些实施例中,图像的偏移量translate(x,y)的计算方式包括:基于公式4,分别计算出图像在x轴和y轴的偏移量。
公式4
x=(viewWidht-imageWidth×currentScale)/2
y=(viewHeight-imageHeight×currentScale)/2
由步骤S905可知:presenter组件记录的显示角度则为lastDegree=0°,如此,View组件记录的图像101的显示角度也是0°。即:View组件基于presenter组件记录的显示角度,进行图像101的显示角度。
在上述示例中,图像101的尺寸是:宽×高为1418×2520;显示图像101的区域的view尺寸是:宽×高为675×1200。图像101的缩放比:currentScale=0.47619048(存在误差),偏移量:translate=(0,0)。
S909、View组件判断不存在动效时,基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置。该子view指代显示图像101的区域的子view。
因折叠手机目前处于显示图像101的浏览界面的阶段,折叠手机没有发生旋转,View组件则会判断出不存在动效。在一些实施例中,View组件可以基于动效的参数是否为空,来判断是否存在动效,当然,该参数为空,则不存在动效,反之则存在动效。
本实施例中提及的动效可称呼旋转动效,指代用户旋转折叠手机,折叠手机显示图10A中(d)展示的界面109过渡为图10B中(j)展示的界面108的动效。
在一些实施例中,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置的方式,包括:
1、基于公式5,计算图像101在子view的显示位置的中心点;
公式5
resultTranslate.x=(currentScale×imageWidth/2)
resultTranslate.Y=(currentScale×imageHeight/2)
2、基于图像101的偏移量,将图像101在子view的显示位置的中心点进行偏移,即canvas.translate(resultTranslate.x,resultTranslate.Y);
3、基于图像101的显示角度,旋转画布canvas.rotate(curentRotation),该画布则指代图像101在子view的显示位置。
执行步骤S909动作的组件可以是View组件中的onDraw组件。
需要说明的是,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置,是确定图像101在子view的显示位置的一种实现方式,可知,View组件也可基于其他参数,确定图像101在子view的显示位置。
S910、doFream组件绘制并通过显示屏显示图10A中(a)所示的界面。
doFream(绘制刷新)组件绘制图像101的浏览界面的view,以及在图像101的view的图像显示区域,基于缩放比和偏移量绘制图像101,绘制完成进行屏显之后,异形屏则可显示图10A中(a)所示的界面。
需要说明的是,步骤S902至步骤S910可以理解为:折叠手机响应于用户输入的浏览图像101的操作,初始化图像101的浏览界面的view,以及绘制且显示图像101的浏览界面的view的初始状态。
S911、用户输入逆时针旋转屏幕90°的操作。
用户调整折叠手机的握持方式,控制折叠手机逆时针旋转90°,对应的,异形屏由竖屏显示切换为横屏显示。
需要说明的是,异形屏由竖屏显示图像101切换为横屏显示图像101之后,应先呈现图10A中(b)所示的界面,再之后,异形屏再显示图10A中(d)过渡为图10B中(j)的动效。下述步骤S912至步骤S921是异形屏由竖屏显示图像101切换为横屏显示图像101之后呈现图10A中(b)所示的界面,以及后台绘制图10A中(f)的实现方案;步骤S922至步骤S927是异形屏显示图10A中(d)过渡为图10B中(j)的动效的实现方案。
S912、窗口管理器检测到用户输入的逆时针旋转屏幕90°的操作,设置display角度90°。
窗口管理器可基于加速度传感器,陀螺仪传感器等部件,确定折叠手机被逆时针旋转为90度,基于此,窗口管理器设置窗口的显示角度为90°。
需要说明的是,用户逆时针旋转屏幕但并未旋转到90°又顺指针转回,在该场景下,窗口管理器并不会记录窗口的显示角度为90°。
窗口管理器设置窗口的显示角度为90°之外,还会触发图库应用执行系统回调onConfigChange以执行下述步骤S914,步骤S915至步骤S917,步骤S918以及步骤S920。
还需要说明的是,窗口管理器触发图库应用执行系统回调onConfigChange之前,还可判断折叠手机具有异形屏且异形屏被使能运行。在一些实施例中,窗口管理器可基于折叠手机的配置参数确定折叠手机是否具有异形屏,还基于记录折叠手机显示方式的参数的数值,来确定异形屏是否被使能运行。
本申请实施例是以用户逆时针旋转屏幕90°为例进行介绍,但这并不构成对本案中设置窗口显示角度的限制。可知的,用户逆时针旋转屏幕180°,窗口管理器设置窗口的显示角度为180°。
S913、窗口管理器获取显示屏显示的界面的快照,通过显示屏显示图10A中(c)所示界面。
用户控制屏幕逆时针旋转90°之后,异形屏显示图10A中(a)的界面,跟随旋转后显示为图10A中(b)。窗口管理器对图10A中(b)展示的界面进行截图,得到界面快照,再显示该界面快照,其中,窗口管理器可通过下述步骤S916以窗口动效的形式显示界面快照。
在另一些实施例中,窗口管理器也可以在屏幕逆时针旋转90°的过程中,对异形屏显示的界面进行截图,得到界面快照。
在一些实施例中,窗口管理器通过显示屏显示界面的快照,可以理解成:窗口管理器创建另一视图view,该视图尺寸与图像显示区域相同,用于绘制界面的快照。
S914、presenter组件向窗口管理器获取显示角度curentRotation=90°。
S915、presenter组件记录显示角度curentRotation=90°。
presenter组件执行系统回调onConfigChange,向窗口管理器获取并记录窗口的显示角度curentRotation=90°。
S916、窗口管理器启动窗口动效100ms。
如步骤S904所述,窗口管理器配置有动效的参数,窗口管理器设置窗口的显示角度为90°之后,则启动该参数对应的窗口动效,以动效参数对应的窗口动效展示该界面快照。示例性的,启动的窗口动效的时长为100ms,100ms可称为第二时长。
窗口动效可以为淡入淡出类型,控制界面快照的透明度由1逐渐过渡为0,实现界面快照慢慢由不透明过渡到透明。当然,1和0为示例性数值。
界面快照的透明度变化为0时,窗口管理器可丢弃该界面快照。
需要说明的是,用户逆时针旋转屏幕90°之后,异形屏显示窗口动效。在窗口动效的显示过程中,折叠手机执行下述步骤S917至S921,是在后台绘制窗口并不将绘制的窗口显示在异形屏。如此,可以保证用户旋转屏幕90°,异形屏直接显示下述步骤S917至S921绘制的图10A中(f)所示界面,导致出现闪屏的问题。
步骤S913,步骤S914和步骤S916的执行顺序并不限制于图12展示的顺序。
S917、presenter组件计算动效起始角度-90°,记录起始缩放比和起始偏移量。
用户逆时针旋转屏幕90°之后,异形屏显示的界面跟随屏幕旋转90°。presenter需要计算动效起始时刻的窗口显示角度,称呼为动效起始角度,还需要记录图像101的起始缩放比和起始偏移量。因异形屏显示的界面跟随屏幕发生旋转,但界面并没有进行重新绘制,因此,异形屏显示的界面中的图像101的起始缩放比和起始偏移量,应与屏幕旋转前的图像101的缩放比和偏移量相同。
在一些实施例中,presenter组件计算动效起始角度的方式为:获取屏幕旋转前的显示角度lastRotation和旋转后的显示角度curentRotation;利用下述规则得到动效起始角度。
从270°转到0°的场景,即旋转前的显示角度为270°,旋转后的显示角度为0度°时,动效起始角度animRotation=-90;
从0°转到270°的场景,即旋转前的显示角度为0°,旋转后的显示角度为270°时,动效起始角度animRotation=90;
其他场景:动效起始角度animRotation=lastRotation–currentRotation。
其中,动效起始角度还可以指示旋转方向,负值标识逆时针旋转,正值为顺时针旋转。
屏幕是被用户由竖向0°显示调整为横向90°显示,因此,动效中图像101的初始缩放比和偏移量应为屏幕旋转前,图像101进行显示时的缩放比和偏移量。基于此,presenter组件记录的图形101的起始缩放比和起始偏移量为:图像101被竖屏显示时的缩放比和偏移量。
在上述示例中,presenter组件计算出的图像101的起始角度为:-90°,图像101的起始缩放比:0.47619048,起始偏移量:(0,0)。
需要说明的是,presenter组件计算动效起始角度,以及记录起始缩放比和起始偏移量之后,还可向handler(组织者)发送延迟50ms的消息。50ms仅为示例,可称为第一时长。其中,presenter组件向handler发送延迟50ms的消息的目的是:等待View组件利用延迟时长完成动效结束时的图像101的浏览界面的view。
还需要说明的是,presenter组件计算动效起始角度,以及记录起始缩放比和起始偏移量之后,还可触发view的重绘。在一些实施例中,presenter组件触发图像101的view重绘的方式是:对图像101的浏览界面的view设置标志invalidate。如此,doFream组件判断达到屏幕刷新时刻时,基于标志invalidate,对图像101的浏览界面的view进行绘制。
重绘的图像101的浏览界面的view的尺寸,以及图像101显示于子view时的缩放比和偏移量,以及图像101的显示角度,由下述步骤S918和步骤S919得到。可知的,View组件可在前述提出的延迟时长内,执行下述步骤S918和步骤S919。
S918、View组件设置view的尺寸。
异形屏由竖屏显示切换为横屏显示,异形屏显示图像101的窗口为横向窗口,因此,View组件需要重新设置图像101的浏览界面的view的尺寸,即设置横屏显示图像101的窗口的尺寸。在一些实施例中,父布局viewpager设置横向窗口的尺寸。示例性的,图像101的浏览界面的view(即父布局的view)的尺寸是:宽x高为1200x1092。
将图像101横屏显示时,显示图像101的区域的子view的宽与父布局的view的宽相同,显示图像101的区域的子view的高小于父布局的view的高。父布局viewpager还可设置显示图像101的区域的子view的底边,与父布局的view的底边的差,即显示图像101的区域的子view和父布局的view的高度差。View组件基于父布局viewpager设置的底边的差值,则设置显示图像101的区域的子view的尺寸。示例性的,父布局viewpage设置底边的差值为417,显示图像101的区域的view的尺寸则是:宽x高为1200x675。
S919、View组件计算并记录图像101的缩放比和偏移量,记录图像101的显示角度0°。
用户逆时针旋转屏幕90°,异形屏由竖屏显示切换为横屏显示。异形屏采用横屏显示方式显示图像101,即显示图像101的窗口为横向窗口。View组件需要计算横向窗口显示图像101时,图像101的缩放比和偏移量。并且,异形屏以横屏显示方式显示图像101,图像101还是正向显示,View组件则记录图像101的显示角度为0°。
在一些实施例中,presenter组件采用公式1至公式3,计算出异形屏以横屏显示方式显示图像101时,图像101的缩放比,以及利用公式4计算出图像101的偏移量。
在上述示例中,图像101的缩放比:currentScale=0.26785713,偏移量:translate=(410.0893,0.0)。显示角度:curentRotation=0°
S920、View组件判断不存在动效时,基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置。该子view指代显示图像101的区域的子view。
步骤S920中提及的动效也可称呼为旋转动效,指代用户旋转折叠手机,折叠手机显示图10A中(d)展示的界面109过渡为图10B中(j)展示的界面108的动效。
因动效还没有被设置,因此,View组件判断出不存在动效。并且,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置。其中,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在view的显示位置的方式,可如前述步骤S909的内容,此处不再赘述。
执行步骤S920动作的组件可以是View组件中的onDraw组件。
需要说明的是,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在子view的显示位置,是确定图像101在子view的显示位置的一种实现方式,可知,View组件也可基于其他参数,确定图像101在子view的显示位置。
S921、doFream组件后台绘制图10A中(f)所示界面。
doFream组件绘制横屏显示图像的view,以及在横屏显示图像的view的图像显示区域,基于图像101的缩放比和偏移量绘制图像101,但并不进行屏显,异形屏还在持续显示窗口管理器启动的窗口动效。
可理解:doFream组件后台绘制的图10A中(f)所示界面对用户不可见的缘由是:横屏显示图像的view和步骤S913创建的用于绘制快照的view,是叠加之后向显示屏送显,且沿垂直于屏幕的方向(即Z轴)进行叠加,用于绘制快照的view的Z轴的值大于横屏显示图像的view的Z轴的值。又因为用于绘制快照的view不透明,遮挡了doFream组件后台绘制的图10A中(f)所示界面,用户则不会看到图10A中(f)所示界面。
S922、presenter组件在延迟50ms后,记录动效结束角度0°,结束缩放比和结束偏移量,设置动效。
handler组件延迟50ms之后,接收到presenter组件发送的消息。handler组件接收到消息之后,控制presenter组件记录动效结束角度以及动效中图像101的结束缩放比和结束偏移量。屏幕是竖屏显示被切换为横屏显示,异形屏显示的图像101要由图10A中(d)过渡为图10B中(j),图10B中(j)展示的图像101c呈现竖向0°的显示效果,因此动效结束角度为0°,动效结束角度可以理解成图像101在动效结束时的显示角度。并且,屏幕旋转为横向,图像101c呈横向显示,因此,步骤S919计算得到的横屏显示窗口显示图像101时,图像101的缩放比和偏移量,是动效结束时,图像101的缩放比和偏移量。
在上述示例中,图像101的结束角度:0°,图像101的结束缩放比:0.26785713,图像101的结束偏移量:(410.0893,0.0)。
presenter组件通过步骤S917记录了动效起始角度,动效起始缩放比和偏移量,还通过步骤S922记录了动效结束角度,结束缩放比和结束偏移量,因此,presenter组件可以设置动效。在一些实施例中,presenter组件设置动效的方式包括:设置动效的参数,使其不为空。presenter组件还可记录设置动效的时间,即动效的开始时间。
本步骤提及的动效可以理解成在一定时长内,基于图像101的显示角度,缩放比和偏移量在图像101的view对图像101进行绘制的过程。
S923、View组件判断存在动效时,动效执行时长未达到动效总时长的过程中,计算动效过程中的每一次绘制对应的图像101的显示角度、缩放比和偏移量。
由S922所述,presenter组件设置动效,因此,View组件则判断存在动效。进一步的,View组件需要构建动效。由动效的定义可知:动效包括在一定时长内,基于图像101的显示角度,缩放比和偏移量对图像101进行的多次绘制。构建动效可以理解成是得到在一定时长内的每一次绘制对应的图像101的显示角度,缩放比和偏移量,一定时长则指代动效执行时长。
在一些实施例中,View组件计算动效过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量的方式,如图13所示,包括:
S1001、计算动效已执行时长runingTime。
其中,runingTime=系统当前时间System.currentTimeMillis()-动效开始时间anim.time。动效开始时间如前述步骤S922所述内容,由presenter组件设置动效之后,进行记录。
动效已执行时长应小于或等于动效总时长,示例性的,设定动效总时长:duration=250ms,因此,动效已执行时长runingTime的取值范围为:0~250。
S1002、计算缩放比的总变化量,并基于总变化量,计算一次绘制对应的缩放比。
缩放比的总变化量:change=结束缩放比anim.scaleEnd-起始缩放比anim.scaleStart,起始缩放比和结束缩放比如步骤S917和步骤S922所述,由presenter组件记录。
一次绘制对应的缩放比:scaleCurrent=ease(runingTime,scaleStart,change,duration)=getInterpolation(runingTime/duration)×change+startValue。
getInterpolation(runingTime/duration)指代利用插值器返回的缩放比的变化率;getInterpolation(runingTime/duration)×change指代缩放比的变化率和总变化量的乘积,即本次绘制对应的缩放比应该变化的量,startValue指代起始缩放比,当然,在第二次绘制开始,startValue则指代前一次绘制对应的缩放比。
其中,每一次绘制对应的图像的缩放比均在0.47619048~0.26785713之间。
S1003、计算显示角度的总变化量,并基于总变化量,计算一次绘制对应的显示角度。
显示角度的总变化量:change=结束角度anim.rotateEnd-起始角度anim.rotateStart,起始角度和结束角度如步骤S917和步骤S922所述,由presenter组件记录。
一次绘制对应的显示角度:rotation=ease(runingTime,anim.rotateStart,chang,duration)=getInterpolation(runingTime/duration)×change+startValue。
getInterpolation(runingTime/duration)指代利用插值器返回的显示角度的变化率;getInterpolation(runingTime/duration)×change指代显示角度的变化率和显示角度的总变化量的乘积,即本次绘制对应的显示角度应该变化的量,startValue指代起始角度,在第二次绘制开始,startValue则指代前一次绘制对应的显示角度。
其中,每一次绘制对应的图像的显示角度均在-90~0之间。
S1004、计算偏移量的总变化量,并基于偏移量的总变化量,计算一次绘制对应的偏移量。
偏移量的总变化量:
x轴的偏移量的总变化量changeX=x轴的结束偏移量rotationTransEnd.x-x轴的起始偏移量rotationTransStart.x;
y轴的偏移量的总变化量changeY=y轴的结束偏移量rotationTransEnd.y-y轴的起始偏移量rotationTransStart.y。
一次绘制对应的偏移量:
一次绘制对应的x轴的偏移量ranslateX=ease(scaleElapsed,TanslateStart.x,changeX,duration)=getInterpolation(runingTime/duration)×change+startValue。其中,范围为0~410.0893。
getInterpolation(runingTime/duration)指代利用插值器返回的x轴的偏移量的变化率;getInterpolation(runingTime/duration)×change指代x轴的偏移量的变化率和x轴的偏移量的总变化量的乘积,即本次绘制对应的x轴的偏移量应该变化的量,startValue指代x轴的起始偏移量,在第二次绘制开始,startValue则指代前一次绘制对应的x轴的偏移量。
一次绘制对应的y轴的偏移量ranslateY=ease(scaleElapsed,TanslateStart.y,changeY,duration)=getInterpolation(runingTime/duration)×change+startValue。其中,范围为0~0。
getInterpolation(runingTime/duration)指代利用插值器返回的y轴的偏移量的变化率;getInterpolation(runingTime/duration)×change指代y轴的偏移量的变化率和y轴的偏移量的总变化量的乘积,即本次绘制对应的y轴的偏移量应该变化的量,startValue指代y轴的起始偏移量,在第二次绘制开始,startValue则指代前一次绘制对应的y轴的偏移量。
需要说明的是,步骤S1002至步骤S1004的执行顺序,并不限制于图13所示。
S1005、判断动效已执行时长runingTime>动效总时长duration(250)
其中,判断动效已执行时长大于动效总时长,则说明动效结束,则通过步骤S1006设置动效的标记为空,如此可以控制本次图像绘制执行完毕之后,下一次不再计算动效过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量。
判断动效已执行时长小于或等于动效总时长,则通过步骤S1007设置标记,以触发图像绘制。进一步的,在动效已执行时长大于动效总时长,也需要通过步骤S1007设置标记,以触发图像绘制。
执行图13展示的计算动效过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量的组件可以是View组件中的onDraw组件。
S924、View组件在动效执行时长未达到动效总时长的过程中,基于动效过程中的每一次绘制对应的图像101的显示角度、缩放比和偏移量,确定图像101在view的显示位置。
View组件计算出动效执行过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量,View组件还基于一次绘制对应的图像101的显示角度、缩放比和偏移量,确定图像101在view的显示位置。其中,View组件基于图像101的显示角度、缩放比和偏移量,确定图像101在view的显示位置的方式,可如前述步骤S909的内容,此处不再赘述。
需要说明的是,View组件基于动效过程中的每一次绘制对应的图像101的显示角度、缩放比和偏移量,确定图像101在view的显示位置,是确定图像101在view的显示位置的一种实现方式,可知,View组件也可基于其他参数,确定图像101在view的显示位置。
S925、窗口管理器响应于100ms窗口动效,将快照的透明度由1逐渐变为0。
如前述步骤S916所述,窗口管理器响应于100ms窗口动效,将显示的界面快照的透明度由1逐渐变为0。如此,可保证doFream组件通过步骤S926绘制的界面可以被用户可见。当然,100ms为窗口动效时长的示例。
步骤S925和步骤S926的执行顺序并不限制于图12展示的顺序。
S926、doFream组件依次根据图像的显示位置,绘制图10A中(d)至图10B中(j)所示界面。
S927、在窗口动效的透明度变为0的过程中,doFream组件绘制的图10A中(x)到图10B中(j)逐渐可见,x可以是图10A中(d)或者其之后的一张图。
View组件得到动效过程中的每一次绘制对应的图像101在view的显示位置之后,则也可对图像101对应的view设置标志invalidate,如此,doFream组件判断达到屏幕刷新时刻时,基于标志invalidate,对图像101对应的view进行绘制。
并且,doFream组件执行动效过程中的每一次绘制并进行屏显,异形屏则可显示图10A中(d)至图10B中(j)的动效。
需要说明的是,窗口管理器通过步骤S916启动100ms的窗口动效,窗口动效开始之后的50ms之后,折叠手机通过presenter组件设置动效,且通过View组件计算出动效执行过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量。presenter组件和View组件的动作也会占用一定时长,待doFream组件基于View组件计算出的动效执行过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量进行绘制时,窗口管理器启动的窗口动效大概率已经结束,如此,doFream组件每一次的绘制内容则可通过异形屏进行显示,呈现图10A中(d)至图10B中(j)的动效。
进一步的,即便doFream组件基于View组件计算出的动效执行过程中的一次绘制对应的图像101的显示角度、缩放比和偏移量进行绘制时,窗口管理器启动的窗口动效还未结束,但也进入尾声,doFream组件前几次的绘制内容未能屏显,即图10A中(d)及之后的几帧图像可能对用户不可见,但并不影响用户感受到异形屏是由图10A中(d)的界面过渡到图10B中(j)界面。
本申请实施例中,异形屏显示图像101的场景中,用户控制屏幕由竖向0°切换为横向90°,折叠手机通过View组件执行步骤S918至步骤S920完成横屏显示窗口的绘制,如此得到了横屏显示图像101时的view,也通过View组件执行步骤S923至步骤S924得到竖屏显示窗口向横屏显示窗口的过渡过程中,图像101的显示角度,缩放比和偏移量,折叠手机通过doFream组件在横屏显示图像101时的view上,基于图像101的显示角度,缩放比和偏移量绘制图像101,图像101的view不发生缩放,均是撑满图像显示区域,可以保证响应用户对图像显示区域的左滑、右滑操作。
并且,View组件得到的是竖屏显示窗口向横屏显示窗口的过渡过程中,图像101的显示角度,缩放比和偏移量,doFream组件基于图像101的显示角度,缩放比和偏移量进行绘制的内容,也是呈现出图像101由竖屏显示窗口向横屏显示窗口的过渡效果,保证了横屏显示图像101时,图像101居中且正向显示。
前述内容介绍了本申请实施例提供的显示方法应用于异形屏显示图像的场景的内容。在异形屏播放视频的场景中,同样存在屏幕发生旋转时,异形屏显示的切换动效出现问题。
以下结合图14,以折叠手机由竖向0°显示图像调整成横向90°播放视频为例,对异形屏100的图像显示区域由竖屏显示切换为横屏显示的过程中存在的问题进行介绍,但同样这并不构成对本案的应用场景的限制。
如图14中(a)所示,折叠手机的异形屏以竖向0°的姿态显示视频中的一帧图像201。用户控制折叠手机逆时针旋转90°,折叠手机响应该操作,控制显示图像201的视图(view)如图14中(b)所示,跟随折叠手机逆时针旋转90°,但图像201的view显示的图像不发生旋转。以下结合图15对此进行说明。
首先需要说明的是,图15中(d)示例性的展示了折叠手机的异形屏以竖向0°的姿态显示视频中的一帧图像201时,图像201的尺寸和图像201的view202的尺寸相同。出于绘图方便的目的,图15中的(a)中,将尺寸相同的图像201和图像201的view202绘制成一层来示意显示有图像201的view202(以下简称为view202),但这并不构成对图像201和图像201的view202的含义的限制。
如前述对应图6的内容可知:用户控制折叠手机由竖向0°逆时针旋转90°,折叠手机响应该操作,需要先控制view逆时针旋转90°,即:折叠手机响应由竖向0°逆时针旋转90°的操作,控制由图15中(a)显示的view202沿图15中(b)展示的方式,调整成图15中(c)。
但是,研究发现:view202可沿逆时针进行旋转,视频内容即图像201的尺寸虽可调整,但其无法旋转,会一直保持如图15中(b)所示的正向显示,如此则导致折叠手机无法得到图15中(c)展示的显示有图像的view,当然,也无法继续执行图6中(c)至(d)的过程,完成旋转动效。
为了解决异形屏播放视频的场景中,电子设备出现的横竖屏切换的动效播放失败问题,本申请实施例还提供了另一种显示方法。
本申请实施例提供的显示方法,也可以适用于包括异形屏的电子设备,电子设备的类型可多样化,没有具体限制。电子设备的组成部件如图8所示,软件结构如图9所示,此处不再具体说明。
本申请实施例提供的显示方法的实现原理与图10A和图10B的内容基本相同,此处结合图16A和图16B进行说明。
如图16A中(a)所示,折叠手机的异形屏以竖向0°的姿态显示界面105(可称呼为第一界面),界面105包括视频的一帧图像201a,收藏、返回和删除三种控件,图像201a位于图像显示区域103(可称为第一区域),收藏、返回和删除三种控件位于菜单显示区域102(可称为第二区域),菜单显示区域102还设置有挖孔区域(图中以圆孔表示),用于安装摄像头。图16A中(a)图中,视频可处于播放过程中,以用户为参照物,视频中的图像201a沿向上方向(可称为第一方向)显示,且通常位于图像显示区域103的居中位置;图像201a的view和图像201a的尺寸相同。
一些实施例中,折叠手机接收到作用于收藏控件的操作,可将第一图像添加到图库的收藏相册中;折叠手机接收到作用于返回控件的操作,可显示第一界面的上一级界面;折叠手机接收到作用于删除控件的操作,可删除第一图像。
用户控制折叠手机逆时针旋转90°(可称为第一旋转方向),折叠手机响应该操作,以横向90°的姿态显示界面106,界面106可以理解成由图16A中(a)中显示的界面105经逆时针旋转90°之后的界面。因视频处于播放过程中,因此,用户控制折叠手机旋转90°之后,界面106显示的视频可发生变化,如图16A中(b)所示,界面106包括视频的另一帧图像201b,收藏、返回和删除三种控件,图像201b位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图16A中(b)中,以用户为参照物,图像201b沿向左方向(可称为第二方向)显示,且通常位于图像显示区域103的居中位置;图像201b的view和图像201b的尺寸也相同。其中,图16A中(b)所示的界面106用于提供旋转动效的起始界面的界面内容。
之后,折叠手机获取图16A中(b)展示的界面106的界面快照,得到图16A中(e)所示的界面快照107,界面快照107的界面内容与图16A中(b)展示的界面106相同,此处不再对其进行介绍。
并且,折叠手机还基于图16A中(e)所示的界面快照107,得到窗口动效。如图16A中(c)所示,折叠手机基于该窗口动效,显示界面快照107由透明度由1逐渐过渡为0,示例性的,过渡时长可为100ms。当然,1和0为示例性的数值,界面快照107的透明度为1,则指示界面快照107完全不透明,界面快照107的透明度为0,则指示界面快照107完全透明。界面快照107完全透明,折叠手机可丢弃该界面快照107。
需要说明的是,用户旋转折叠手机的过程中,视频持续处于播放过程中,折叠手机基于界面快照107显示窗口动效,视频的播放会被中断,但因窗口功效的持续时长较短,属于毫秒级别的,中断前的视频内容和中断后的视频内容,基本无差异,用户基本不会感知到视频的播放被中断。
在折叠手机显示基于界面快照107得到的窗口动效的过程中,折叠手机后台绘制图16A中(f)所示的界面108,界面108包括视频的另一帧图像201c,收藏、返回和删除三种控件。图16A中(f)中,以用户为参照物,虚线框圈出的图像201c沿向上方向显示,显示角度可以理解为0°。图16A中(f)所示的界面108作为旋转动效的结束界面。
图16A中(f)中,虚线框是为了指示图像201c,折叠手机实际并不绘制虚线框。并且,折叠手机绘制界面108中的收藏、返回和删除三种控件,并不是本实施例介绍的重点,因此不展开说明。可理解:折叠手机可设置菜单显示区域显示的三种菜单控件的角度为0°。
需要说明的是,图16A中(f)所示的界面108中,出于在界面108清楚展示图像201c的view的目的,界面108中以白色绘示图像201c的view。
如前述内容,图16A中(b)所示的界面106用于提供旋转动效的起始界面的界面内容,基于此,在折叠手机显示基于界面快照107得到的窗口动效的过程中,折叠手机可基于图16A中(b)所示的界面106的界面内容,后台绘制图16A中(g)所示的界面109,即旋转动效的起始界面,界面109包括视频中的另一帧图像201d,收藏、返回和删除三种控件。图16A中(g)中,以用户为参照物,图像201d沿向左方向显示,显示角度可以理解为-90°。折叠手机还可设置菜单显示区域显示的三种菜单控件的角度为-90°。
需要说明的是,折叠手机后台绘制图16A中(g)所示的界面109包括:后台绘制图16A中(g)所示的界面109显示的图像201d,以及后台绘制图16A中(f)所示的界面109显示的菜单控件。其中,后台绘制图16A中(g)所示的界面109显示的图像201d,可以理解成,基于图16A中(b)所示的界面106中的图像201b的显示位置,在view上绘制视频的另一帧图像201d,view不发生变化。可理解,后台绘制属于对用户不可见的绘制操作。
折叠手机后台绘制图16A中(g)所示的界面109完成,快照107的透明度过渡为0之后,通过异形屏显示该界面。如图16A中(d)所示,折叠手机显示界面109,界面109包括视频的另一帧图像201d,收藏、返回和删除三种控件,图像201d位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。以用户为参照物,图像201d沿向左方向显示,且通常位于图像显示区域103的居中位置;图像201d的view和图像显示区域103的尺寸相同。
再之后,折叠手机则绘制并显示图16A中(d)所示的起始界面过渡到图16B中(j)所示的结束界面的旋转动效。
如前述内容,图16A中(f)展示了旋转动效的结束界面108,图16B中(j)可理解成展示出:折叠手机再绘制一次结束界面108,并在结束界面108绘制完成之后通过显示屏显示的界面。如图16B中(j)所示,界面108包括图像201c,收藏、返回和删除三种控件,图像201c位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图像201c的view和图像显示区域103的尺寸相同。
并且,由于视频处于播放过程中,因此,图16B中(j)展示的图像201c与图16A中(d)中展示的图像201d,图像内容可发生变化。
需要说明的是,图16B示例性的展示了图16A中(d)所示的起始界面过渡到图16B中(j)所示的结束界面的旋转动效中的两个界面,但这并不构成对展示旋转动效中界面的限制。
如图16B中(h)所示,折叠手机的异形屏显示界面110,界面110包括视频的另一帧图像201e,收藏、返回和删除三种控件,图像201e位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图16B中(h)图中,以用户为参照物,图像201e沿向第一左上方向显示,第一左上方向可以理解成是向左方向过渡到向上方向过程中的一个方向;图像201e的view和图像显示区域103的尺寸相同。
如图16B中(i)所示,折叠手机的异形屏显示界面111,界面111包括视频的另一帧图像201f,收藏、返回和删除三种控件,图像201f位于图像显示区域103,收藏、返回和删除三种控件位于菜单显示区域102。图16B中(i)中,图像201f沿向第二左上方向显示,第二左上方向可以理解成是向左方向过渡到向上方向过程中的另一个方向,且第二左上方向更靠近于向上方向;图像201f的view和图像显示区域103的尺寸相同。第一左上方向和第二左上方向可以理解成第三方向。
需要说明的是,在一些情况下,折叠手机后台绘制图16A中(g)所示的界面109完成,快照107的透明度并没有过渡为0;待折叠手机后台绘制图16A中(g)所示的界面109和图16A中(f)所示的界面108之间的一个界面之后,快照107的透明度过渡到0,如此,折叠手机的异形屏则显示图16A中(g)所示的界面109和图16A中(f)所示的界面108之间的界面,并且,该界面中,以用户为参照物,图像的显示方向为图16A中(g)展示的界面109中的图像的向左方向和图16A中(f)展示的界面108中图像的向上方向之间的一个方向,且通常图像位于图像显示区域103的居中位置。
需要说明的是,折叠手机绘制图16A中(d)所示的起始界面过渡到图16B中(j)所示的结束界面过程中的多个界面,均包括:绘制界面显示的视频内容和菜单控件,其中,绘制界面显示的视频内容可以理解成,基于计算出的视频内容的显示位置,在view上绘制视频内容,view不发生变化,在view上绘制的视频内容可跟随视频播放发生变化。绘制菜单控件可以理解成控制菜单控件由-90°旋转为0°。
还需要说明的是,折叠手机后台绘制图16A中(g)所示的界面108,且其异形屏显示基于图16A中(c)所示的界面快照107得到的窗口动效的目的是:为了避免异形屏显示图16A中(b)后直接显示图16A中(g),导致出现闪屏问题。
并且,折叠手机基于窗口动效展示图16A中(c)所示的界面快照107的过程中,界面快照107的透明度趋近于0时,折叠手机绘制的图16A中(d)所示的起始界面过渡到图16B中(j)所示的结束界面过程中的多个界面,则逐渐对用户可见。
上述内容中,图像201a,图像201b,图像201c,图像201d,图像201e和图像201f是视频中的图像,为绘图方便,图像201a,图像201b,图像201c,图像201d,图像201e和图像201f的图像内容相同。但可知:折叠手机播放视频,用户旋转折叠手机,折叠手机显示旋转动效的过程中,视频可续播,折叠手机的异形屏上显示的视频内容可发生变化。
界面109,界面110,界面111和界面108,可以理解成是同一个界面,只是界面的内容发生了变化,可称为第二界面。
以下结合电子设备的软件结构中的模块,对本申请实施例提供的显示方法进行介绍。首先需要说明的是,下述实施例以折叠手机的图库应用播放视频,折叠手机基于用户竖向握持设备调整成横向握持的操作,通过旋转动效实现由竖屏显示视频的画面切换为横屏显示视频的画面为例进行说明,但这并不构成对显示方法的应用场景的限制,也并不构成对显示方法的执行方的限制。
如图17所示,本申请实施例提供的显示方法,包括:
S1201、折叠手机处于竖向0°姿态,用户在异形屏上输入浏览视频操作。
其中,视频指代图16中(a)展示的视频浏览界面展示的视频。示例性的,视频中的一帧图像的尺寸为1418×2520。
折叠手机处于竖向0°姿态,且处于折叠态。折叠手机的异形屏被使能进行屏显。
在一些实施例中,用户输入操作启动相机运行,异形屏显示相机预览界面。用户在相机预览界面输入操作以拍摄视频,该视频保存于图库应用。用户通过操作相机浏览界面上链接图库应用的组件,以输入浏览视频的操作。
在另一些实施例中,用户输入操作启动图库应用,异形屏显示图库应用的界面,该界面显示有视频的缩略图。用户在图库应用的界面选中视频,以输入浏览视频的操作。
本实施例中以用户通过操作相机浏览界面上链接图库应用的组件,以输入浏览视频的操作为例进行介绍。
S1202、窗口管理器检测到用户输入的浏览视频的操作,设置display角度0°。
折叠手机处于竖向0°姿态,用户输入浏览视频操作,窗口管理器可基于触摸传感器等监测用户输入的浏览视频操作,窗口管理器设置display角度0°,即窗口的显示角度为0°。
在一些实施例中,异形屏被使能进行屏显,窗口管理器可记录折叠手机显示方式的参数的数值,该参数的数值用于指示进行屏显的屏幕。
在另一些实施例中,窗口管理器也可基于加速度传感器,陀螺仪传感器等部件,确定折叠手机的姿态,以根据确定的姿态,设定窗口的显示角度。如步骤S1201所述,折叠手机处于竖向0°姿态,窗口管理器通过加速度传感器,陀螺仪传感器等确定其处于竖向0°姿态,设置窗口的显示角度为0°。
S1203、窗口管理器启动图库运行。
窗口管理器监测到用户输入的浏览视频的操作之后,因视频保存于图库,且需要利用图库应用进行显示,因此,窗口管理器还可启动图库运行。
需要说明的是,在用户在图库应用的界面输入浏览视频的操作的场景中,图库应用已处于启动状态,本步骤则可不执行。
S1204、activity组件控制窗口管理器设置窗口动效。
图库被启动运行,图库的activity(活动)组件,会向窗口管理器设置窗口动效的类型,例如,该窗口动效为淡入淡出动效类型,窗口管理器基于窗口动效的类型,配置该类型的窗口动效的参数。
S1205、VideoTouchView组件向窗口管理器获取显示角度lastDegree=0°。
S1206、VideoTouchView组件记录显示角度lastDegree=0°。
图库应用启动运行,图库应用的VideoTouchView(视频播放器的容器)组件初始化,初始化完成之后,则向窗口管理器获取窗口的显示角度,并记录窗口的显示角度。如步骤S1202所述,窗口管理器设置的窗口的显示角度为0°,基于此,VideoTouchView组件记录的显示角度则为lastDegree=0°。
S1207、SurfaceView组件设置view的尺寸。
用户通过步骤S1201输入浏览视频的操作,折叠手机则需要在异形屏上显示视频的浏览界面。如图16中(a)所示,异形屏显示的视频的浏览界面中的菜单显示区域用于显示菜单,图像显示区域用于显示视频内容。也就是说:视频的浏览界面的view可以理解成是父布局的view,其包括显示菜单区域的子view和显示视频内容的区域的子view。显示视频内容的区域的子view用于显示图16中(a)展示的图像201a。
为实现在异形屏上显示视频的浏览界面,创建视频的view包括设置视频的浏览界面的view的尺寸,即设置父布局的view的尺寸。SurfaceView组件包括父布局viewpager(即父布局的布局管理器),其可根据异形屏的尺寸,例如宽x高为1080x1200,设置父布局的view的尺寸。示例性的,父布局的view的尺寸是:宽x高为1092x1200。
显示视频内容的区域的子view的高与父布局的view的高相同,显示视频内容的区域的子view的宽小于父布局的view的宽。父布局viewpager还可设置显示显示视频内容的区域的子view的左侧边,与父布局的view的左侧边的差,即显示视频内容的区域的子view和父布局的view的宽度差。SurfaceView组件基于父布局viewpager设置的左侧边距的差值,则设置显示视频内容的区域的子view的尺寸。示例性的,父布局viewpage设置左侧边距的差值为417,显示视频内容的区域的子view的尺寸则是:宽x高为675x1200。
当然,显示菜单区域的子view也需要创建,但因其不是本申请实施例介绍的重点,因此不展开说明。
S1208、SurfaceView组件计算并记录视频的缩放比和偏移量,记录视频的显示角度0°。
视频中图像的宽和高与显示视频内容的区域的子view的宽和高可能并不适配,基于此,需要调整视频中图像。在一些实施例中,SurfaceView组件的updateVideoView组件计算视频中图像的缩放比和偏移量,updateVideoView组件可用缩放比调整视频中图像的尺寸,用偏移量调整视频中图像在显示视频内容的区域的子view的显示位置。
需要说明的是,updateVideoView组件计算视频中图像的缩放比和偏移量,以及记录视频的显示角度的方式,可参见前述实施例中步骤S908的内容,此处不再赘述。
S1209、SurfaceView组件判断不存在动效时,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵。
因折叠手机目前处于显示视频的浏览界面的阶段,折叠手机没有发生旋转,SurfaceView组件则会判断出不存在动效。在一些实施例中,SurfaceView组件可以基于动效的参数是否为空,来判断是否存在动效,当然,该参数为空,则不存在动效,反之则存在动效。
本实施例中提及的动效可称呼旋转动效,指代用户旋转折叠手机,折叠手机显示图16A中(d)展示的界面109过渡为图16B中(j)展示的界面108的动效。
在一些实施例中,SurfaceView组件向Transaction组件设置视频内容的宽和高,以及设置携带显示角度和偏移量的矩阵的方式,如图18所示,包括:
S1301、构造矩阵对象matrix,且在矩阵对象设置角度。
其中,在矩阵对象matrix设置角度之后的矩阵对象可表达为matrix.setRotate(rotation)。在矩阵对象设置的角度指代:在步骤S1208中提出的SurfaceView组件记录的视频的显示角度0°。
需要说明的是,设置角度之后的矩阵对象属于带角度的矩阵对象。
S1302、对矩阵对象中x,y设置对应偏移量。
其中,获取矩阵对象中的一个数组matrixArray=matrix.getValues(matrixArray);在该数组中的第2位和第5位分别设置x轴的偏移量和y轴的偏移量,即由数组的第2位和第5位分别携带x轴的偏移量和y轴的偏移量,具体表示为:
matrixArray[2]=ranslateX;matrixArray[5]=ranslateY。
当然,第2位和第5位仅为示例,也可以在数组的其他位携带x轴的偏移量和y轴的偏移量。x轴的偏移量和y轴的偏移量指代:在步骤S1208中提出的SurfaceView组件记录的视频中图像的偏移量。
S1303、向Transaction组件设置视频内容的宽和高。
视频内容的宽和高指代:基于在步骤S1208中提出的SurfaceView组件记录的视频中图像的缩放比,将视频中图像进行缩放之后的宽和高,即视频中图像显示的宽和高,下文中提及的视频中图像的宽和高均指代该图像显示的宽和高。
SurfaceView组件向Transaction组件设置视频内容的宽和高,可表达为:
Transaction.setBufferSize(surfaceControl,viewWidth,viewHeight)。
S1304、将包括角度和偏移量的矩阵对象的数据,设置给Transaction组件。
步骤S1304可表达为setMatrix(Matrix matrix)。
Transaction组件包括一个矩阵对象,该矩阵对象不包括角度,在原生流程中,Transaction组件基于该矩阵对象控制SurfaceView组件绘制视频的画面,但由于该矩阵对象不包括角度,因此,view被绘制时,视频内容才无法旋转。
并且,Transaction组件属于框架层不向应用程序层开放的组件,应用程序层的应用无法修改Transaction组件中的矩阵对象,致使无法在矩阵对象中写入角度。
基于此,通过在Transaction组件和应用程序层之间设置接口,实现应用程序层的应用可修改Transaction组件中的矩阵对象。在一些实施例中,在Transaction组件和应用程序层之间设置接口的方式是:在Transaction组件中的矩阵对象对应的函数封装可被应用程序层的应用修改的函数。
SurfaceView组件通过Transaction组件和应用程序层之间设置接口,将包括角度和偏移量的矩阵对象的数据,设置给Transaction组件中的矩阵对象,如此,Transaction组件基于该矩阵对象控制SurfaceView组件绘制视频的画面,视频内容可基于角度进行旋转。
S1305、Transaction.apply()
SurfaceView组件通过步骤S1303和步骤S1304,向Transaction组件设置了视频的图像的宽和高,偏移量,以及显示角度,Transaction组件则可执行Transaction.apply()以进行后续操作。其中,后续操作可指代下述步骤S1210的内容。
执行步骤S1209动作的组件可以是SurfaceView组件中的updateVideoView组件。
S1210、Transaction组件通过SurfaceView组件控制handler组件执行绘制操作。
在一些实施例中,Transaction组件可基于矩阵对象通过SurfaceView组件控制handler组件执行绘制操作,该矩阵对象可包括视频的图像的宽和高,偏移量,以及显示角度。另一些实施例中,Transaction组件可将矩阵对象的数据向SurfaceView组件,SurfaceView组件基于矩阵对象的数据,控制handler组件执行绘制操作。当然,矩阵对象的数据可包括视频的图像的宽和高,偏移量,以及显示角度。
S1211、handler组件绘制并通过显示屏显示图16A中(a)所示的界面。
Transaction组件通过SurfaceView组件控制handler组件绘制视频的浏览界面的view,以及在view的图像显示区域(即显示视频内容的区域的子view),基于视频的图像的宽和高,以及偏移量绘制视频的图像,绘制完成进行屏显之后,异形屏则可显示图16A中(a)所示的界面。其中,视频中的图像在图像显示区域的显示方向,可由显示角度来指示。
可理解:基于视频中图像的宽和高,偏移量和显示角度,也可确定视频中图像的显示位置。当然视频中图像的显示位置,也可基于其他参数确定,不限制于图像的宽和高,偏移量和显示角度。
需要说明的是,步骤S1202至步骤S1211可以理解为:折叠手机响应于用户输入的浏览视频的操作,初始化视频的浏览界面的view,以及绘制且显示视频的浏览界面的view的初始状态。
需要说明的是,SurfaceView组件包括:onLayout组件,其由Transaction组件控制进而控制handler组件绘制以显示图16A中(a)所示的界面。一些实施例中,onLayout组件可向handler组件发送消息,以通知更新view,以绘制图16A中(a)所示的界面。
S1212、用户输入逆时针旋转屏幕90°的操作。
用户调整折叠手机的握持方式,控制折叠手机逆时针旋转90°,对应的,异形屏由竖屏显示切换为横屏显示。
需要说明的是,异形屏由竖屏显示视频切换为横屏显示视频之后,应先呈现图16A中(b)所示的界面,再之后,异形屏应再显示图16A中(d)过渡为图16B中(j)的动效。下述步骤S1213至步骤S1223是异形屏由竖屏显示视频切换为横屏显示视频之后,应呈现图16A中(b)所示的界面,以及后台绘制图16A中(g)的实现方案;步骤S1224至步骤S1230是异形屏显示图16A中(d)过渡为图16B中(j)的动效的实现方案。
S1213、窗口管理器检测到用户输入的逆时针旋转屏幕90°的操作,设置display角度90°。
步骤S1213的具体实现方式,可参见前述实施例中步骤S912的内容,此处不再赘述。
S1214、窗口管理器获取显示屏显示的界面的快照,通过显示屏显示图16A中(c)所示界面。
步骤S1214的具体实现方式,可参见前述实施例中步骤S913的内容,此处不再赘述。
S1215、VideoTouchView组件向窗口管理器获取显示角度curentRotation=90°。
S1216、VideoTouchView组件记录显示角度curentRotation=90°。
VideoTouchView组件执行系统回调onConfigChange,向窗口管理器获取并记录窗口的显示角度curentRotation=90°。
S1217、窗口管理器启动窗口动效100ms。
步骤S1217的实现内容,可参见前述实施例中步骤S916的内容,此处不再赘述。
S1218、VideoTouchView组件计算动效起始角度-90°,记录起始缩放比和起始偏移量。
VideoTouchView组件执行步骤S1218的具体实现方式,可参见前述实施例中步骤S917的内容,此处不再赘述。
需要说明的是,VideoTouchView组件计算动效起始角度,以及记录起始缩放比和起始偏移量之后,还可向handler(组织者)组件发送延迟50ms的消息。50ms仅为示例。其中,VideoTouchView组件向handler组件发送延迟50ms的消息的目的是:等待SurfaceView组件利用延迟时长完成动效结束时的视频的view。
还需要说明的是,VideoTouchView组件计算动效起始角度,以及记录起始缩放比和起始偏移量之后,还可触发view的重绘。在一些实施例中,VideoTouchView组件触发view重绘的方式是:对视频的浏览界面的view设置标志invalidate。如此,handler组件基于标志invalidate,对视频的浏览界面的view进行绘制。
重绘的视频的浏览界面的view的尺寸,以及视频显示于view时的图像的缩放比和偏移量,以及视频中图像的显示角度,由下述步骤S1219和步骤S1221得到。可知的,SurfaceView组件可在前述提出的延迟时长内,执行下述步骤S1219和步骤S1221。
S1219、SurfaceView组件设置view的尺寸。
异形屏由竖屏显示切换为横屏显示,异形屏显示横向窗口,因此,View组件需要重新设置视频的浏览界面的view的尺寸,即设置横屏显示视频的窗口的尺寸。具体方式可参见前述实施例中步骤S918的内容,此处也不再赘述。
折叠手机响应于屏幕由竖向0°逆时针旋转90°,通常仅设置一次图像显示区域的view。下述步骤S1225至步骤S1230的执行过程中,图像显示区域的view并不发生变化,因此无法重新设置,如此可以保证view的尺寸可以维持与图像显示区域相同,能够撑满图像显示区域,进而导致用户对图像显示区域执行左滑、右滑操作以切换图像时,折叠手机可以响应该操作。
S1220、SurfaceView组件计算并记录视频的缩放比和偏移量,记录视频的显示角度0°。
用户逆时针旋转屏幕90°,异形屏由竖屏显示切换为横屏显示。异形屏采用横屏显示方式显示视频,即显示视频的窗口为横向窗口。SurfaceView组件需要计算横向窗口显示视频时,视频中图像的缩放比和偏移量。并且,异形屏以横屏显示方式显示视频,视频还是正向显示,SurfaceView组件则记录视频的显示角度为0°。
SurfaceView组件计算并记录视频中图像的缩放比和偏移量的方式,可参见前述实施例中步骤S919的内容,此处也不再赘述。
S1221、SurfaceView组件判断不存在动效时,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵。
因动效还没有被设置,因此,SurfaceView组件判断出不存在动效。并且,SurfaceView组件基于视频的显示角度、缩放比和偏移量,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵。其中,SurfaceView组件基于视频的显示角度、缩放比和偏移量,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵的方式,可如前述步骤S1209的内容,此处不再赘述。
步骤S1221中提及的动效也可称呼为旋转动效,指代用户旋转折叠手机,折叠手机显示图16A中(d)展示的界面109过渡为图16B中(j)展示的界面108的动效。
S1222、Transaction组件通过SurfaceView组件控制handler组件执行后台绘制操作。
S1223、handler组件后台绘制图16A中(g)所示的界面。
handler组件绘制横屏显示的view,以及在横屏显示的view的图像显示区域,基于视频的显示角度,宽高和偏移量绘制视频的图像,但并不进行屏显,对用户不可见,异形屏还在持续显示窗口管理器启动的动效。
与步骤S1211等同,基于视频中图像的宽和高,偏移量和显示角度,也可确定视频中图像的显示位置。当然视频中图像的显示位置,也可基于其他参数确定。
S1224、VideoTouchView组件在延迟50ms后,记录动效结束角度0°,结束缩放比和结束偏移量,设置动效。
handler组件延迟50ms之后,接收到VideoTouchView组件发送的消息。VideoTouchView组件接收到消息之后,控制VideoTouchView组件记录动效结束角度以及动效中视频的结束缩放比和结束偏移量。
VideoTouchView组件执行步骤S1224的具体实现方式,可参见前述实施例中步骤S922的内容,此处不再赘述。
S1225、SurfaceView组件判断存在动效时,动效执行时长未达到动效总时长的过程中,计算动效过程中的每一次绘制对应的视频的显示角度、缩放比和偏移量。
SurfaceView组件执行步骤S1225的具体实现方式,可参见前述实施例中步骤S923的内容,此处不再赘述。
S1226、SurfaceView组件在动效执行时长未达到动效总时长的过程中,基于动效过程中的每一次绘制对应的视频的显示角度、缩放比和偏移量,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵。
SurfaceView组件计算出动效执行过程中的每一次绘制对应的视频的显示角度、缩放比和偏移量,SurfaceView组件还基于一次绘制对应的视频的显示角度、缩放比和偏移量,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵。
其中,SurfaceView组件基于视频的显示角度、缩放比和偏移量,向Transaction组件设置视频内容的宽高,以及设置携带显示角度和偏移量的矩阵的方式,可如前述步骤S1209的内容,此处不再赘述。
S1227、Transaction组件通过SurfaceView组件控制handler组件执行绘制操作。
SurfaceView组件执行步骤S1227的具体实现方式,可参见前述步骤S1210的内容,此处不再赘述。
S1228、窗口管理器响应于100ms窗口动效,将快照的透明度由1逐渐变为0。
窗口管理器响应于100ms窗口动效,将显示的界面快照的透明度由1逐渐变为0。如此,可保证handler组件通过步骤S1229绘制的界面可能被用户可见。当然,100ms为窗口动效时长的示例。
步骤S1228和步骤S1229的执行顺序并不限制于图17展示的顺序。
S1229、handler组件依次根据每一次绘制操作对应的视频内容的宽高,以及携带显示角度和偏移量的矩阵,绘制图16A中(d)至图16B中(j)所示界面。
S1230、在窗口动效的透明度变为0的过程中,handler组件绘制的图16A中(x)到图16B中(j)逐渐可见,x可以是图16A中(d)或者其之后的一张图。
SurfaceView组件得到动效过程中的每一次绘制操作对应的视频内容的宽高,以及显示角度和偏移量之后,则也可对视频对应的view设置标志invalidate,如此,Transaction组件基于标志invalidate,通过SurfaceView组件控制handler组件对视频对应的view进行绘制。并且,基于视频中图像的宽和高,偏移量和显示角度,也可确定视频中图像的显示位置。当然视频中图像的显示位置,也可基于其他参数确定。
并且,handler组件执行动效过程中的每一次绘制操作并通过异形屏进行屏显,异形屏则可显示图16A中(d)过渡到图16B中(j)的动效。
需要说明的是,窗口管理器通过步骤S1217启动100ms的窗口动效,窗口动效开始之后的50ms之后,折叠手机通过VideoTouchView组件设置动效,且通过SurfaceView组件计算出动效执行过程中的一次绘制操作对应的视频的显示角度、缩放比和偏移量。VideoTouchView组件和SurfaceView组件的动作也会占用一定时长,待Transaction组件控制handler组件基于SurfaceView组件计算出的动效执行过程中的一次绘制对应的视频的显示角度、宽高和偏移量进行绘制时,窗口管理器启动的窗口动效大概率已经结束,如此,handler组件每一次的绘制内容则可通过异形屏进行显示,呈现图16A中(d)过渡到图16B中(j)的动效。
进一步的,即便Transaction组件控制handler组件基于SurfaceView组件计算出的动效执行过程中的一次绘制对应的视频的显示角度、宽高和偏移量进行绘制时,窗口管理器启动的窗口动效还未结束,但也进入尾声,handler组件前几次的绘制内容未能屏显,即图16A中(d)及之后的几帧图像可能对用户不可见,但并不影响用户感受到异形屏是由图16A中(d)过渡到图16B中(j)的动效。
本申请另一实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机或处理器上运行时,使得计算机或处理器执行上述任一个方法中的一个或多个步骤。
计算机可读存储介质可以是非临时性计算机可读存储介质,例如,非临时性计算机可读存储介质可以是只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
本申请另一实施例还提供了一种包含指令的计算机程序产品。当该计算机程序产品在计算机或处理器上运行时,使得计算机或处理器执行上述任一个方法中的一个或多个步骤。
Claims (23)
- 一种显示方法,其特征在于,应用于电子设备,所述电子设备的显示屏包括第一区域和第二区域,所述第一区域和所述第二区域不重合,所述第二区域设置有挖孔区域,所述挖孔区域安装有摄像头,所述显示方法包括:所述电子设备的显示屏显示第一界面,所述第一界面中对应所述第一区域的区域内显示第一图像,所述第一图像沿第一方向显示,在所述第二区域中显示菜单控件,所述菜单控件用于处理所述第一图像;所述电子设备响应于沿第一旋转方向旋转的操作,获取所述第一界面的快照;所述电子设备显示所述快照,显示的所述快照中所述第一图像沿第二方向显示,所述第二方向与所述第一方向具有第一夹角,所述快照的透明度为第一值;在所述快照的透明度值小于第二值时,所述电子设备显示第二界面,所述第二界面中对应所述第一区域的区域内显示第二图像,所述第二图像沿第三方向显示,所述第三方向为所述第二方向过渡为所述第一方向过程中的方向,所述第二值小于所述第一值;所述电子设备在所述第二界面中显示所述第二图像过渡为第三图像的动效,所述电子设备显示所述第三图像时,所述第三图像在所述第一区域沿所述第一方向显示;在所述电子设备的显示屏的第一区域显示所述第二图像和所述第二图像过渡为第三图像的动效的过程中,持续在所述第二区域中显示所述菜单控件。
- 根据权利要求1所述的显示方法,其特征在于,所述电子设备显示所述快照之后,显示所述第二界面之前,所述方法还包括:所述电子设备确定所述第二图像的显示位置;所述电子设备基于所述第二图像的显示位置,在所述第一区域对应的第一视图中绘制所述第二图像。
- 根据权利要求2所述的显示方法,其特征在于,所述电子设备显示所述快照之后,所述方法还包括:所述电子设备创建所述第一视图,所述第一视图的尺寸为第一尺寸;所述电子设备确定第四图像的显示位置;所述电子设备基于所述第四图像的显示位置,在所述第一视图中绘制所述第四图像,所述第四图像的方向为所述第一方向。
- 根据权利要求3所述的显示方法,其特征在于,所述在所述第一视图中绘制所述第四图像的过程中,在所述快照的透明度为由第三值过渡为第四值,所述第三值小于所述第一值且大于第二值,所述第四值小于所述第三值且大于第二值;在所述快照的透明度为所述第三值过渡为第四值的过程中,所述第四图像对用户不可见。
- 根据权利要求4所述的显示方法,其特征在于,在所述快照的透明度为所述第一值过渡为第二值的过程中,所述电子设备在所述第一视图中绘制的图像对用户不可见。
- 根据权利要求3至5中任一所述的显示方法,其特征在于,所述方法还包括:所述确定所述第四图像的显示位置之前,所述电子设备确定是否存在动效;在确定不存在动效的情况下,确定所述第四图像的显示位置,以及延迟第一时长后,设置启动动效。
- 根据权利要求6所述的显示方法,其特征在于,所述方法还包括:确定所述第二图像的显示位置之前,所述电子设备确定是否存在动效;其中,在所述电子设备确定存在动效的情况下,确定所述第二图像的显示位置。
- 根据权利要求3至5中任一所述的显示方法,其特征在于,所述电子设备创建第一视图,包括:设置所述显示屏的角度为第一角度;基于所述第一角度,创建所述第一视图。
- 根据权利要求1至8中任一所述的显示方法,其特征在于,所述获取所述第一界面的快照之后,还包括:所述电子设备启动窗口动效,所述窗口动效用于控制所述电子设备显示所述快照时,所述快照的透明度由所述第一值过渡为第五值,所述第五值指示所述快照完全透明,所述第五值小于或等于所述第二值,所述第一值过渡为所述第五值的时长为第二时长。
- 根据权利要求1至9中任一所述的显示方法,其特征在于,所述电子设备的显示屏显示第一界面之前,还包括:所述电子设备设置所述显示屏的角度为第二角度;所述电子设备基于所述第二角度,创建所述第一区域的第二视图,所述第二视图的尺寸为第二尺寸;所述电子设备确定所述第一图像的显示位置;所述电子设备基于所述第一图像的显示位置,在所述第二视图绘制所述第一界面。
- 根据权利要求2所述的显示方法,其特征在于,所述确定所述第二图像的显示位置,包括:计算得到所述第二图像的缩放比、偏移量和显示角度;所述第二图像的显示角度用于指示所述第三方向;所述第二图像的缩放比用于指示所述第二图像和所述第一区域的比例关系;所述第二图像的偏移量用于指示所述第二图像在所述第一区域的显示区域;基于所述第二图像的缩放比、偏移量和显示角度,确定所述第二图像的显示位置。
- 根据权利要求11所述的显示方法,其特征在于,所述计算得到所述第二图像的缩放比、偏移量和显示角度,包括:计算得到图像的缩放比的变化率、偏移量的变化率和显示角度的变化率;基于图像的缩放比的总变化量和所述图像的缩放比的变化率,计算得到一次图像绘制操作对应的图像的缩放比的变化值,将第五图像的缩放比和所述图像的缩放比的变化量的和,作为所述第二图像的缩放比;基于图像的偏移量的总变化量和所述图像的偏移量的变化率,计算得到一次图像绘制操作对应的图像的偏移量的变化值,将所述第五图像的偏移量和所述图像的偏移量的变化量的和,作为所述第二图像的偏移量;基于图像的显示角度的总变化量和所述图像的显示角度的变化率,计算得到一次图像绘制操作对应的图像的显示角度的变化值,将所述第五图像的显示角度和所述图像的显示角度的变化量的和,作为所述第二图像的显示角度;其中,所述第五图像由所述电子设备基于所述第二图像的绘制操作的前一次绘制操作绘制得到;所述图像的缩放比的总变化量指代:所述第一图像的缩放比和所述第三图像的缩放比的差值;所述图像的偏移量的总变化量指代:所述第一图像的偏移量和所述第三图像的缩放比的差值;所述图像的显示角度的总变化量指代:所述电子设备沿所述第一旋转方向旋转的角度。
- 根据权利要求1至12中任一所述的显示方法,其特征在于,所述电子设备在所述第二界面中显示所述第二图像过渡为第三图像的动效的实现方式,包括:所述电子设备在所述第一视图,基于多次绘制操作对应的图像的显示位置,绘制并显示图像;其中,所述多次绘制操作对应的图像的显示位置用于指示图像由所述第二图像过渡为所述第三图像。
- 根据权利要求1至13中任一所述的显示方法,其特征在于,所述第一图像,所述第二图像,所述第三图像对应于图库中的同一个图像。
- 根据权利要求2至10中任一,或13所述的显示方法,其特征在于,所述第一图像,所述第二图像,所述第三图像对应于同一视频中的不同帧图像。
- 根据权利要求15所述的显示方法,其特征在于,所述确定所述第二图像的显示位置,包括:计算所述第二图像显示的宽和高,以及通过矩阵对象设置所述第二图像的显示角度和偏移量;所述第二图像的显示角度用于指示所述第三方向;所述偏移量用于指示所述第二图像在所述第一区域的显示区域;基于所述第二图像显示的宽和高、偏移量和显示角度,确定所述第二图像的显示位置。
- 根据权利要求16所述的显示方法,其特征在于,所述通过矩阵对象设置所述第二图像的显示角度和偏移量的方式,包括:构建第一矩阵对象,所述第一矩阵对象存储有所述第二图像的偏移量和显示角度;通过事务Transaction组件和所述电子设备的应用程序层之间接口,向所述Transaction组件的第二矩阵对象写入所述第二图像的偏移量和所述显示角度。
- 根据权利要求1至17中任一所述的显示方法,其特征在于,所述第一图像显示在所述第一界面中对应所述第一区域的区域内的居中位置;所述第二图像显示在所述第二界面中对应所述第一区域的区域内的居中位置;所述第三图像显示在所述第二界面中对应所述第一区域的区域内的居中位置。
- 根据权利要求1至18中任一所述的显示方法,其特征在于,所述电子设备在所述第二界面中显示所述第二图像过渡为第三图像的动效的过程中,所述电子设备还在所述第二区域显示所述菜单控件由所述第三方向过渡为所述第一方向的动效。
- 根据权利要求1至19中任一所述的显示方法,其特征在于,所述菜单控件包括收藏控件、返回控件和删除控件中的一个或多个,所述菜单控件用于处理所述第一图像,包括:在所述菜单控件包括收藏控件的情况下,接收到作用于所述收藏控件的操作,将所述第一图像添加到图库的收藏相册中;在所述菜单控件包括返回控件的情况下,接收到作用于所述返回控件的操作,显示第三界面,所述第三界面为所述第一界面的上一级界面;在所述菜单控件包括删除控件的情况下,接收到作用于所述删除控件的操作,删除所述第一图像。
- 一种电子设备,其特征在于,包括:一个或多个处理器、存储器以及显示屏;所述存储器和所述显示屏与所述一个或多个所述处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,所述电子设备执行如权利要求1至20任一项所述的显示方法。
- 一种计算机可读存储介质,其特征在于,用于存储计算机程序,所述计算机程序被执行时,具体用于实现如权利要求1至20任一项所述的显示方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得计算机执行如权利要求1至20任一项所述的显示方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP25821009.5A EP4757298A1 (en) | 2024-06-13 | 2025-05-14 | Display method, electronic device, readable medium and program product |
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410768142 | 2024-06-13 | ||
| CN202410768142.6 | 2024-06-13 | ||
| CN202410869806.8 | 2024-06-28 | ||
| CN202410869806.8A CN121193842A (zh) | 2024-06-13 | 2024-06-28 | 显示方法、电子设备、可读介质和程序产品 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025256330A1 true WO2025256330A1 (zh) | 2025-12-18 |
Family
ID=98050103
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2025/094803 Pending WO2025256330A1 (zh) | 2024-06-13 | 2025-05-14 | 显示方法、电子设备、可读介质和程序产品 |
Country Status (2)
| Country | Link |
|---|---|
| EP (1) | EP4757298A1 (zh) |
| WO (1) | WO2025256330A1 (zh) |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100189413A1 (en) * | 2009-01-27 | 2010-07-29 | Casio Hitachi Mobile Communications Co., Ltd. | Electronic Device and Recording Medium |
| CN102841722A (zh) * | 2011-06-20 | 2012-12-26 | 联想(北京)有限公司 | 电子设备及其屏幕显示旋转方法 |
| US20190179520A1 (en) * | 2017-12-11 | 2019-06-13 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method for Screenshot and Related Products |
| CN114168031A (zh) * | 2022-02-11 | 2022-03-11 | 荣耀终端有限公司 | 挖孔屏的显示优化方法、设备和存储介质 |
| CN115361468A (zh) * | 2022-10-21 | 2022-11-18 | 荣耀终端有限公司 | 屏幕旋转时的显示优化方法、设备及存储介质 |
| CN117149316A (zh) * | 2022-05-23 | 2023-12-01 | Oppo广东移动通信有限公司 | 界面显示方法、装置、设备、存储介质和程序产品 |
-
2025
- 2025-05-14 WO PCT/CN2025/094803 patent/WO2025256330A1/zh active Pending
- 2025-05-14 EP EP25821009.5A patent/EP4757298A1/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100189413A1 (en) * | 2009-01-27 | 2010-07-29 | Casio Hitachi Mobile Communications Co., Ltd. | Electronic Device and Recording Medium |
| CN102841722A (zh) * | 2011-06-20 | 2012-12-26 | 联想(北京)有限公司 | 电子设备及其屏幕显示旋转方法 |
| US20190179520A1 (en) * | 2017-12-11 | 2019-06-13 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method for Screenshot and Related Products |
| CN114168031A (zh) * | 2022-02-11 | 2022-03-11 | 荣耀终端有限公司 | 挖孔屏的显示优化方法、设备和存储介质 |
| CN117149316A (zh) * | 2022-05-23 | 2023-12-01 | Oppo广东移动通信有限公司 | 界面显示方法、装置、设备、存储介质和程序产品 |
| CN115361468A (zh) * | 2022-10-21 | 2022-11-18 | 荣耀终端有限公司 | 屏幕旋转时的显示优化方法、设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4757298A1 (en) | 2026-06-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP7858021B2 (ja) | 拡張現実環境及び仮想現実環境と相互作用するためのシステム、方法、及びグラフィカルユーザインタフェース | |
| US12073066B2 (en) | User interface transitions and optimizations for foldable computing devices | |
| US12469207B2 (en) | Systems, methods, and graphical user interfaces for scanning and modeling environments | |
| EP4091142B1 (en) | Systems, methods, and graphical user interfaces for displaying and manipulating virtual objects in augmented reality environments | |
| US8997021B2 (en) | Parallax and/or three-dimensional effects for thumbnail image displays | |
| KR102590102B1 (ko) | 증강 현실 기반 디스플레이 방법, 장치 및 저장 매체 | |
| RU2762123C2 (ru) | Избирательное применение обработки репроекции на подобластях слоя для оптимизации мощности репроекции поздней стадии | |
| US8910072B2 (en) | Browsing and interacting with open windows | |
| CN114585996A (zh) | 在多屏计算设备上移动应用 | |
| CN113286159B (zh) | 应用程序的页面显示方法、装置和设备 | |
| US9875075B1 (en) | Presentation of content on a video display and a headset display | |
| CN103577040A (zh) | 具有图形用户界面的方法和便携式设备 | |
| CN117687549A (zh) | 基于按键的交互方法、电子设备 | |
| CN116471366A (zh) | 一种特效生成方法、装置、计算机设备及存储介质 | |
| CN116204090A (zh) | 一种信息展示方法、装置、计算机设备及存储介质 | |
| CN111597293A (zh) | 文档目录的显示方法、装置、设备及可读存储介质 | |
| US20220148134A1 (en) | Systems and method for providing images on various resolution monitors | |
| CN119473470A (zh) | 页面打开方法、电子设备、程序产品及储存介质 | |
| WO2026000825A1 (zh) | 控制方法、装置、头戴显示设备及介质 | |
| EP4757298A1 (en) | Display method, electronic device, readable medium and program product | |
| US12373174B2 (en) | Identification of callback from 2D app to render 3D model using 3D app | |
| CN121193842A (zh) | 显示方法、电子设备、可读介质和程序产品 | |
| CN115202792A (zh) | 用于场景切换的方法、装置、设备和存储介质 | |
| EP4650921A1 (en) | Display method and electronic device | |
| WO2026130027A1 (zh) | 显示方法、电子设备、介质、程序产品、芯片 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 25821009 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2025821009 Country of ref document: EP |