Disclosure of Invention
In view of the above, an embodiment of the present application provides a method for rotating a frame and an electronic device, so as to at least partially solve the above-mentioned problems.
According to a first aspect of an embodiment of the present application, there is provided a picture rotation method, including:
a current picture displayed in a picture display area of the user interface, wherein the picture display area is rectangular in shape; ;
Detecting user operation, and acquiring deflection degrees and rotation degrees, wherein the deflection degrees and the rotation degrees are respectively composed of a numerical value and a sign, the numerical value is integral multiple of 90 degrees, the sign is determined in such a way that the degree rotating clockwise is positive, and the degree rotating anticlockwise is negative;
adding the deflection degree and the rotation degree to obtain a final deflection value;
According to the final deflection value, the size and the angle of the picture to be drawn after the current picture is deflected are stored in a four-dimensional vector matrix;
And drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix.
Optionally, the user interface further comprises a management menu area; detecting a user operation includes detecting a user operation of a user in a screen display area or a management menu area.
Optionally, detecting the user operation includes detecting a user operation on a touch pad corresponding to the screen display area or the management menu area.
Optionally, detecting a user operation, obtaining a deflection degree and a rotation degree, including detecting a user operation; acquiring deflection degrees of a current picture according to user operation, and displaying a menu bar, wherein the menu bar is used for providing options of rotation degrees; the degree of rotation is acquired in response to a selection operation by the user.
Optionally, the menu bar provides options for degrees of rotation including 90 degrees clockwise, 90 degrees counterclockwise, 180 degrees, mirror; and responding to the selection operation of the user in the menu bar, and acquiring the rotation degree in the menu bar corresponding to the selection operation.
According to a second aspect of an embodiment of the present application, there is provided an electronic device including:
the interface display module is used for displaying the current picture and the rotated picture;
The detection module is used for detecting user operation;
the acquisition module is used for acquiring the deflection degree of the current picture and rotating the current picture into the rotation degree of the picture required by the user;
the processing module is used for adding the deflection degree and the rotation degree to obtain a final deflection value, and storing the size and the angle of the picture to be drawn after the deflection of the current picture into a four-dimensional vector matrix according to the final deflection value;
And the output module is used for drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix.
Optionally, the acquiring module is further configured to acquire a deflection degree of the current picture according to the user operation, and display a menu bar, where the menu bar is used for providing an option of a rotation degree; and responding to the selection operation of the user, and acquiring the rotation degree.
Optionally, the interface display module includes a screen display area and a management menu area, and the detecting the user operation includes detecting the user operation of the user in the screen display area or the management menu area.
According to a third aspect of embodiments of the present application, there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the picture rotation method as claimed in any one of claims 1 to 5.
According to a fourth aspect of embodiments of the present application, there is provided a computer program product comprising computer instructions that instruct a computing device to perform operations corresponding to the picture rotation method as claimed in any one of claims 1 to 5.
According to the picture rotating method, the electronic equipment and the storage medium, a current picture is displayed in a picture display area of a user interface, and the picture display area is rectangular; detecting user operation, and acquiring deflection degrees and rotation degrees of a current picture, wherein the deflection degrees and the rotation degrees are respectively composed of a numerical value and a sign, the numerical value is integral multiple of 90 degrees, the sign is determined in such a way that the degree of rotation in the clockwise direction is positive, and the degree of rotation in the anticlockwise direction is negative; adding the deflection degree and the rotation degree to obtain a final deflection value; according to the final deflection value, the size and the angle of the picture to be drawn after the current picture is deflected are stored in a four-dimensional vector matrix; and drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix. By the picture rotation method, the picture angle is adjusted under the condition that hardware equipment is not adjusted, so that the risk of damage caused by adjusting the hardware equipment is reduced, and meanwhile, the picture adjusting efficiency is improved.
Detailed Description
In order to better understand the technical solutions in the embodiments of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which are derived by a person skilled in the art based on the embodiments of the present application, shall fall within the scope of protection of the embodiments of the present application.
The implementation of the embodiments of the present application will be further described below with reference to the accompanying drawings.
Embodiment 1,
An embodiment of the present application provides a method for rotating a frame, referring to fig. 1, the method includes:
S101, displaying a current picture in a picture display area of a user interface.
Specifically, the shape of the screen display area is rectangular, the deflection degree of the current screen is determined according to the current screen displayed by the user interface, and the rotation degree of the current screen to the screen required by the user is determined based on the deflection degree of the current screen. The current picture displayed according to the user interface can determine the deflection degree of the current picture which is deflected clockwise or anticlockwise on the basis of the normal picture, for example, the deflection degree of the current picture is deflected 90 degrees clockwise, and when the current picture needs to be rotated to be the normal picture, the rotation degree of the picture which is rotated to be the user needs to be rotated 90 degrees anticlockwise according to the deflection degree of the current picture.
S102, detecting user operation, and acquiring deflection degrees and rotation degrees of a current picture.
It should be noted that, the deflection degree and the rotation degree are both composed of a number and a symbol, the number is an integer multiple of 90 degrees, for example, the number of the deflection degree and the rotation degree may be 90 degrees, 180 degrees or 270 degrees, and the symbol determining method is as follows: the degree of rotation in the clockwise direction is positive and the degree of rotation in the counterclockwise direction is negative, for example, the degree of deflection is 90 degrees clockwise, i.e., the degree of deflection is 90 degrees, and the degree of rotation is 90 degrees counterclockwise. I.e., the degree of rotation is minus 90 degrees, which can be expressed as-90 degrees.
Optionally, the user interface may further include a management menu area, where the picture display area may display a current picture and a rotated picture, and the management menu area may display options available for user operation, for example, when there are multiple cameras shooting pictures, the user may select different cameras to obtain pictures shot by different cameras, and detect user operations of the user in the picture display area or the management menu area, so that the user operations are more convenient and the operation modes are more diversified. Options for user operation are for example: right-clicking with a mouse at the screen display area or right-clicking with a mouse at a camera option selected in the management menu area.
Alternatively, detecting the user operation may be detecting the operation of the user on the touch panel corresponding to the screen display area or the management menu area. Specifically, the display screen may be a touch screen, and the user may perform an operation by making a touch screen click in a screen display area or a management menu area. The screen rotation operation of the embodiment is suitable for touch screen operation, and user operation can be simpler and more convenient.
Optionally, detecting a user operation, obtaining a deflection degree and a rotation degree, including detecting a user operation; displaying a menu bar according to the acquired deflection degree of the current picture, wherein the menu bar is used for providing options of rotation degree; the degree of rotation is acquired in response to a selection operation by the user.
Specifically, the user operation may be right clicking the camera corresponding to the current picture in the picture display area or the management menu area with the mouse, and obtaining the deflection degree of the current picture according to the obtained handle of the current picture. The menu bar displayed may include a degree of rotation option, such as a 90 degree rotation clockwise, a 90 degree rotation counter-clockwise, a 180 degree rotation, a mirror image, etc., and may include other user operable options, such as a delete option for deleting a current picture, a rename option for changing a name of a current picture, an option for moving a position of a current picture, such as move up, move down, move to the top, move to the bottom, etc., an adaptive screen option for changing a size of a picture, and an attribute option that may change an attribute of a picture. The menu bar is used for providing the option of the rotation degree, so that the user operation is more convenient, and the user operation experience is improved.
In this embodiment, there are various methods for obtaining the handle of the picture, for example, using FindWindow function, using EnumWindows and EnumChildWindows functions and opposite callback functions EnumWindowsProc and EnumChildWindowsProc to obtain the handle of all top-level pictures and the handles of their sub-pictures, and using GetDesktopWindow and GetNextWindow functions to obtain the handle of the picture.
S103, obtaining a final deflection value according to the deflection degrees and the rotation degrees.
Specifically, the calculation method of the final deflection value is as follows: final deflection value=deflection degree+rotation degree, for example, deflection degree is 90 degrees clockwise and rotation degree is 90 degrees counterclockwise, then final deflection value=90 degrees clockwise+90 degrees counterclockwise+90 degrees+ (-90 degrees) =0 degrees, i.e., final deflection value is 0 degrees. The final deflection value is a deflection value with respect to a picture having a deflection degree of 0 degrees, that is, if the final deflection value is 0 degrees, it means that the deflected picture is a picture having a deflection degree of 0 degrees, that is, a normal picture.
And S104, according to the final deflection value, saving the size and the angle of the picture to be drawn after the deflection of the current picture into a four-dimensional vector matrix.
Specifically, the final deflection value is set in the picture attribute, and the size and angle of the current picture to be drawn are saved in a four-dimensional vector Matrix through a Matrix4 interface. Matrix4 is a method library providing 4*4 Matrix operations of WebGL, and the size and angle of the current picture to be drawn can be processed through functions in Matrix4 and the result can be saved. For example, the size and angle to be drawn of the current picture can be initialized to a unit array through SETIDENTITY () function, scaling transformation is performed by setScale (x, y, z) function, translational rotation transformation is performed for a plurality of times by SETTRANSLATE (x, y, z) function and rotation (angle, x, y, z) function, and then the result is stored in Matrix 4.
S105, drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix.
Specifically, the method of drawing a picture according to the size and angle of the picture in the four-dimensional vector matrix may be to use a projection matrix, such as orthogonal projection and perspective projection, wherein the orthogonal projection is a projection perspective projection in which a projection line is perpendicular to a projection plane, belonging to a center projection. A perspective projection view is a graph obtained by projecting an object from a certain projection center onto a single projection surface.
According to the picture rotating method, a current picture is displayed in a picture display area of a user interface, and the picture display area is rectangular; detecting user operation, and acquiring deflection degrees and rotation degrees, wherein the deflection degrees and the rotation degrees are respectively composed of a numerical value and a sign, the numerical value is integral multiple of 90 degrees, the sign is determined in such a way that the degree rotating clockwise is positive, and the degree rotating anticlockwise is negative; adding the deflection degree and the rotation degree to obtain a final deflection value; according to the final deflection value, the size and the angle of the picture to be drawn after the current picture is deflected are stored in a four-dimensional vector matrix; and drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix. By the picture rotation method, the picture angle is adjusted under the condition that hardware equipment is not adjusted, so that the risk of damage caused by adjusting the hardware equipment is reduced, and meanwhile, the picture adjusting efficiency is improved.
Embodiment II,
In combination with the method for rotating a frame described in the above embodiment, a second embodiment of the present application provides an electronic device for executing any one of the methods for rotating a frame described in the first embodiment.
Referring to fig. 2, the data processing apparatus 20 includes:
An interface display module 201 for displaying a current picture and a rotated picture;
a detection module 202 for detecting a user operation;
An obtaining module 203, configured to obtain a deflection degree of a current picture and a rotation degree of a picture required by a user;
The processing module 204 is configured to add the deflection degree and the rotation degree to obtain a final deflection value, and store the size and the angle of the picture to be drawn after the current picture is deflected into a four-dimensional vector matrix according to the final deflection value;
And the output module 205 is used for drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix.
Optionally, the acquiring module is further configured to acquire a deflection degree of the current picture according to the user operation, and display a menu bar, where the menu bar is used for providing an option of a rotation degree; and responding to the selection operation of the user, and acquiring the rotation degree.
Optionally, the interface display module includes a screen display area and a management menu area, and the detecting the user operation includes detecting the user operation of the user in the screen display area or the management menu area.
Alternatively, referring to fig. 3, the interface display module 201 may include a screen display area, a management menu area, a comment display area, a transmission information area, and a multimedia operation area, and a user's rotation screen operation may be performed in any one of the screen display area and the management menu area, the multimedia operation area including microphone and speaker volume adjustment buttons, start/end buttons, and the like.
The application embodiment also provides a computer storage medium having stored thereon a computer program which when executed by a processor implements the above-described screen rotation method.
Embodiments of the present application also provide a computer program product comprising computer instructions that instruct a computing device to perform operations corresponding to the picture rotation method as claimed in any one of claims 1 to 5.
According to the electronic equipment provided by the embodiment of the application, the current picture is displayed in the picture display area of the user interface, and the picture display area is rectangular in shape; detecting user operation, and acquiring deflection degrees and rotation degrees, wherein the deflection degrees and the rotation degrees are respectively composed of a numerical value and a sign, the numerical value is integral multiple of 90 degrees, the sign is determined in such a way that the degree rotating clockwise is positive, and the degree rotating anticlockwise is negative; adding the deflection degree and the rotation degree to obtain a final deflection value; according to the final deflection value, the size and the angle of the picture to be drawn after the current picture is deflected are stored in a four-dimensional vector matrix; and drawing the picture according to the size and the angle of the picture in the four-dimensional vector matrix. By the picture rotation method, the picture angle is adjusted under the condition that hardware equipment is not adjusted, so that the risk of damage caused by adjusting the hardware equipment is reduced, and meanwhile, the picture adjusting efficiency is improved.
It should be noted that, according to implementation requirements, each component/step described in the embodiments of the present application may be split into more components/steps, or two or more components/steps or part of operations of the components/steps may be combined into new components/steps, so as to achieve the objects of the embodiments of the present application.
Those of ordinary skill in the art will appreciate that the elements and method steps of the examples described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
The above embodiments are only for illustrating the embodiments of the present application, but not for limiting the embodiments of the present application, and various changes and modifications may be made by one skilled in the relevant art without departing from the spirit and scope of the embodiments of the present application, so that all equivalent technical solutions also fall within the scope of the embodiments of the present application, and the scope of the embodiments of the present application should be defined by the claims.