WO2023036089A1 - Shadow generation method and apparatus, electronic device and storage medium - Google Patents

Shadow generation method and apparatus, electronic device and storage medium Download PDF

Info

Publication number
WO2023036089A1
WO2023036089A1 PCT/CN2022/117107 CN2022117107W WO2023036089A1 WO 2023036089 A1 WO2023036089 A1 WO 2023036089A1 CN 2022117107 W CN2022117107 W CN 2022117107W WO 2023036089 A1 WO2023036089 A1 WO 2023036089A1
Authority
WO
WIPO (PCT)
Prior art keywords
shadow
target control
outline
image
range
Prior art date
Application number
PCT/CN2022/117107
Other languages
French (fr)
Chinese (zh)
Inventor
叶嘉堂
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023036089A1 publication Critical patent/WO2023036089A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present application relates to the technical field of graphical user interface, and in particular to a method and device for generating a shadow, electronic equipment, and a storage medium.
  • an electronic device such as a smart phone, a computer, a television, etc.
  • GUI Graphical User Interface
  • the embodiment of the present application discloses a method and device for generating a shadow, an electronic device, and a storage medium, which can improve the convenience and efficiency of realizing a shadow effect on a graphical user interface of the electronic device.
  • the first aspect of the embodiment of the present application discloses a shadow generation method, including:
  • the outline data determine a shadow drawing path corresponding to the target control outside the outline range corresponding to the target control;
  • a shadow image corresponding to the target control is drawn through a blur mask filter, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
  • the second aspect of the embodiment of the present application discloses a shadow generation device, including:
  • an outline acquiring unit configured to acquire outline data of the target control to be drawn in the graphical user interface
  • a path determining unit configured to determine a shadow drawing path corresponding to the target control outside the range of the contour corresponding to the target control according to the contour data
  • the shadow drawing unit is configured to draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
  • the third aspect of the embodiment of the present application discloses an electronic device, including a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor realizes the All or part of the steps in any shadow generating method disclosed in the first aspect of the embodiment.
  • the fourth aspect of the embodiment of the present application discloses a computer-readable storage medium, which stores a computer program, wherein, when the computer program is executed by a processor, any shadow generation method as disclosed in the first aspect of the embodiment of the present application is implemented All or some of the steps in .
  • FIG. 1 is a schematic diagram of an application scenario of a shadow generation method disclosed in an embodiment of the present application
  • Fig. 2 is a schematic flowchart of a shadow generation method disclosed in the embodiment of the present application.
  • FIG. 3 is a schematic diagram of a target control displayed on a graphical user interface disclosed in an embodiment of the present application
  • FIG. 4 is a schematic diagram of another target control displayed on a graphical user interface disclosed in an embodiment of the present application.
  • Fig. 5 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application.
  • FIG. 6A is a schematic diagram of a shadow effect implemented on a view object corresponding to a target control disclosed in an embodiment of the present application;
  • FIG. 6B is a schematic diagram of a shadow effect implemented on a view object corresponding to another target control disclosed in the embodiment of the present application;
  • FIG. 6C is a schematic diagram of a shadow effect implemented on a view object corresponding to another target control disclosed in the embodiment of the present application.
  • Fig. 7 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application.
  • Fig. 8 is a schematic diagram of different blur processing modes of the blur mask filter disclosed in the embodiment of the present application.
  • Fig. 9 is a schematic modular diagram of a shadow generating device disclosed in an embodiment of the present application.
  • Fig. 10 is a schematic modular diagram of an electronic device disclosed in an embodiment of the present application.
  • the embodiment of the present application discloses a method and device for generating a shadow, an electronic device, and a storage medium, which can improve the convenience and efficiency of realizing a shadow effect on a graphical user interface of the electronic device.
  • FIG. 1 is a schematic diagram of an application scenario of a shadow generation method disclosed in an embodiment of the present application.
  • the electronic device 100 may include a screen 101, on which a graphical user interface (Graphical User Interface, GUI) 20 may be output and displayed, and the user may obtain an image output by the electronic device 100 through the graphical user interface 20, Text and other information, and at the same time, the control of the electronic device 100 can be realized through the graphical user interface 20 .
  • GUI Graphic User Interface
  • the graphical user interface 20 can be provided with different controls 21, such as button controls, text box controls, etc., and each control 21 can be displayed in the form of a view (View) object on the graphical user interface 20, and the user
  • the electronic device 100 can be controlled by interacting with the selected view object (such as clicking a button, inputting text into a text box, etc.) to call the data or method encapsulated by the corresponding control 21 .
  • the electronic device 100 when it performs output display through its screen 101 , it usually presents different display effects according to different settings of its graphical user interface 20 .
  • various shadow effects can be realized on the view objects corresponding to the controls 21, so as to enhance the three-dimensionality and layering of the view objects and optimize the visual effect of the GUI 20. Expressive effect.
  • the electronic device 100 in order to realize the shadow effect corresponding to the control 21 on the GUI 20, can obtain the outline data of the target control 21 to be drawn in the GUI 20, and according to the outline data, in the The shadow drawing path corresponding to the target control is determined outside the outline range corresponding to the target control 21 . On this basis, the electronic device 100 can draw the shadow image corresponding to the target control 21 through the blur mask filter (BlurMaskFilter) according to the above-mentioned shadow drawing path, and the shadow image is used on the view object corresponding to the above-mentioned target control 21 Realize the shadow effect.
  • the blur mask filter BaskFilter
  • the electronic device 100 when the electronic device 100 draws the target control 21 on the GUI 20, it can draw the shadow image of the target control 21 based on the blur mask filter, so that it can draw the target control 21 on the GUI 20.
  • Implement a control 21 with a shadow effect Compared with the shadow effect in the related art, it is often necessary to draw shadows with four sides and rounded corners according to the size of the control, and the overall drawing process is more complicated.
  • the embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, so as to effectively improve the convenience and efficiency of the electronic device 100 in realizing the shadow effect on the GUI 20 .
  • the above-mentioned electronic device 100 may include various devices or systems with screen display functions, such as mobile phones, smart wearable devices, vehicle-mounted terminals, tablet computers, PCs (Personal Computers, personal computers), PDAs (Personal Digital Assistants, personal digital Assistant), TV, etc., which are not specifically limited in this embodiment of the present application.
  • the electronic device 100 may be equipped with an operating system, such as an Android operating system, an iOS operating system, a Symbian operating system, a Windows operating system, etc.
  • the Android operating system is used as an example .
  • the electronic device 100 shown in FIG. 1 is a TV, which is only an example and should not be regarded as a limitation on the type of the electronic device 100 in the embodiment of the present application.
  • the screen 101 of the electronic device 100 may include a backlight layer and a display layer not shown in the figure.
  • the backlight layer may be used to emit a white backlight
  • the display layer may be used to adjust the filters of different pixels according to the above-mentioned output image signal.
  • the color of the light and the degree of filtering are used to filter the above-mentioned white backlight to achieve color output of different colors and different brightnesses.
  • a liquid crystal TV as an example, it may have a liquid crystal display (Liquid Crystal Display, LCD), and the display layer may specifically be a combination of a TFT (Thin Film Transistor, thin film transistor) layer, a liquid crystal layer, and a filter layer.
  • TFT Thin Film Transistor, thin film transistor
  • the arrangement state of the liquid crystal molecules in the liquid crystal layer can be adjusted accurately, so as to distribute the corresponding light transmission for different pixels and filters of different colors in the filter layer.
  • the brightness of each pixel on different color channels can be adjusted, and the color effect corresponding to the output image signal can be displayed on the screen 101, so as to realize the corresponding display image output, so that on this basis, the graphical user interface 20 can be accurately displayed.
  • the screen 101 of the above-mentioned electronic device 100 may also only include a display layer, and the display layer may emit light by itself, so as to directly adjust the color effect displayed on the screen 101 under the control of the built-in processor of the electronic device 100, To achieve the corresponding display image output.
  • the display layer may emit light by itself, so as to directly adjust the color effect displayed on the screen 101 under the control of the built-in processor of the electronic device 100, To achieve the corresponding display image output.
  • OLED Organic Light Emitting Diodes, Organic Light Emitting Diodes
  • FIG. 2 is a schematic flowchart of a method for generating a shadow disclosed in an embodiment of the present application.
  • the shadow generation method may include the following steps:
  • the electronic device when the electronic device outputs and displays a graphical user interface through its screen, the graphical user interface may be provided with different controls, such as button controls, text box controls, etc., each control on the graphical user interface Both can be displayed in the form of view objects.
  • the electronic device may first obtain the outline data of the target control to be drawn.
  • the above-mentioned contour data may include contour shape (such as contour shape, contour size, etc.), contour attributes (such as whether the corresponding target control belongs to a container control, a non-container control, etc.) and the like.
  • contour shape such as contour shape, contour size, etc.
  • contour attributes such as whether the corresponding target control belongs to a container control, a non-container control, etc.
  • Figure 3 is a schematic diagram of a target control displayed on the graphical user interface disclosed in the embodiment of the application
  • Figure 4 is a schematic diagram of the target control displayed on the graphical user interface disclosed in the embodiment of the application Schematic diagram of another target control.
  • the target control 21a can be a non-container control (its corresponding view object does not contain or combine other view objects), and on the graphical user interface 20, the target control 21a can be displayed as a view object in the form of an icon, which
  • the profile shape can be a rounded rectangle.
  • the outline shape of the target control 21a may also be a circle, an ellipse, a triangle with rounded corners, and the like. In some other embodiments, as shown in FIG.
  • the target control 21b can be a container control (its corresponding view object can contain or combine other view objects 21a), and on the graphical user interface 20, the target control 21b can be displayed as
  • the outline shape of the view object in the form of a card can also be a rounded rectangle.
  • the electronic device can determine the outline range corresponding to the target control in a subsequent step, so that a shadow image can be further drawn outside the outline range to achieve a shadow effect.
  • the outline data determine a shadow drawing path corresponding to the target control outside the range of the outline corresponding to the target control.
  • the electronic device can call a brush object (such as realized by the Paint() class in the Android operating system) to draw according to a certain shadow drawing path (such as realized by the Path() class in the Android operating system) .
  • a brush object such as realized by the Paint() class in the Android operating system
  • a certain shadow drawing path such as realized by the Path() class in the Android operating system
  • the electronic device may determine the outline range corresponding to the target control based on the outline data, and then determine the shadow drawing path corresponding to the target control outside the outline range.
  • the electronic device may determine a shadow drawing path corresponding to the target control according to a shadow range parameter, wherein the shadow range parameter may be used to define a shadow drawing range including the shadow drawing path.
  • the shadow range parameters may include android:clipToPadding (used to determine whether the shadow drawing range is within the outline range corresponding to the target control), android:clipChildren (used to determine whether the shadow drawing range beyond the outline range corresponding to the parent control of the target control), etc.
  • the electronic device may determine a shadow drawing path corresponding to the target control according to a shadow effect parameter, wherein the shadow effect parameter may be used to define a shadow effect that can be achieved by the drawn shadow image.
  • the shadow effect parameters may at least include shadow color, shadow blur radius (used to characterize the shadow diffusion range), shadow offset parameters (used to characterize the degree of shifting of the shadow image on the X or Y axis), shadow circle Any one of the corner parameters (the size of the rounded corner, the radian, etc. used to characterize the shadow image) can usually include multiple kinds at the same time, which is not specifically limited in the embodiment of the present application.
  • the shadow drawing path draw a shadow image corresponding to the above-mentioned target control through a blur mask filter, where the shadow image is used to realize a shadow effect on the view object corresponding to the above-mentioned target control.
  • the above-mentioned blur mask filter (BlurMaskFilter) can be used to perform a certain Alpha filtering process on the drawn shadow image when the electronic device calls the brush object to draw the shadow image, thereby adjusting the transparency of the shadow image in different regions, realizing Different blur effects.
  • the electronic device after the electronic device determines the above-mentioned shadow drawing path, it can directly call the brush drawing effect interface BlurMaskFilter on the Android SDK, and reset the parameters or use the default parameters. , use this interface to draw the shadow image corresponding to the target control according to the above shadow drawing path, so that the corresponding shadow effect can be realized on the view object corresponding to the above target control through the shadow image.
  • the brush drawing effect interface BlurMaskFilter on the Android SDK
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI.
  • the shadow image of the target control can be drawn on the GUI.
  • realize controls with shadow effects improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI.
  • the embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, thereby effectively improving the convenience and efficiency of electronic devices in realizing shadow effects on GUIs.
  • FIG. 5 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application. As shown in Figure 5, the shadow generation method may include the following steps:
  • shape data includes a custom shape
  • determine the custom shape as the contour shape of the target control
  • determine a default shape as the contour shape of the target control
  • step 502 and step 504 are similar to the above step 202, that is, the outline data acquired by the electronic device may include outline shape.
  • the electronic device may acquire shape data corresponding to the target control to be drawn through the view outline interface, and then determine the outline shape of the target control according to the shape data.
  • the aforementioned contour shape may include contour shape, contour size, etc., so that the contour range corresponding to the target control can be uniquely and accurately determined.
  • the electronic device can directly call the interface ViewOutlineProvider on the Android SDK as the view outline interface to obtain the shape data corresponding to the target control to be drawn in the GUI.
  • the shape data acquired by the electronic device may include the custom shape (such as non-default rounded rectangle, circle, ellipse, rounded triangle, etc.); Otherwise, if the shape data acquired by the electronic device does not include a custom shape, the electronic device may also determine a default shape (usually a rounded rectangle of a certain size) as the outline shape of the target control.
  • the electronic device may use the above outline shape as the inner border of the shadow image corresponding to the target control in subsequent steps, so that the shadow drawing path corresponding to the target control may be determined outside the inner border, so as to further draw the shadow outside the inner border Image, to realize the shadow effect on the view object corresponding to the target control.
  • the electronic device before the electronic device determines the shadow drawing path corresponding to the target control, it can first define the shadow drawing range including the shadow drawing path based on the shadow range parameter, so as to ensure that the shadow is drawn under the condition of conforming to the shadow drawing range image.
  • the electronic device can obtain preset shadow range parameters (such as the above-mentioned android:clipToPadding, android:clipChildren, etc.), and then can use the above-mentioned outline shape as the inner border of the shadow image corresponding to the target control, and in the Outside the border, and within the shadow drawing range defined by the above shadow range parameter, determine the shadow drawing path corresponding to the target control.
  • preset shadow range parameters such as the above-mentioned android:clipToPadding, android:clipChildren, etc.
  • the shadow drawing range can exceed the area filled by the target control, that is, the outline shape of the target control As the inner border of the shadow image corresponding to the target control, draw the shadow image outside the inner border.
  • the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control, that is, the drawn shadow image will not be Contains the target control, the contour range cut corresponding to the parent control with a larger contour range, so that it can be extended as far as possible in the GUI to achieve rich and diverse shadow effects.
  • the shadow effect parameter at least includes any one of a shadow color, a shadow blur radius, a shadow offset parameter, and a shadow fillet parameter.
  • the above-mentioned shadow effect parameter may be used to define a shadow effect that can be realized by the electronic device for the shadow image drawn by the view object corresponding to the target control.
  • the electronic device can further determine the shadow drawing path corresponding to the target control in a subsequent step in combination with the outline shape of the target control and the shadow effect parameters, so as to draw a customized shadow image, which is beneficial to Improve the accuracy and flexibility of electronic devices to implement shadow effects on GUIs.
  • the above shadow color may be used to represent the range of the shadow image in the color gamut.
  • the shadow color may include a single color, or a mixed color, a gradient color (for example, the shadow image gradually changes from the center to the surrounding, from left to right, etc.), which is not specifically limited in this embodiment of the present application.
  • the shadow blur radius above can be used to characterize the shadow diffusion range, that is, the size of the shadow image itself (for example, the width from the inner border of the shadow image to the outer border), or the size of the shadow image relative to the outline range of the target control (for example, The ratio of the radius of this shadow image relative to the radius of the outline bounds of the target control).
  • the schematic diagrams of shadow effects from small to large shadow blur radii the black area represents the shadow image ).
  • the above-mentioned shadow offset parameter can be used to characterize the offset degree of the shadow image on the X or Y axis, that is, the offset degree of the shadow image relative to the view object of the target control in the horizontal axis direction or the vertical axis direction.
  • the above-mentioned shadow rounded corner parameters can be used to characterize the rounded corner size, radian, etc. of the shadow image, so that when the shadow image contains rounded corners (for example, the outline shape of the target control is a rounded rectangle, rounded triangle, etc.), it can be accurately determined.
  • Shape with rounded corners Take the contour shape of the target control as a rounded rectangle, and the shadow rounded corner parameters include the size of the rounded corners as an example, as shown in Figure 6C, from left to right (the numbers are a, b, c) in turn for the same target control
  • the diagram of the shadow effect from small to large shadow fillet parameters the black area represents the shadow image).
  • step 508 is similar to step 204 above. It should be noted that by combining the outline shape of the target control and the shadow effect parameters to determine the shadow drawing path, a customized shadow image can be drawn, thereby effectively improving the accuracy and accuracy of the shadow effect on the graphical user interface of the electronic device. flexibility.
  • step 510 is similar to the above-mentioned step 206 and will not be repeated here.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI.
  • the drawing of the shadow image can be completed quickly and simply by using the blur mask filter, which can effectively improve the convenience and efficiency of realizing the shadow effect on the graphical user interface of the electronic device.
  • the electronic device can draw a customized shadow image, which is conducive to improving the accuracy and flexibility of the shadow effect on the graphical user interface of the electronic device sex.
  • FIG. 7 is a schematic flowchart of another method for generating a shadow disclosed in an embodiment of the present application. As shown in Figure 7, the shadow generation method may include the following steps:
  • shape data includes a custom shape
  • determine the custom shape as the outline shape of the target control
  • determine a default shape as the outline shape of the target control
  • step 702 and step 704 are similar to the above step 502 and step 504, and will not be repeated here.
  • the shadow effect parameter at least includes any one of a shadow color, a shadow blur radius, a shadow offset parameter, and a shadow fillet parameter.
  • step 706 and step 708 are similar to the above step 506 and step 508, and will not be repeated here.
  • different electronic devices may be provided with different rendering pipeline platforms, such as OpenGL, SkiaGL, Skiavk, and the like.
  • rendering pipeline platforms such as OpenGL, SkiaGL, Skiavk, and the like.
  • the pure hardware rendering pipeline that is, only through the GPU (Graphics Processing Unit, graphics processor) to accelerate the rendering of shadow images
  • the above-mentioned blur mask filter will be invalid.
  • other compatible processing operations are required to realize the graphical user interface. Shadow effect on .
  • the non-hardware rendering pipeline that is, the situation that the shadow image can also be accelerated through the CPU (Central Processing Unit, central processing unit)
  • the above-mentioned blur mask filter can be used to draw the shadow image. Therefore, before the electronic device actually draws the shadow image, it can obtain the target rendering pipeline correspondingly supported by its GUI, so that the shadow image can be drawn by corresponding measures according to the type of the target rendering pipeline, so as to achieve the same shadow effect.
  • the aforementioned target rendering pipeline is a non-pure hardware rendering pipeline, draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path.
  • the electronic device when the electronic device determines that the target rendering pipeline supported by its graphical user interface is a non-pure hardware rendering pipeline (such as SkiaGL, Skiavk, etc.), it can directly call the The brush drawing effect interface BlurMaskFilter is used to use this interface to draw the shadow image corresponding to the target control according to the above shadow drawing path.
  • a non-pure hardware rendering pipeline such as SkiaGL, Skiavk, etc.
  • the electronic device uses the BlurMaskFilter interface, that is, draws the shadow image corresponding to the target control through the blur mask filter, it can realize different blur effects based on the different blur processing modes of the blur mask filter, so that in the above On the basis of customized shadow images, different shadow effects can be further realized.
  • the aforementioned blur processing modes may include NORMAL (inner and outer blurred drawing), SOLID (inner normal drawing, outer blurring), OUTER (inner no drawing, outer blurring), INNER (inner normal drawing, outer blurring), etc. . It can be understood that with different blur processing modes, due to the continuity of shadow diffusion, even if the area covered by the outline range of the target control in Figure 8 is removed, the shadow images drawn outside the outline range of the target control can still achieve different blur effect.
  • the electronic device may determine a blur processing mode of the blur mask filter according to the above shadow effect parameters, that is, the blur mask filter implements the above different modes of different blur effects.
  • the electronic device can draw the shadow image corresponding to the target control through the determined blur processing mode of the blur mask filter according to the above-mentioned shadow drawing path, so as to achieve different blur effects and improve the electronic device's graphics user experience. Realize the diversity of shadow effects on the interface.
  • target rendering pipeline is a pure hardware rendering pipeline, perform a compatible processing operation according to the shadow effect parameter, and draw a shadow image corresponding to the target control through the brush object.
  • the electronic device determines that the target rendering pipeline supported by its GUI is a pure hardware rendering pipeline (such as OpenGL, etc.), it can use other compatible processing operations to Achieves the same shadow effect as achieved by the blur mask filter above.
  • a pure hardware rendering pipeline such as OpenGL, etc.
  • the electronic device can force the use of software rendering to draw shadow images, and at this time, the electronic device can adjust the properties of the brush object according to the above-mentioned shadow effect parameters Parameters, and then can be drawn through the brush object.
  • the above attribute parameters can be used to define the drawing effect of the brush object.
  • the electronic device can adjust the shadow blur radius, shadow offset parameter, shadow color, etc. of the shadow image drawn by the brush object through the setShadowLayer interface, so as to obtain a brush object with a customized drawing effect.
  • the shadow drawing range for the brush object to draw the shadow image may be determined according to the above shadow effect parameters, that is, the boundary of the shadow image is drawn first. On this basis, the electronic device can directly invoke the brush object to draw a shadow image within the shadow drawing range (ie, within the above-mentioned boundary), so as to realize the shadow effect on the GUI.
  • step 714 can be executed after the above step 710, that is, the above step 712 and this step 714 can be implemented in parallel, so as to be compatible with different rendering pipeline platforms set by different electronic devices.
  • the electronic device may respectively draw the foreground and background images compatible with the shadow graphic adaptation, so as to realize a complete drawing process of the target control.
  • the electronic device may draw a background image matching the above shadow image based on the outline data of the target control.
  • the background image can be defined through the attribute of the background variable.
  • the electronic device can first obtain the background image resource, that is, point the above-mentioned background variable to the preset image resource, and then preprocess the background image resource according to the above-mentioned outline data to obtain the process of matching the outline range corresponding to the target control Image resource.
  • the background image resource can usually be stored in the form of a bitmap (BitmapDrawable). After the electronic device obtains the background image resource in the form of a bitmap, it can be converted into Handle image resources in the form of rounded bitmaps (RoundBitmapDrawable).
  • the electronic device can draw a background image that matches the above shadow image through the brush object according to the image type of the above processing image resource.
  • the image type of the above-mentioned processing image resource may also include a solid color image (ColorDrawable), a gradient color image (GradientDrawable), and the like.
  • the electronic device can obtain its corresponding attribute information (such as fillet size, radian, RGB color value, etc.), and then call a brush object to draw a background image that matches the above shadow image.
  • the background image may match the outline size of the shadow image, or may be slightly larger than the shadow image, which is not specifically limited in this embodiment of the present application.
  • the electronic device may also draw a foreground image matching the shadow image within the contour range corresponding to the target control based on the contour data of the target control.
  • the foreground image can be defined through the attribute of the foreground variable. It can be understood that the foreground image can completely match the outline range of the target control, so as to form a complete view object corresponding to the target control with the above shadow image and background image.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI.
  • FIG. 9 is a schematic modular diagram of a shadow generating device disclosed in an embodiment of the present application.
  • the shadow generation device may include contour acquisition 901, path determination 902, and shadow drawing unit 903, wherein:
  • an outline acquisition unit 901, configured to acquire outline data of the target control to be drawn in the GUI
  • a path determining unit 902 configured to determine a shadow drawing path corresponding to the target control outside the contour range corresponding to the target control according to the contour data;
  • the shadow drawing unit 903 is configured to draw the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path, and the shadow image is used to realize the shadow effect on the view object corresponding to the target control.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that it can draw the target control on the GUI.
  • Realize controls with shadow effects improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI.
  • the embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, thereby effectively improving the convenience and efficiency of electronic devices in realizing shadow effects on GUIs.
  • the above-mentioned contour data may include a contour shape
  • the above-mentioned path determination 902 may be specifically used to use the contour shape as an inner frame of a shadow image corresponding to the target control, and determine a shadow drawing path corresponding to the target control outside the inner frame.
  • the above-mentioned outline acquisition unit 901 can be specifically configured to acquire the shape data corresponding to the target control to be drawn in the graphical user interface through the view outline interface;
  • the contour acquisition unit 901 may determine the custom shape as the contour shape of the target control; if the shape data does not include a custom shape, the contour acquisition unit 901 may determine the default shape as the contour of the target control shape.
  • the path determination unit 902 may specifically include a parameter acquisition subunit and a path determination subunit not shown in the figure, wherein:
  • the parameter acquisition subunit is used to obtain the shadow range parameter, which is used to define the shadow drawing range, and the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control;
  • the path determination subunit is used to determine the shadow drawing path corresponding to the target control by using the outline shape as the inner border of the shadow image corresponding to the target control, outside the inner border, and within the shadow drawing range defined by the shadow range parameter.
  • the shadow generation device may further include a first acquisition unit not shown in the figure, and the first acquisition unit may be used to acquire shadow effect parameters, the shadow effect parameters at least include shadow color, shadow blur radius, shadow offset Any one of the shift parameter and the shadow fillet parameter;
  • the above-mentioned path determination unit 902 may specifically be configured to determine a shadow drawing path corresponding to the target control outside the contour range corresponding to the target control according to the contour data and the shadow effect parameters.
  • the shadow drawing unit 903 may include a mode determination subunit and a drawing subunit not shown, wherein:
  • the mode determination subunit is used to determine the blur processing mode of the blur mask filter according to the shadow effect parameter, and the blur processing mode refers to the mode in which the blur mask filter realizes the blur effect;
  • the drawing subunit is used to draw the path according to the shadow, and draw the shadow image corresponding to the target control through the blur processing mode of the blur mask filter.
  • the electronic device can draw a customized shadow image, which is beneficial to improve the graphics performance of the electronic device. Accuracy and flexibility in implementing shadow effects on the user interface.
  • different blur processing modes of the blur mask filter different blur effects can be achieved, so that on the basis of the above-mentioned customized shadow image, different shadow effects can be further realized, and the electronic device can realize shadows on the graphical user interface. Variety of effects.
  • the shadow generation device may further include a second acquisition unit not shown, the second acquisition unit is used to draw the above-mentioned target through the blur mask filter according to the shadow drawing path in the above-mentioned shadow drawing unit 903 Get the target rendering pipeline corresponding to the GUI before the shadow image corresponding to the control;
  • the above-mentioned shadow drawing unit 903 can specifically be used to draw the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path when the target rendering pipeline is not a pure hardware rendering pipeline.
  • the shadow generating device may further include a compatible unit not shown, and the compatible unit may be used to perform compatible processing operations according to shadow effect parameters when the above-mentioned target rendering pipeline is a pure hardware rendering pipeline, And draw the shadow image corresponding to the target control through the brush object;
  • compatible processing operations include:
  • the shadow generation device may also include a not-shown foreground and background drawing unit, which may be used to draw the above-mentioned shadow through the blur mask filter according to the shadow drawing path in the shadow drawing unit 903.
  • a not-shown foreground and background drawing unit may be used to draw the above-mentioned shadow through the blur mask filter according to the shadow drawing path in the shadow drawing unit 903.
  • the foreground and background drawing unit when the foreground and background drawing unit draws the background image matching the shadow image according to the outline data, it may specifically include the following steps:
  • a background image matching the shadow image is drawn through the brush object.
  • the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that it can draw the target control on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI.
  • the drawing of the shadow image can be completed quickly and simply by using the blur mask filter, which can effectively improve the convenience and efficiency of realizing the shadow effect on the graphical user interface of the electronic device.
  • the complete drawing process of the target control can be conveniently realized, so that the card layout with shadow effect can be realized on the graphical user interface of the electronic device, and unified shadow visual effect.
  • FIG. 10 is a schematic modular diagram of an electronic device disclosed in an embodiment of the present application.
  • the electronic equipment may include:
  • a memory 1001 storing executable program codes
  • processor 1002 coupled to the memory 1001;
  • the processor 1002 invokes the executable program code stored in the memory 1001 to execute all or part of the steps in any shadow generating method described in the above-mentioned embodiments.
  • the embodiment of the present application further discloses a computer-readable storage medium, which stores a computer program for electronic data exchange, wherein the computer program enables the computer to execute any shadow generation method described in the above-mentioned embodiments. all or part of the steps.
  • the embodiments of the present application further disclose a computer program product.
  • the computer program product When the computer program product is run on a computer, the computer can execute all or part of the steps in any shadow generation method described in the above embodiments.
  • ROM read-only Memory
  • RAM random access memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read Only Memory
  • OTPROM One-time Programmable Read-Only Memory
  • EEPROM Electronically Erasable Programmable Read-Only Memory
  • CD-ROM Compact Disc Read-Only Memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Image Generation (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

A shadow generation method and apparatus, an electronic device, and a storage medium. The method may comprise: acquiring, in a graphical user interface (GUI), contour data of a target control to be drawn; according to the contour data, determining, outside of a contour range corresponding to the target control, a shadow drawing path corresponding to the target control; and according to the shadow drawing path, drawing a shadow image corresponding to the target control by means of a blur mask filter, the shadow image being used to achieve a shadow effect on a view object corresponding to the target control. The implementation of embodiments of the present application may improve the convenience and efficiency of achieving a shadow effect on a GUI of an electronic device.

Description

阴影生成方法及装置、电子设备、存储介质Shadow generation method and device, electronic device, storage medium
本申请要求于2021年9月7日提交、申请号为202111044692.6、发明名称为“阴影生成方法及装置、电子设备、存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on September 7, 2021 with the application number 202111044692.6 and the title of the invention is "shadow generation method and device, electronic equipment, storage medium", the entire content of which is incorporated by reference in this application middle.
技术领域technical field
本申请涉及图形用户界面技术领域,尤其涉及一种阴影生成方法及装置、电子设备、存储介质。The present application relates to the technical field of graphical user interface, and in particular to a method and device for generating a shadow, electronic equipment, and a storage medium.
背景技术Background technique
当前,电子设备(如智能手机、电脑、电视等)在通过其屏幕进行输出显示时,通常会根据其GUI(Graphical User Interface,图形用户界面)的不同设置而呈现不同的显示效果。然而,在实践中发现,在实现阴影效果时,电子设备所需要进行的绘制过程往往较为繁杂,从而降低了电子设备在图形用户界面上实现阴影效果的便捷性和效率。At present, when an electronic device (such as a smart phone, a computer, a television, etc.) outputs and displays through its screen, it usually presents different display effects according to different settings of its GUI (Graphical User Interface, Graphical User Interface). However, in practice, it is found that when realizing the shadow effect, the drawing process required by the electronic device is often complicated, which reduces the convenience and efficiency of the electronic device to realize the shadow effect on the GUI.
发明内容Contents of the invention
本申请实施例公开了一种阴影生成方法及装置、电子设备、存储介质,能够提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。The embodiment of the present application discloses a method and device for generating a shadow, an electronic device, and a storage medium, which can improve the convenience and efficiency of realizing a shadow effect on a graphical user interface of the electronic device.
本申请实施例第一方面公开一种阴影生成方法,包括:The first aspect of the embodiment of the present application discloses a shadow generation method, including:
获取图形用户界面中待绘制的目标控件的轮廓数据;Obtain the outline data of the target control to be drawn in the GUI;
根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径;According to the outline data, determine a shadow drawing path corresponding to the target control outside the outline range corresponding to the target control;
按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像,所述阴影图像用于在所述目标控件对应的视图对象上实现阴影效果。According to the shadow drawing path, a shadow image corresponding to the target control is drawn through a blur mask filter, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
本申请实施例第二方面公开一种阴影生成装置,包括:The second aspect of the embodiment of the present application discloses a shadow generation device, including:
轮廓获取单元,用于获取图形用户界面中待绘制的目标控件的轮廓数据;an outline acquiring unit, configured to acquire outline data of the target control to be drawn in the graphical user interface;
路径确定单元,用于根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径;a path determining unit, configured to determine a shadow drawing path corresponding to the target control outside the range of the contour corresponding to the target control according to the contour data;
阴影绘制单元,用于按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像,所述阴影图像用于在所述目标控件对应的视图对象上实现阴影效果。The shadow drawing unit is configured to draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
本申请实施例第三方面公开了一种电子设备,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如本申请实施例第一方面公开的任意一种阴影生成方法中的全部或部分步骤。The third aspect of the embodiment of the present application discloses an electronic device, including a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor realizes the All or part of the steps in any shadow generating method disclosed in the first aspect of the embodiment.
本申请实施例第四方面公开了一种计算机可读存储介质,其存储计算机程序,其中,所述计算机程序被处理器执行时实现如本申请实施例第一方面公开的任意一种阴影生成方法中的全部或部分步骤。The fourth aspect of the embodiment of the present application discloses a computer-readable storage medium, which stores a computer program, wherein, when the computer program is executed by a processor, any shadow generation method as disclosed in the first aspect of the embodiment of the present application is implemented All or some of the steps in .
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和有益效果将从说明书、附图以及权利要求书中体现。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features and beneficial effects of the present application will appear from the description, drawings and claims.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图 进行简单的介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings that need to be used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1是本申请实施例公开的一种阴影生成方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a shadow generation method disclosed in an embodiment of the present application;
图2是本申请实施例公开的一种阴影生成方法的流程示意图;Fig. 2 is a schematic flowchart of a shadow generation method disclosed in the embodiment of the present application;
图3是本申请实施例公开的在图形用户界面上显示的一种目标控件的示意图;FIG. 3 is a schematic diagram of a target control displayed on a graphical user interface disclosed in an embodiment of the present application;
图4是本申请实施例公开的在图形用户界面上显示的另一种目标控件的示意图;FIG. 4 is a schematic diagram of another target control displayed on a graphical user interface disclosed in an embodiment of the present application;
图5是本申请实施例公开的另一种阴影生成方法的流程示意图;Fig. 5 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application;
图6A是本申请实施例公开的一种目标控件对应的视图对象上所实现的阴影效果示意图;FIG. 6A is a schematic diagram of a shadow effect implemented on a view object corresponding to a target control disclosed in an embodiment of the present application;
图6B是本申请实施例公开的另一种目标控件对应的视图对象上所实现的阴影效果示意图;FIG. 6B is a schematic diagram of a shadow effect implemented on a view object corresponding to another target control disclosed in the embodiment of the present application;
图6C是本申请实施例公开的又一种目标控件对应的视图对象上所实现的阴影效果示意图;FIG. 6C is a schematic diagram of a shadow effect implemented on a view object corresponding to another target control disclosed in the embodiment of the present application;
图7是本申请实施例公开的又一种阴影生成方法的流程示意图;Fig. 7 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application;
图8是本申请实施例公开的模糊遮罩滤镜的不同模糊处理模式的示意图;Fig. 8 is a schematic diagram of different blur processing modes of the blur mask filter disclosed in the embodiment of the present application;
图9是本申请实施例公开的一种阴影生成装置的模块化示意图;Fig. 9 is a schematic modular diagram of a shadow generating device disclosed in an embodiment of the present application;
图10是本申请实施例公开的一种电子设备的模块化示意图。Fig. 10 is a schematic modular diagram of an electronic device disclosed in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
需要说明的是,本申请实施例的术语“包括”和“具有”及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present application are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or process that includes a series of steps or units. The apparatus is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to the process, method, product or apparatus.
本申请实施例公开了一种阴影生成方法及装置、电子设备、存储介质,能够提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。The embodiment of the present application discloses a method and device for generating a shadow, an electronic device, and a storage medium, which can improve the convenience and efficiency of realizing a shadow effect on a graphical user interface of the electronic device.
以下将结合附图进行详细描述。A detailed description will be given below in conjunction with the accompanying drawings.
请参阅图1,图1是本申请实施例公开的一种阴影生成方法的应用场景示意图。如图1所示,电子设备100可以包括屏幕101,该屏幕101上可以输出显示有图形用户界面(Graphical User Interface,GUI)20,用户可以通过该图形用户界面20获取电子设备100输出的图像、文字等信息,同时可以通过该图形用户界面20来实现对电子设备100的控制。示例性地,该图形用户界面20上可以设置有不同的控件21,例如按钮控件、文本框控件等,每个控件21在该图形用户界面20上均可以视图(View)对象的形式显示,用户可以通过与选定的视图对象进行交互(例如点击按钮、向文本框输入文字等),以调用相应的控件21所封装的数据或方法,从而实现对电子设备100的控制。Please refer to FIG. 1 . FIG. 1 is a schematic diagram of an application scenario of a shadow generation method disclosed in an embodiment of the present application. As shown in FIG. 1 , the electronic device 100 may include a screen 101, on which a graphical user interface (Graphical User Interface, GUI) 20 may be output and displayed, and the user may obtain an image output by the electronic device 100 through the graphical user interface 20, Text and other information, and at the same time, the control of the electronic device 100 can be realized through the graphical user interface 20 . Exemplarily, the graphical user interface 20 can be provided with different controls 21, such as button controls, text box controls, etc., and each control 21 can be displayed in the form of a view (View) object on the graphical user interface 20, and the user The electronic device 100 can be controlled by interacting with the selected view object (such as clicking a button, inputting text into a text box, etc.) to call the data or method encapsulated by the corresponding control 21 .
需要说明的是,电子设备100在通过其屏幕101进行输出显示时,通常会根据其图形用户界面20的不同设置而呈现不同的显示效果。其中,对于该图形用户界面20上设有的控件21,可以在控件21对应的视图对象上实现各种不同的阴影效果,以提升视图对象的立体感 和层次感,优化图形用户界面20的视觉表达效果。It should be noted that, when the electronic device 100 performs output display through its screen 101 , it usually presents different display effects according to different settings of its graphical user interface 20 . Wherein, for the controls 21 provided on the GUI 20, various shadow effects can be realized on the view objects corresponding to the controls 21, so as to enhance the three-dimensionality and layering of the view objects and optimize the visual effect of the GUI 20. Expressive effect.
在本申请实施例中,为了在图形用户界面20上实现控件21对应的阴影效果,电子设备100可以获取该图形用户界面20中待绘制的目标控件21的轮廓数据,并根据该轮廓数据,在目标控件21对应的轮廓范围外确定该目标控件对应的阴影绘制路径。在此基础上,电子设备100可以按照上述阴影绘制路径,通过模糊遮罩滤镜(BlurMaskFilter)绘制该目标控件21对应的阴影图像,该阴影图像即用于在上述目标控件21对应的视图对象上实现阴影效果。可见,实施本申请实施例,电子设备100能够在对图形用户界面20上的目标控件21进行绘制时,基于模糊遮罩滤镜绘制该目标控件21的阴影图像,从而可以在图形用户界面20上实现具有阴影效果的控件21。相较于相关技术中在实现阴影效果时,往往需要根据控件大小分别绘制四边和圆角的阴影,整体绘制过程较为复杂,本申请实施例能够通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,从而能够有效提升电子设备100在图形用户界面20上实现阴影效果的便捷性和效率。In the embodiment of the present application, in order to realize the shadow effect corresponding to the control 21 on the GUI 20, the electronic device 100 can obtain the outline data of the target control 21 to be drawn in the GUI 20, and according to the outline data, in the The shadow drawing path corresponding to the target control is determined outside the outline range corresponding to the target control 21 . On this basis, the electronic device 100 can draw the shadow image corresponding to the target control 21 through the blur mask filter (BlurMaskFilter) according to the above-mentioned shadow drawing path, and the shadow image is used on the view object corresponding to the above-mentioned target control 21 Realize the shadow effect. It can be seen that, implementing the embodiment of the present application, when the electronic device 100 draws the target control 21 on the GUI 20, it can draw the shadow image of the target control 21 based on the blur mask filter, so that it can draw the target control 21 on the GUI 20. Implement a control 21 with a shadow effect. Compared with the shadow effect in the related art, it is often necessary to draw shadows with four sides and rounded corners according to the size of the control, and the overall drawing process is more complicated. The embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, so as to effectively improve the convenience and efficiency of the electronic device 100 in realizing the shadow effect on the GUI 20 .
其中,上述电子设备100可以包括具备屏幕显示功能的各类设备或系统,如手机、智能可穿戴设备、车载终端、平板电脑、PC(Personal Computer,个人电脑)、PDA(Personal Digital Assistant,个人数字助理)、电视等,本申请实施例中不作具体限定。进一步地,该电子设备100可以搭载有操作系统,如安卓(Android)操作系统、iOS操作系统、塞班(Symbian)操作系统、Windows操作系统等,本申请实施例中均以安卓操作系统为例。可以理解,图1所示的电子设备100为电视,这仅仅是一种示例,不应被视为对本申请实施例中电子设备100的设备类型的限制。Among them, the above-mentioned electronic device 100 may include various devices or systems with screen display functions, such as mobile phones, smart wearable devices, vehicle-mounted terminals, tablet computers, PCs (Personal Computers, personal computers), PDAs (Personal Digital Assistants, personal digital Assistant), TV, etc., which are not specifically limited in this embodiment of the present application. Further, the electronic device 100 may be equipped with an operating system, such as an Android operating system, an iOS operating system, a Symbian operating system, a Windows operating system, etc. In the embodiments of the present application, the Android operating system is used as an example . It can be understood that the electronic device 100 shown in FIG. 1 is a TV, which is only an example and should not be regarded as a limitation on the type of the electronic device 100 in the embodiment of the present application.
示例性地,电子设备100的屏幕101可以包括未图示的背光层以及显示层,该背光层可以用于发出白色背光,该显示层则可以用于根据上述输出图像信号调整不同像素点的滤光颜色及滤光程度,以对上述白色背光进行滤光,实现不同颜色、不同亮度的彩色输出。以液晶电视为例,其可以具有液晶显示屏(Liquid Crystal Display,LCD),则上述显示层具体可以为TFT(Thin Film Transistor,薄膜晶体管)层、液晶层以及滤光片层的组合。通过液晶电视内置的处理器控制TFT层上的电压信号,可以准确地调整液晶层中液晶分子的排列状态,以针对滤光片层中不同像素点、不同颜色的滤光片分配相应的透光量,进而可以调整每个像素点在不同颜色通道上的亮度,在屏幕101上表现输出图像信号对应的色彩效果,实现相应的显示图像输出,从而可以在此基础上,精确展示图形用户界面20中各个控件21对应的阴影效果。Exemplarily, the screen 101 of the electronic device 100 may include a backlight layer and a display layer not shown in the figure. The backlight layer may be used to emit a white backlight, and the display layer may be used to adjust the filters of different pixels according to the above-mentioned output image signal. The color of the light and the degree of filtering are used to filter the above-mentioned white backlight to achieve color output of different colors and different brightnesses. Taking a liquid crystal TV as an example, it may have a liquid crystal display (Liquid Crystal Display, LCD), and the display layer may specifically be a combination of a TFT (Thin Film Transistor, thin film transistor) layer, a liquid crystal layer, and a filter layer. By controlling the voltage signal on the TFT layer through the built-in processor of the LCD TV, the arrangement state of the liquid crystal molecules in the liquid crystal layer can be adjusted accurately, so as to distribute the corresponding light transmission for different pixels and filters of different colors in the filter layer. In this way, the brightness of each pixel on different color channels can be adjusted, and the color effect corresponding to the output image signal can be displayed on the screen 101, so as to realize the corresponding display image output, so that on this basis, the graphical user interface 20 can be accurately displayed. The shadow effect corresponding to each control 21 in .
可选地,上述电子设备100的屏幕101也可以仅包括显示层,该显示层可以自发光,以在电子设备100内置的处理器的控制下,直接对屏幕101所表现的色彩效果进行调整,以实现相应的显示图像输出。示例性地,以OLED(Organic Light Emitting Diodes,有机发光二极管)电视为例,其可以具有OLED显示屏,则上述显示层具体可以为OLED层。Optionally, the screen 101 of the above-mentioned electronic device 100 may also only include a display layer, and the display layer may emit light by itself, so as to directly adjust the color effect displayed on the screen 101 under the control of the built-in processor of the electronic device 100, To achieve the corresponding display image output. Exemplarily, taking an OLED (Organic Light Emitting Diodes, Organic Light Emitting Diodes) TV as an example, it may have an OLED display screen, and the above-mentioned display layer may specifically be an OLED layer.
请参阅图2,图2是本申请实施例公开的一种阴影生成方法的流程示意图。如图2所示,该阴影生成方法可以包括以下步骤:Please refer to FIG. 2 . FIG. 2 is a schematic flowchart of a method for generating a shadow disclosed in an embodiment of the present application. As shown in Figure 2, the shadow generation method may include the following steps:
202、获取图形用户界面中待绘制的目标控件的轮廓数据。202. Acquire outline data of a target control to be drawn in a graphical user interface.
在本申请实施例中,电子设备在通过其屏幕输出显示图形用户界面时,该图形用户界面上可以设置有不同的控件,例如按钮控件、文本框控件等,每个控件在该图形用户界面上均可以视图对象的形式显示。在此基础上,为了在该图形用户界面上实现阴影效果(具体是在各个控件对应的视图对象上实现阴影效果),电子设备可以先获取待绘制的目标控件的轮廓数据。In the embodiment of the present application, when the electronic device outputs and displays a graphical user interface through its screen, the graphical user interface may be provided with different controls, such as button controls, text box controls, etc., each control on the graphical user interface Both can be displayed in the form of view objects. On this basis, in order to realize the shadow effect on the GUI (specifically, realize the shadow effect on the view objects corresponding to each control), the electronic device may first obtain the outline data of the target control to be drawn.
示例性地,上述轮廓数据可以包括轮廓形状(例如轮廓外形、轮廓大小等)、轮廓属性 (例如相应的目标控件属于容器控件、非容器控件等)等。请一并参阅图3及图4,图3是本申请实施例公开的在图形用户界面上显示的一种目标控件的示意图,图4则是本申请实施例公开的在图形用户界面上显示的另一种目标控件的示意图。如图3所示,目标控件21a可以为非容器控件(其对应的视图对象不包含或组合其它视图对象),在图形用户界面20上,该目标控件21a可以显示为图标形式的视图对象,其轮廓外形可以为圆角矩形。在一些实施例中,目标控件21a的轮廓外形也可以为圆形、椭圆形、圆角三角形等。在另一些实施例中,如图4所示,目标控件21b可以为容器控件(其对应的视图对象可包含或组合其它视图对象21a),在图形用户界面20上,该目标控件21b可以显示为卡片形式的视图对象,其轮廓外形也同样可以为圆角矩形。Exemplarily, the above-mentioned contour data may include contour shape (such as contour shape, contour size, etc.), contour attributes (such as whether the corresponding target control belongs to a container control, a non-container control, etc.) and the like. Please refer to Figure 3 and Figure 4 together, Figure 3 is a schematic diagram of a target control displayed on the graphical user interface disclosed in the embodiment of the application, and Figure 4 is a schematic diagram of the target control displayed on the graphical user interface disclosed in the embodiment of the application Schematic diagram of another target control. As shown in Figure 3, the target control 21a can be a non-container control (its corresponding view object does not contain or combine other view objects), and on the graphical user interface 20, the target control 21a can be displayed as a view object in the form of an icon, which The profile shape can be a rounded rectangle. In some embodiments, the outline shape of the target control 21a may also be a circle, an ellipse, a triangle with rounded corners, and the like. In some other embodiments, as shown in FIG. 4, the target control 21b can be a container control (its corresponding view object can contain or combine other view objects 21a), and on the graphical user interface 20, the target control 21b can be displayed as The outline shape of the view object in the form of a card can also be a rounded rectangle.
在此基础上,基于所获取的上述轮廓数据,电子设备可以在后续步骤中确定该目标控件对应的轮廓范围,从而可以在该轮廓范围外进一步绘制阴影图像,实现阴影效果。On this basis, based on the above acquired outline data, the electronic device can determine the outline range corresponding to the target control in a subsequent step, so that a shadow image can be further drawn outside the outline range to achieve a shadow effect.
204、根据该轮廓数据,在上述目标控件对应的轮廓范围外确定该目标控件对应的阴影绘制路径。204. According to the outline data, determine a shadow drawing path corresponding to the target control outside the range of the outline corresponding to the target control.
在本申请实施例中,由于目标控件对应的视图对象在图形用户界面上占有一定面积,即覆盖一定区域的像素点,故用于实现其阴影效果的阴影图像在该目标控件对应的轮廓范围外也覆盖一定区域的像素点。为了得到上述阴影图像,电子设备可以调用画笔对象(例如在安卓操作系统中通过Paint()类来实现)按照一定的阴影绘制路径(例如在安卓操作系统中通过Path()类来实现)进行绘制。In the embodiment of this application, since the view object corresponding to the target control occupies a certain area on the GUI, that is, covers a certain area of pixels, the shadow image used to realize its shadow effect is outside the outline range corresponding to the target control It also covers pixels in a certain area. In order to obtain the above-mentioned shadow image, the electronic device can call a brush object (such as realized by the Paint() class in the Android operating system) to draw according to a certain shadow drawing path (such as realized by the Path() class in the Android operating system) .
示例性地,电子设备在获取上述轮廓数据之后,可以基于该轮廓数据确定目标控件对应的轮廓范围,进而可以在该轮廓范围外确定该目标控件对应的阴影绘制路径。Exemplarily, after acquiring the outline data, the electronic device may determine the outline range corresponding to the target control based on the outline data, and then determine the shadow drawing path corresponding to the target control outside the outline range.
在一些实施例中,电子设备可以根据阴影范围参数来确定该目标控件对应的阴影绘制路径,其中,该阴影范围参数可以用于定义包含阴影绘制路径的阴影绘制范围。示例性地,仍以安卓操作系统为例,该阴影范围参数可以包括android:clipToPadding(用于确定阴影绘制范围是否在目标控件对应的轮廓范围内)、android:clipChildren(用于确定阴影绘制范围是否超出目标控件的父控件对应的轮廓范围)等。In some embodiments, the electronic device may determine a shadow drawing path corresponding to the target control according to a shadow range parameter, wherein the shadow range parameter may be used to define a shadow drawing range including the shadow drawing path. Exemplarily, still taking the Android operating system as an example, the shadow range parameters may include android:clipToPadding (used to determine whether the shadow drawing range is within the outline range corresponding to the target control), android:clipChildren (used to determine whether the shadow drawing range beyond the outline range corresponding to the parent control of the target control), etc.
在另一些实施例中,电子设备可以根据阴影效果参数来确定该目标控件对应的阴影绘制路径,其中,该阴影效果参数可以用于定义所绘制的阴影图像可实现的阴影效果。示例性地,该阴影效果参数至少可以包括阴影颜色、阴影模糊半径(用于表征阴影扩散范围)、阴影偏移参数(用于表征阴影图像在X或Y轴上偏移的程度)、阴影圆角参数(用于表征阴影图像的圆角大小、弧度等)中的任意一种,通常也可以同时包括多种,本申请实施例中不作具体限定。In some other embodiments, the electronic device may determine a shadow drawing path corresponding to the target control according to a shadow effect parameter, wherein the shadow effect parameter may be used to define a shadow effect that can be achieved by the drawn shadow image. Exemplarily, the shadow effect parameters may at least include shadow color, shadow blur radius (used to characterize the shadow diffusion range), shadow offset parameters (used to characterize the degree of shifting of the shadow image on the X or Y axis), shadow circle Any one of the corner parameters (the size of the rounded corner, the radian, etc. used to characterize the shadow image) can usually include multiple kinds at the same time, which is not specifically limited in the embodiment of the present application.
206、按照该阴影绘制路径,通过模糊遮罩滤镜绘制上述目标控件对应的阴影图像,该阴影图像用于在上述目标控件对应的视图对象上实现阴影效果。206. According to the shadow drawing path, draw a shadow image corresponding to the above-mentioned target control through a blur mask filter, where the shadow image is used to realize a shadow effect on the view object corresponding to the above-mentioned target control.
其中,上述模糊遮罩滤镜(BlurMaskFilter),可以用于在电子设备调用画笔对象绘制阴影图像时,对其绘制的阴影图像进行一定的Alpha过滤处理,从而调整阴影图像在不同区域的透明度,实现不同的模糊效果。Among them, the above-mentioned blur mask filter (BlurMaskFilter) can be used to perform a certain Alpha filtering process on the drawn shadow image when the electronic device calls the brush object to draw the shadow image, thereby adjusting the transparency of the shadow image in different regions, realizing Different blur effects.
在本申请实施例中,以安卓操作系统为例,电子设备在确定出上述阴影绘制路径之后,可以直接调用Android SDK上的画笔绘制效果接口BlurMaskFilter,并在重设参数或采用默认参数的情况下,利用该接口按照上述阴影绘制路径绘制得到目标控件对应的阴影图像,从而可以通过该阴影图像在上述目标控件对应的视图对象上实现相应的阴影效果。In the embodiment of this application, taking the Android operating system as an example, after the electronic device determines the above-mentioned shadow drawing path, it can directly call the brush drawing effect interface BlurMaskFilter on the Android SDK, and reset the parameters or use the default parameters. , use this interface to draw the shadow image corresponding to the target control according to the above shadow drawing path, so that the corresponding shadow effect can be realized on the view object corresponding to the above target control through the shadow image.
可见,实施上述实施例所描述的阴影生成方法,电子设备能够在对图形用户界面上的目标控件进行绘制时,基于模糊遮罩滤镜绘制该目标控件的阴影图像,从而可以在图形用户界面上实现具有阴影效果的控件,提升视图对象的立体感和层次感,优化图形用户界面 的视觉表达效果。相较于相关技术中在实现阴影效果时,往往需要根据控件大小分别绘制四边和圆角的阴影,整体绘制过程较为复杂,本申请实施例能够通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,从而能够有效提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。It can be seen that, by implementing the shadow generation method described in the above embodiments, the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI. Compared with the shadow effect in the related art, it is often necessary to draw shadows with four sides and rounded corners according to the size of the control, and the overall drawing process is more complicated. The embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, thereby effectively improving the convenience and efficiency of electronic devices in realizing shadow effects on GUIs.
请参阅图5,图5是本申请实施例公开的另一种阴影生成方法的流程示意图。如图5所示,该阴影生成方法可以包括以下步骤:Please refer to FIG. 5 . FIG. 5 is a schematic flowchart of another shadow generation method disclosed in the embodiment of the present application. As shown in Figure 5, the shadow generation method may include the following steps:
502、通过视图轮廓接口获取图形用户界面中待绘制的目标控件对应的形状数据。502. Acquire shape data corresponding to the target control to be drawn in the GUI through the view outline interface.
504、若形状数据包括自定义形状,则将该自定义形状确定为目标控件的轮廓形状,若形状数据不包括自定义形状,则将默认形状确定为目标控件的轮廓形状。504. If the shape data includes a custom shape, determine the custom shape as the contour shape of the target control, and if the shape data does not include the custom shape, determine a default shape as the contour shape of the target control.
其中,步骤502以及步骤504与上述步骤202类似,即电子设备所获取的轮廓数据可以包括轮廓形状。可选的,电子设备可以通过视图轮廓接口获取待绘制的目标控件对应的形状数据,进而可以根据该形状数据确定该目标控件的轮廓形状。需要说明的是,上述轮廓形状可以包括轮廓外形、轮廓大小等,从而可以唯一、准确地确定出目标控件对应的轮廓范围。Wherein, step 502 and step 504 are similar to the above step 202, that is, the outline data acquired by the electronic device may include outline shape. Optionally, the electronic device may acquire shape data corresponding to the target control to be drawn through the view outline interface, and then determine the outline shape of the target control according to the shape data. It should be noted that the aforementioned contour shape may include contour shape, contour size, etc., so that the contour range corresponding to the target control can be uniquely and accurately determined.
在本申请实施例中,以安卓操作系统为例,电子设备可以直接调用Android SDK上的接口ViewOutlineProvider作为视图轮廓接口,以获取图形用户界面中待绘制的目标控件对应的形状数据。在此基础上,若目标控件自定义了其轮廓形状,则电子设备所获取的形状数据可以包括该自定义形状(如非默认的圆角矩形、圆形、椭圆形、圆角三角形等);否则,在电子设备所获取的形状数据不包括自定义形状的情况下,该电子设备也可以将默认形状(通常为一定大小的圆角矩形)确定为目标控件的轮廓形状。In this embodiment of the application, taking the Android operating system as an example, the electronic device can directly call the interface ViewOutlineProvider on the Android SDK as the view outline interface to obtain the shape data corresponding to the target control to be drawn in the GUI. On this basis, if the target control defines its outline shape, the shape data acquired by the electronic device may include the custom shape (such as non-default rounded rectangle, circle, ellipse, rounded triangle, etc.); Otherwise, if the shape data acquired by the electronic device does not include a custom shape, the electronic device may also determine a default shape (usually a rounded rectangle of a certain size) as the outline shape of the target control.
进一步地,电子设备可以在后续步骤中将上述轮廓形状作为目标控件对应的阴影图像的内边框,从而可以在该内边框外确定目标控件对应的阴影绘制路径,以在该内边框外进一步绘制阴影图像,实现该目标控件对应的视图对象上的阴影效果。Further, the electronic device may use the above outline shape as the inner border of the shadow image corresponding to the target control in subsequent steps, so that the shadow drawing path corresponding to the target control may be determined outside the inner border, so as to further draw the shadow outside the inner border Image, to realize the shadow effect on the view object corresponding to the target control.
在一些实施例中,电子设备在确定目标控件对应的阴影绘制路径之前,可以先基于阴影范围参数定义包含该阴影绘制路径的阴影绘制范围,从而可以确保在符合该阴影绘制范围的条件下绘制阴影图像。举例来说,电子设备可以获取预先设定的阴影范围参数(如上述的android:clipToPadding、android:clipChildren等),进而可以将上述轮廓形状作为目标控件对应的阴影图像的内边框,并在该内边框外,且符合上述阴影范围参数所定义的阴影绘制范围内,确定该目标控件对应的阴影绘制路径。In some embodiments, before the electronic device determines the shadow drawing path corresponding to the target control, it can first define the shadow drawing range including the shadow drawing path based on the shadow range parameter, so as to ensure that the shadow is drawn under the condition of conforming to the shadow drawing range image. For example, the electronic device can obtain preset shadow range parameters (such as the above-mentioned android:clipToPadding, android:clipChildren, etc.), and then can use the above-mentioned outline shape as the inner border of the shadow image corresponding to the target control, and in the Outside the border, and within the shadow drawing range defined by the above shadow range parameter, determine the shadow drawing path corresponding to the target control.
示例性地,通过将布尔型的阴影范围参数android:clipToPadding的值设置为false(即设置android:clipToPadding=false),可以使得阴影绘制范围超出目标控件所填充的区域,即将该目标控件的轮廓形状作为改目标控件对应的阴影图像的内边框,在该内边框外绘制阴影图像。通过将阴影范围参数android:clipChildren的值设置为false(即设置android:clipChildren=false),可以使得阴影绘制范围不受目标控件的父控件对应的轮廓范围限制,即所绘制的阴影图像不会被包含目标控件、轮廓范围更大的父控件对应的轮廓范围切割,从而可以尽可能地在图形用户界面中延伸,以实现丰富多样的阴影效果。Exemplarily, by setting the value of the Boolean shadow range parameter android:clipToPadding to false (that is, setting android:clipToPadding=false), the shadow drawing range can exceed the area filled by the target control, that is, the outline shape of the target control As the inner border of the shadow image corresponding to the target control, draw the shadow image outside the inner border. By setting the value of the shadow range parameter android:clipChildren to false (that is, setting android:clipChildren=false), the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control, that is, the drawn shadow image will not be Contains the target control, the contour range cut corresponding to the parent control with a larger contour range, so that it can be extended as far as possible in the GUI to achieve rich and diverse shadow effects.
506、获取阴影效果参数,该阴影效果参数至少包括阴影颜色、阴影模糊半径、阴影偏移参数、阴影圆角参数中的任意一种。506. Obtain a shadow effect parameter, where the shadow effect parameter at least includes any one of a shadow color, a shadow blur radius, a shadow offset parameter, and a shadow fillet parameter.
其中,上述阴影效果参数,可以用于定义电子设备针对目标控件对应的视图对象所绘制的阴影图像可实现的阴影效果。电子设备在获取该阴影效果参数之后,可以结合上述目标控件的轮廓形状以及该阴影效果参数,在后续步骤中进一步确定该目标控件对应的阴影绘制路径,以绘制出定制化的阴影图像,有利于提升电子设备在图形用户界面上实现阴影效果的准确性和灵活性。Wherein, the above-mentioned shadow effect parameter may be used to define a shadow effect that can be realized by the electronic device for the shadow image drawn by the view object corresponding to the target control. After obtaining the shadow effect parameters, the electronic device can further determine the shadow drawing path corresponding to the target control in a subsequent step in combination with the outline shape of the target control and the shadow effect parameters, so as to draw a customized shadow image, which is beneficial to Improve the accuracy and flexibility of electronic devices to implement shadow effects on GUIs.
示例性地,上述阴影颜色,可以用于表征阴影图像在色域上的范围。可选地,该阴影颜色可以包括单一的颜色,也可以包括混合色、渐变色(例如阴影图像从中心到四周渐变、从左到右渐变等)等,本申请实施例中不作具体限定。Exemplarily, the above shadow color may be used to represent the range of the shadow image in the color gamut. Optionally, the shadow color may include a single color, or a mixed color, a gradient color (for example, the shadow image gradually changes from the center to the surrounding, from left to right, etc.), which is not specifically limited in this embodiment of the present application.
上述阴影模糊半径,可以用于表征阴影扩散范围,即阴影图像自身的大小(例如从该阴影图像的内边框到外边框的宽度),或者该阴影图像相对于目标控件的轮廓范围的大小(例如该阴影图像的半径相对于目标控件的轮廓范围的半径的比例)。如图6A所示,从左到右(编号依次为a、b、c)依次为针对同一目标控件的视图对象绘制阴影图像时,阴影模糊半径从小到大的阴影效果示意图(黑色区域表示阴影图像)。The shadow blur radius above can be used to characterize the shadow diffusion range, that is, the size of the shadow image itself (for example, the width from the inner border of the shadow image to the outer border), or the size of the shadow image relative to the outline range of the target control (for example, The ratio of the radius of this shadow image relative to the radius of the outline bounds of the target control). As shown in Figure 6A, when drawing shadow images for the view objects of the same target control from left to right (the numbers are a, b, and c), the schematic diagrams of shadow effects from small to large shadow blur radii (the black area represents the shadow image ).
上述阴影偏移参数,可以用于表征阴影图像在X或Y轴上偏移的程度,即该阴影图像在横轴方向或竖轴方向上相对于目标控件的视图对象偏移的程度。以阴影图像仅在X轴正方向(向右)偏移为例,如图6B所示,从左到右(编号依次为a、b、c)依次为针对同一目标控件的视图对象绘制阴影图像时,阴影偏移参数从小到大的阴影效果示意图(黑色区域表示阴影图像)。可以理解,当阴影图像在X轴及Y轴上的偏移参数均不为0时,该阴影图像也可以相对于目标控件的视图对象斜向偏移。The above-mentioned shadow offset parameter can be used to characterize the offset degree of the shadow image on the X or Y axis, that is, the offset degree of the shadow image relative to the view object of the target control in the horizontal axis direction or the vertical axis direction. Take the shadow image shifted only in the positive direction of the X-axis (to the right) as an example, as shown in Figure 6B, from left to right (the numbers are a, b, c) in order to draw shadow images for the view objects of the same target control , the schematic diagram of the shadow effect from small to large shadow offset parameters (the black area represents the shadow image). It can be understood that when the offset parameters of the shadow image on both the X axis and the Y axis are not 0, the shadow image can also be obliquely offset relative to the view object of the target control.
上述阴影圆角参数,可以用于表征阴影图像的圆角大小、弧度等,从而在阴影图像包含圆角(例如目标控件的轮廓形状为圆角矩形、圆角三角形等)时,可以准确确定其圆角的形状。以目标控件的轮廓形状为圆角矩形,而阴影圆角参数包括圆角大小为例,如图6C所示,从左到右(编号依次为a、b、c)依次为针对同一目标控件的视图对象绘制阴影图像时,阴影圆角参数从小到大的阴影效果示意图(黑色区域表示阴影图像)。The above-mentioned shadow rounded corner parameters can be used to characterize the rounded corner size, radian, etc. of the shadow image, so that when the shadow image contains rounded corners (for example, the outline shape of the target control is a rounded rectangle, rounded triangle, etc.), it can be accurately determined. Shape with rounded corners. Take the contour shape of the target control as a rounded rectangle, and the shadow rounded corner parameters include the size of the rounded corners as an example, as shown in Figure 6C, from left to right (the numbers are a, b, c) in turn for the same target control When the view object draws a shadow image, the diagram of the shadow effect from small to large shadow fillet parameters (the black area represents the shadow image).
508、根据上述轮廓形状及阴影效果参数,在目标控件对应的轮廓范围外确定该目标控件对应的阴影绘制路径。508. According to the above-mentioned outline shape and shadow effect parameters, determine a shadow drawing path corresponding to the target control outside the range of the outline corresponding to the target control.
其中,步骤508与上述步骤204类似。需要说明的是,通过结合上述目标控件的轮廓形状以及阴影效果参数来确定阴影绘制路径,能够绘制出定制化的阴影图像,从而有效提升了电子设备在图形用户界面上实现阴影效果的准确性和灵活性。Wherein, step 508 is similar to step 204 above. It should be noted that by combining the outline shape of the target control and the shadow effect parameters to determine the shadow drawing path, a customized shadow image can be drawn, thereby effectively improving the accuracy and accuracy of the shadow effect on the graphical user interface of the electronic device. flexibility.
510、按照该阴影绘制路径,通过模糊遮罩滤镜绘制上述目标控件对应的阴影图像,该阴影图像用于在上述目标控件对应的视图对象上实现阴影效果。510. Draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path, where the shadow image is used to implement a shadow effect on the view object corresponding to the target control.
其中,步骤510与上述步骤206类似,此处不再赘述。Wherein, step 510 is similar to the above-mentioned step 206 and will not be repeated here.
可见,实施上述实施例所描述的阴影生成方法,电子设备能够在对图形用户界面上的目标控件进行绘制时,基于模糊遮罩滤镜绘制该目标控件的阴影图像,从而可以在图形用户界面上实现具有阴影效果的控件,提升视图对象的立体感和层次感,优化图形用户界面的视觉表达效果。通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,能够有效提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。此外,通过设置一系列参数来限定阴影图像的绘制范围、绘制效果等,能够使电子设备绘制出定制化的阴影图像,从而有利于提升电子设备在图形用户界面上实现阴影效果的准确性和灵活性。It can be seen that, by implementing the shadow generation method described in the above embodiments, the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI. The drawing of the shadow image can be completed quickly and simply by using the blur mask filter, which can effectively improve the convenience and efficiency of realizing the shadow effect on the graphical user interface of the electronic device. In addition, by setting a series of parameters to limit the drawing range and drawing effect of the shadow image, the electronic device can draw a customized shadow image, which is conducive to improving the accuracy and flexibility of the shadow effect on the graphical user interface of the electronic device sex.
请参阅图7,图7是本申请实施例公开的又一种阴影生成方法的流程示意图。如图7所示,该阴影生成方法可以包括以下步骤:Please refer to FIG. 7 . FIG. 7 is a schematic flowchart of another method for generating a shadow disclosed in an embodiment of the present application. As shown in Figure 7, the shadow generation method may include the following steps:
702、通过视图轮廓接口获取图形用户界面中待绘制的目标控件对应的形状数据。702. Acquire shape data corresponding to the target control to be drawn in the GUI through the view outline interface.
704、若形状数据包括自定义形状,则将该自定义形状确定为目标控件的轮廓形状,若形状数据不包括自定义形状,则将默认形状确定为目标控件的轮廓形状。704. If the shape data includes a custom shape, determine the custom shape as the outline shape of the target control, and if the shape data does not include the custom shape, determine a default shape as the outline shape of the target control.
其中,步骤702以及步骤704与上述步骤502以及步骤504类似,此处不再赘述。Wherein, step 702 and step 704 are similar to the above step 502 and step 504, and will not be repeated here.
706、获取阴影效果参数,该阴影效果参数至少包括阴影颜色、阴影模糊半径、阴影偏移参数、阴影圆角参数中的任意一种。706. Obtain a shadow effect parameter, where the shadow effect parameter at least includes any one of a shadow color, a shadow blur radius, a shadow offset parameter, and a shadow fillet parameter.
708、根据上述轮廓形状及阴影效果参数,在目标控件对应的轮廓范围外确定该目标控 件对应的阴影绘制路径。708. According to the above outline shape and shadow effect parameters, determine a shadow drawing path corresponding to the target control outside the range of the outline corresponding to the target control.
其中,步骤706以及步骤708与上述步骤506以及步骤508类似,此处不再赘述。Wherein, step 706 and step 708 are similar to the above step 506 and step 508, and will not be repeated here.
710、获取图形用户界面对应的目标渲染管道。710. Acquire a target rendering pipeline corresponding to the GUI.
在本申请实施例中,不同的电子设备可以设置有不同的渲染管道平台,例如OpenGL、SkiaGL、Skiavk等。其中,对于纯硬件渲染管道,即仅通过GPU(Graphics Processing Unit,图形处理器)加速渲染阴影图像的情况,上述模糊遮罩滤镜将失效,此时需要通过其它兼容处理操作来实现图形用户界面上的阴影效果。而对于非硬件渲染管道,即还可以通过CPU(Central Processing Unit,中央处理器)加速渲染阴影图像的情况,则可以采用上述模糊遮罩滤镜来绘制阴影图像。因此,电子设备在实际绘制阴影图像前,可以先获取其图形用户界面对应支持的目标渲染管道,从而可以根据目标渲染管道的类型采用相应的措施绘制阴影图像,以实现同样的阴影效果。In this embodiment of the present application, different electronic devices may be provided with different rendering pipeline platforms, such as OpenGL, SkiaGL, Skiavk, and the like. Among them, for the pure hardware rendering pipeline, that is, only through the GPU (Graphics Processing Unit, graphics processor) to accelerate the rendering of shadow images, the above-mentioned blur mask filter will be invalid. At this time, other compatible processing operations are required to realize the graphical user interface. Shadow effect on . For the non-hardware rendering pipeline, that is, the situation that the shadow image can also be accelerated through the CPU (Central Processing Unit, central processing unit), the above-mentioned blur mask filter can be used to draw the shadow image. Therefore, before the electronic device actually draws the shadow image, it can obtain the target rendering pipeline correspondingly supported by its GUI, so that the shadow image can be drawn by corresponding measures according to the type of the target rendering pipeline, so as to achieve the same shadow effect.
712、在上述目标渲染管道为非纯硬件渲染管道的情况下,按照阴影绘制路径,通过模糊遮罩滤镜绘制目标控件对应的阴影图像。712. In the case that the aforementioned target rendering pipeline is a non-pure hardware rendering pipeline, draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path.
在本申请实施例中,以安卓操作系统为例,电子设备在确定其图形用户界面支持的目标渲染管道为非纯硬件渲染管道(例如SkiaGL、Skiavk等)的情况下,可以直接调用Android SDK上的画笔绘制效果接口BlurMaskFilter,以利用该接口按照上述阴影绘制路径绘制得到目标控件对应的阴影图像。In the embodiment of the present application, taking the Android operating system as an example, when the electronic device determines that the target rendering pipeline supported by its graphical user interface is a non-pure hardware rendering pipeline (such as SkiaGL, Skiavk, etc.), it can directly call the The brush drawing effect interface BlurMaskFilter is used to use this interface to draw the shadow image corresponding to the target control according to the above shadow drawing path.
示例性地,电子设备在利用BlurMaskFilter接口,即通过模糊遮罩滤镜绘制目标控件对应的阴影图像时,可以基于该模糊遮罩滤镜的不同模糊处理模式,实现不同的模糊效果,从而在上述定制化阴影图像的基础上,进一步实现不同的阴影效果。如图8所示,上述模糊处理模式可以包括NORMAL(内外部模糊绘制)、SOLID(内部正常绘制,外部模糊)、OUTER(内部不绘制,外部模糊)、INNER(内部正常绘制,外部模糊)等。可以理解,采用不同的模糊处理模式,由于阴影扩散具有连续性,即便去除图8中目标控件的轮廓范围所覆盖的区域,在该目标控件的轮廓范围外所绘制的阴影图像仍可实现不同的模糊效果。Exemplarily, when the electronic device uses the BlurMaskFilter interface, that is, draws the shadow image corresponding to the target control through the blur mask filter, it can realize different blur effects based on the different blur processing modes of the blur mask filter, so that in the above On the basis of customized shadow images, different shadow effects can be further realized. As shown in Figure 8, the aforementioned blur processing modes may include NORMAL (inner and outer blurred drawing), SOLID (inner normal drawing, outer blurring), OUTER (inner no drawing, outer blurring), INNER (inner normal drawing, outer blurring), etc. . It can be understood that with different blur processing modes, due to the continuity of shadow diffusion, even if the area covered by the outline range of the target control in Figure 8 is removed, the shadow images drawn outside the outline range of the target control can still achieve different blur effect.
可选的,电子设备可以根据上述阴影效果参数,确定模糊遮罩滤镜的模糊处理模式,即该模糊遮罩滤镜实现不同模糊效果的上述不同模式。在此基础上,电子设备可以按照上述阴影绘制路径,通过所确定出的模糊遮罩滤镜的模糊处理模式来绘制目标控件对应的阴影图像,以实现不同的模糊效果,提升电子设备在图形用户界面上实现阴影效果的多样性。Optionally, the electronic device may determine a blur processing mode of the blur mask filter according to the above shadow effect parameters, that is, the blur mask filter implements the above different modes of different blur effects. On this basis, the electronic device can draw the shadow image corresponding to the target control through the determined blur processing mode of the blur mask filter according to the above-mentioned shadow drawing path, so as to achieve different blur effects and improve the electronic device's graphics user experience. Realize the diversity of shadow effects on the interface.
714、在上述目标渲染管道为纯硬件渲染管道的情况下,根据阴影效果参数执行兼容处理操作,并通过画笔对象绘制目标控件对应的阴影图像。714. In the case that the above-mentioned target rendering pipeline is a pure hardware rendering pipeline, perform a compatible processing operation according to the shadow effect parameter, and draw a shadow image corresponding to the target control through the brush object.
在本申请实施例中,以安卓操作系统为例,电子设备在确定其图形用户界面支持的目标渲染管道为纯硬件渲染管道(例如OpenGL等)的情况下,可以采用其它的兼容处理操作,以实现与上述模糊遮罩滤镜所实现的相同阴影效果。In the embodiment of the present application, taking the Android operating system as an example, when the electronic device determines that the target rendering pipeline supported by its GUI is a pure hardware rendering pipeline (such as OpenGL, etc.), it can use other compatible processing operations to Achieves the same shadow effect as achieved by the blur mask filter above.
在一些实施例中,在上述目标渲染管道为纯硬件渲染管道的情况下,电子设备可以强制使用软件绘制的方式绘制阴影图像,此时该电子设备可以根据上述阴影效果参数来调整画笔对象的属性参数,进而可以通过该画笔对象来进行绘制。其中,上述属性参数可以用于定义该画笔对象的绘制效果。举例来说,电子设备可以通过setShadowLayer接口来调整画笔对象绘制阴影图像的阴影模糊半径、阴影偏移参数、阴影颜色等,从而可以得到定制化绘制效果的画笔对象。In some embodiments, when the above-mentioned target rendering pipeline is a pure hardware rendering pipeline, the electronic device can force the use of software rendering to draw shadow images, and at this time, the electronic device can adjust the properties of the brush object according to the above-mentioned shadow effect parameters Parameters, and then can be drawn through the brush object. Wherein, the above attribute parameters can be used to define the drawing effect of the brush object. For example, the electronic device can adjust the shadow blur radius, shadow offset parameter, shadow color, etc. of the shadow image drawn by the brush object through the setShadowLayer interface, so as to obtain a brush object with a customized drawing effect.
在另一些实施例中,若电子设备不强制使用软件绘制的方式绘制阴影图像,则可以根据上述阴影效果参数来确定画笔对象绘制阴影图像的阴影绘制范围,即先绘制该阴影图像的边界。在此基础上,电子设备可以直接调用画笔对象在该阴影绘制范围内(即上述边界内)绘制阴影图像,实现图形用户界面上的阴影效果。In some other embodiments, if the electronic device does not force the use of software drawing to draw the shadow image, the shadow drawing range for the brush object to draw the shadow image may be determined according to the above shadow effect parameters, that is, the boundary of the shadow image is drawn first. On this basis, the electronic device can directly invoke the brush object to draw a shadow image within the shadow drawing range (ie, within the above-mentioned boundary), so as to realize the shadow effect on the GUI.
可以理解,步骤714可以接在上述步骤710后执行,即上述步骤712与该步骤714可以为并列方案,以兼容适配不同电子设备所设置的不同渲染管道平台。It can be understood that step 714 can be executed after the above step 710, that is, the above step 712 and this step 714 can be implemented in parallel, so as to be compatible with different rendering pipeline platforms set by different electronic devices.
716、根据上述轮廓数据,绘制与阴影图像匹配的背景图像,并在目标控件对应的轮廓范围内,绘制与该阴影图像匹配的前景图像。716. Draw a background image matching the shadow image according to the outline data, and draw a foreground image matching the shadow image within the outline range corresponding to the target control.
在本申请实施例中,电子设备在绘制得到上述阴影图像之后,可以分别绘制与该阴影图形适配兼容的前景和背景图像,以实现完整的目标控件绘制流程。In the embodiment of the present application, after drawing the above-mentioned shadow image, the electronic device may respectively draw the foreground and background images compatible with the shadow graphic adaptation, so as to realize a complete drawing process of the target control.
示例性地,电子设备可以基于目标控件的轮廓数据,绘制与上述阴影图像匹配的背景图像。其中,该背景图像可以通过background变量的属性来定义。举例来说,电子设备可以先获取背景图像资源,即将上述background变量指向预先设置的图像资源,继而可以根据上述轮廓数据对该背景图像资源进行预处理,得到与目标控件对应的轮廓范围匹配的处理图像资源。以安卓操作系统为例,背景图像资源通常可以以位图(BitmapDrawable)的形式存储,电子设备子在获取该位图形式的背景图像资源后,通过对其进行预处理,可以将其转换为带圆角的位图(RoundBitmapDrawable)形式的处理图像资源。Exemplarily, the electronic device may draw a background image matching the above shadow image based on the outline data of the target control. Wherein, the background image can be defined through the attribute of the background variable. For example, the electronic device can first obtain the background image resource, that is, point the above-mentioned background variable to the preset image resource, and then preprocess the background image resource according to the above-mentioned outline data to obtain the process of matching the outline range corresponding to the target control Image resource. Taking the Android operating system as an example, the background image resource can usually be stored in the form of a bitmap (BitmapDrawable). After the electronic device obtains the background image resource in the form of a bitmap, it can be converted into Handle image resources in the form of rounded bitmaps (RoundBitmapDrawable).
在此基础上,电子设备可以根据上述处理图像资源的图像类型,通过画笔对象绘制与上述阴影图像匹配的背景图像。示例性地,上述处理图像资源的图像类型除了包括带圆角的位图(RoundBitmapDrawable)之外,还可以包括纯色图像(ColorDrawable)、渐变色图像(GradientDrawable)等。针对不同图像类型的处理图像资源,电子设备可以获取其相应的属性信息(例如圆角大小、弧度、RGB颜色值等),继而可以调用画笔对象绘制与上述阴影图像匹配的背景图像。可选地,该背景图像可以与阴影图像的轮廓大小相匹配,也可以稍大于该阴影图像,本申请实施例中不作具体限定。On this basis, the electronic device can draw a background image that matches the above shadow image through the brush object according to the image type of the above processing image resource. Exemplarily, besides the rounded corner bitmap (RoundBitmapDrawable), the image type of the above-mentioned processing image resource may also include a solid color image (ColorDrawable), a gradient color image (GradientDrawable), and the like. For processing image resources of different image types, the electronic device can obtain its corresponding attribute information (such as fillet size, radian, RGB color value, etc.), and then call a brush object to draw a background image that matches the above shadow image. Optionally, the background image may match the outline size of the shadow image, or may be slightly larger than the shadow image, which is not specifically limited in this embodiment of the present application.
示例性地,电子设备还可以基于目标控件的轮廓数据,在该目标控件对应的轮廓范围内,绘制与该阴影图像匹配的前景图像。其中,该前景图像可以通过foreground变量的属性来定义。可以理解的是,该前景图像可以与目标控件的轮廓范围完全匹配,从而与上述阴影图像、背景图像构成完整的目标控件对应的视图对象。Exemplarily, the electronic device may also draw a foreground image matching the shadow image within the contour range corresponding to the target control based on the contour data of the target control. Wherein, the foreground image can be defined through the attribute of the foreground variable. It can be understood that the foreground image can completely match the outline range of the target control, so as to form a complete view object corresponding to the target control with the above shadow image and background image.
可见,实施上述实施例所描述的阴影生成方法,电子设备能够在对图形用户界面上的目标控件进行绘制时,基于模糊遮罩滤镜绘制该目标控件的阴影图像,从而可以在图形用户界面上实现具有阴影效果的控件,提升视图对象的立体感和层次感,优化图形用户界面的视觉表达效果。通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,能够有效提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。此外,通过采用模糊遮罩滤镜的不同模糊处理模式,可以实现不同的模糊效果,从而在上述定制化阴影图像的基础上,进一步实现不同的阴影效果,提升电子设备在图形用户界面上实现阴影效果的多样性。此外,根据图形用户界面所支持的目标渲染管道的类型来采用相应的措施绘制阴影图像,以实现同样的阴影效果,可以进一步提升电子设备在图形用户界面上实现阴影效果的兼容性、灵活性和可靠性。此外,通过分别绘制与上述阴影图形适配兼容的前景和背景图像,能够便捷地实现完整的目标控件绘制流程,从而可以在电子设备的图形用户界面上实现带有阴影效果的卡片布局,得到统一的阴影视觉效果。It can be seen that, by implementing the shadow generation method described in the above embodiments, the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that the shadow image of the target control can be drawn on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI. The drawing of the shadow image can be completed quickly and simply by using the blur mask filter, which can effectively improve the convenience and efficiency of realizing the shadow effect on the graphical user interface of the electronic device. In addition, by using different blur processing modes of the blur mask filter, different blur effects can be achieved, so that on the basis of the above-mentioned customized shadow image, different shadow effects can be further realized, and the electronic device can realize shadows on the graphical user interface. Variety of effects. In addition, according to the type of the target rendering pipeline supported by the GUI, corresponding measures are used to draw the shadow image to achieve the same shadow effect, which can further improve the compatibility, flexibility and reliability. In addition, by drawing the foreground and background images compatible with the above-mentioned shadow graphics adaptation, the complete drawing process of the target control can be conveniently realized, so that the card layout with shadow effect can be realized on the graphical user interface of the electronic device, and unified shadow visual effect.
请参阅图9,图9是本申请实施例公开的一种阴影生成装置的模块化示意图。如图9所示,该阴影生成装置可以包括轮廓获取901、路径确定902以及阴影绘制单元903,其中:Please refer to FIG. 9 . FIG. 9 is a schematic modular diagram of a shadow generating device disclosed in an embodiment of the present application. As shown in FIG. 9, the shadow generation device may include contour acquisition 901, path determination 902, and shadow drawing unit 903, wherein:
轮廓获取单元901,用于获取图形用户界面中待绘制的目标控件的轮廓数据;an outline acquisition unit 901, configured to acquire outline data of the target control to be drawn in the GUI;
路径确定单元902,用于根据该轮廓数据,在上述目标控件对应的轮廓范围外确定该目标控件对应的阴影绘制路径;A path determining unit 902, configured to determine a shadow drawing path corresponding to the target control outside the contour range corresponding to the target control according to the contour data;
阴影绘制单元903,用于按照该阴影绘制路径,通过模糊遮罩滤镜绘制上述目标控件对 应的阴影图像,该阴影图像用于在上述目标控件对应的视图对象上实现阴影效果。The shadow drawing unit 903 is configured to draw the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path, and the shadow image is used to realize the shadow effect on the view object corresponding to the target control.
可见,采用上述实施例所描述的阴影生成装置,电子设备能够在对图形用户界面上的目标控件进行绘制时,基于模糊遮罩滤镜绘制该目标控件的阴影图像,从而可以在图形用户界面上实现具有阴影效果的控件,提升视图对象的立体感和层次感,优化图形用户界面的视觉表达效果。相较于相关技术中在实现阴影效果时,往往需要根据控件大小分别绘制四边和圆角的阴影,整体绘制过程较为复杂,本申请实施例能够通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,从而能够有效提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。It can be seen that by using the shadow generation device described in the above embodiments, the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that it can draw the target control on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI. Compared with the shadow effect in the related art, it is often necessary to draw shadows with four sides and rounded corners according to the size of the control, and the overall drawing process is more complicated. The embodiment of the present application can quickly and simply complete the shadow image through the blur mask filter drawing, thereby effectively improving the convenience and efficiency of electronic devices in realizing shadow effects on GUIs.
在一种实施例中,上述轮廓数据可以包括轮廓形状,上述路径确定902具体可以用于将轮廓形状作为目标控件对应的阴影图像的内边框,在内边框外确定目标控件对应的阴影绘制路径。In an embodiment, the above-mentioned contour data may include a contour shape, and the above-mentioned path determination 902 may be specifically used to use the contour shape as an inner frame of a shadow image corresponding to the target control, and determine a shadow drawing path corresponding to the target control outside the inner frame.
在此基础上,上述轮廓获取单元901具体可以用于通过视图轮廓接口获取图形用户界面中待绘制的目标控件对应的形状数据;On this basis, the above-mentioned outline acquisition unit 901 can be specifically configured to acquire the shape data corresponding to the target control to be drawn in the graphical user interface through the view outline interface;
若形状数据包括自定义形状,则轮廓获取单元901可以将自定义形状确定为目标控件的轮廓形状;若形状数据不包括自定义形状,则轮廓获取单元901可以将默认形状确定为目标控件的轮廓形状。If the shape data includes a custom shape, the contour acquisition unit 901 may determine the custom shape as the contour shape of the target control; if the shape data does not include a custom shape, the contour acquisition unit 901 may determine the default shape as the contour of the target control shape.
在一种实施例中,上述路径确定单元902具体可以包括未图示的参数获取子单元和路径确定子单元,其中:In an embodiment, the path determination unit 902 may specifically include a parameter acquisition subunit and a path determination subunit not shown in the figure, wherein:
参数获取子单元,用于获取阴影范围参数,阴影范围参数用于定义阴影绘制范围,阴影绘制范围不受目标控件的父控件对应的轮廓范围限制;The parameter acquisition subunit is used to obtain the shadow range parameter, which is used to define the shadow drawing range, and the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control;
路径确定子单元,用于将轮廓形状作为目标控件对应的阴影图像的内边框,在内边框外,且符合阴影范围参数定义的阴影绘制范围内,确定目标控件对应的阴影绘制路径。The path determination subunit is used to determine the shadow drawing path corresponding to the target control by using the outline shape as the inner border of the shadow image corresponding to the target control, outside the inner border, and within the shadow drawing range defined by the shadow range parameter.
在一种实施例中,该阴影生成装置还可以包括未图示的第一获取单元,该第一获取单元可以用于获取阴影效果参数,阴影效果参数至少包括阴影颜色、阴影模糊半径、阴影偏移参数、阴影圆角参数中的任意一种;In one embodiment, the shadow generation device may further include a first acquisition unit not shown in the figure, and the first acquisition unit may be used to acquire shadow effect parameters, the shadow effect parameters at least include shadow color, shadow blur radius, shadow offset Any one of the shift parameter and the shadow fillet parameter;
上述路径确定单元902,具体可以用于根据轮廓数据及阴影效果参数,在目标控件对应的轮廓范围外确定目标控件对应的阴影绘制路径。The above-mentioned path determination unit 902 may specifically be configured to determine a shadow drawing path corresponding to the target control outside the contour range corresponding to the target control according to the contour data and the shadow effect parameters.
在一种实施例中,上述阴影绘制单元903可以包括未图示的模式确定子单元和绘制子单元,其中:In an embodiment, the shadow drawing unit 903 may include a mode determination subunit and a drawing subunit not shown, wherein:
模式确定子单元,用于根据阴影效果参数,确定模糊遮罩滤镜的模糊处理模式,模糊处理模式指的是模糊遮罩滤镜实现模糊效果的模式;The mode determination subunit is used to determine the blur processing mode of the blur mask filter according to the shadow effect parameter, and the blur processing mode refers to the mode in which the blur mask filter realizes the blur effect;
绘制子单元,用于按照阴影绘制路径,通过模糊遮罩滤镜的模糊处理模式绘制目标控件对应的阴影图像。The drawing subunit is used to draw the path according to the shadow, and draw the shadow image corresponding to the target control through the blur processing mode of the blur mask filter.
可见,采用上述实施例所描述的阴影生成装置,通过设置一系列参数来限定阴影图像的绘制范围、绘制效果等,能够使电子设备绘制出定制化的阴影图像,从而有利于提升电子设备在图形用户界面上实现阴影效果的准确性和灵活性。此外,通过采用模糊遮罩滤镜的不同模糊处理模式,可以实现不同的模糊效果,从而在上述定制化阴影图像的基础上,进一步实现不同的阴影效果,提升电子设备在图形用户界面上实现阴影效果的多样性。It can be seen that by using the shadow generation device described in the above embodiments, by setting a series of parameters to limit the drawing range and drawing effect of the shadow image, the electronic device can draw a customized shadow image, which is beneficial to improve the graphics performance of the electronic device. Accuracy and flexibility in implementing shadow effects on the user interface. In addition, by using different blur processing modes of the blur mask filter, different blur effects can be achieved, so that on the basis of the above-mentioned customized shadow image, different shadow effects can be further realized, and the electronic device can realize shadows on the graphical user interface. Variety of effects.
在一种实施例中,该阴影生成装置还可以包括未图示的第二获取单元,该第二获取单元用于在上述阴影绘制单元903按照阴影绘制路径,通过模糊遮罩滤镜绘制上述目标控件对应的阴影图像之前,获取图形用户界面对应的目标渲染管道;In one embodiment, the shadow generation device may further include a second acquisition unit not shown, the second acquisition unit is used to draw the above-mentioned target through the blur mask filter according to the shadow drawing path in the above-mentioned shadow drawing unit 903 Get the target rendering pipeline corresponding to the GUI before the shadow image corresponding to the control;
上述阴影绘制单元903,具体可以用于在目标渲染管道为非纯硬件渲染管道的情况下,按照阴影绘制路径,通过模糊遮罩滤镜绘制目标控件对应的阴影图像。The above-mentioned shadow drawing unit 903 can specifically be used to draw the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path when the target rendering pipeline is not a pure hardware rendering pipeline.
在一种实施例中,该阴影生成装置还可以包括未图示的兼容单元,该兼容单元可以用于在上述目标渲染管道为纯硬件渲染管道的情况下,根据阴影效果参数执行兼容处理操作,并通过画笔对象绘制目标控件对应的阴影图像;In an embodiment, the shadow generating device may further include a compatible unit not shown, and the compatible unit may be used to perform compatible processing operations according to shadow effect parameters when the above-mentioned target rendering pipeline is a pure hardware rendering pipeline, And draw the shadow image corresponding to the target control through the brush object;
其中,兼容处理操作包括:Among them, compatible processing operations include:
根据阴影效果参数调整画笔对象的属性参数,属性参数用于定义画笔对象的绘制效果;Adjust the attribute parameters of the brush object according to the shadow effect parameters, and the attribute parameters are used to define the drawing effect of the brush object;
或者,根据阴影效果参数确定画笔对象绘制阴影图像的阴影绘制范围。Or, determine the shadow drawing range in which the brush object draws the shadow image according to the shadow effect parameter.
可见,采用上述实施例所描述的阴影生成装置,根据图形用户界面所支持的目标渲染管道的类型来采用相应的措施绘制阴影图像,以实现同样的阴影效果,还可以进一步提升电子设备在图形用户界面上实现阴影效果的兼容性、灵活性和可靠性。It can be seen that, by adopting the shadow generation device described in the above embodiments, corresponding measures are used to draw shadow images according to the type of the target rendering pipeline supported by the GUI, so as to achieve the same shadow effect, and further improve the performance of the electronic device on the graphics user interface. Compatibility, flexibility and reliability for implementing shadow effects on the interface.
在一种实施例中,该阴影生成装置还可以包括未图示的前后景绘制单元,该前后景绘制单元可以用于在上述阴影绘制单元903按照阴影绘制路径,通过模糊遮罩滤镜绘制上述目标控件对应的阴影图像之后,根据轮廓数据,绘制与阴影图像匹配的背景图像,并在目标控件对应的轮廓范围内,绘制与阴影图像匹配的前景图像。In one embodiment, the shadow generation device may also include a not-shown foreground and background drawing unit, which may be used to draw the above-mentioned shadow through the blur mask filter according to the shadow drawing path in the shadow drawing unit 903. After the shadow image corresponding to the target control, draw a background image matching the shadow image according to the contour data, and draw a foreground image matching the shadow image within the contour range corresponding to the target control.
其中,该前后景绘制单元在根据轮廓数据,绘制与阴影图像匹配的背景图像时,具体可以包括以下步骤:Wherein, when the foreground and background drawing unit draws the background image matching the shadow image according to the outline data, it may specifically include the following steps:
获取背景图像资源;Get the background image resource;
根据轮廓数据对背景图像资源进行预处理,得到与目标控件对应的轮廓范围匹配的处理图像资源;Preprocessing the background image resource according to the outline data to obtain a processed image resource matching the outline range corresponding to the target control;
根据处理图像资源的图像类型,通过画笔对象绘制与阴影图像匹配的背景图像。According to the image type of the processed image resource, a background image matching the shadow image is drawn through the brush object.
可见,采用上述实施例所描述的阴影生成装置,电子设备能够在对图形用户界面上的目标控件进行绘制时,基于模糊遮罩滤镜绘制该目标控件的阴影图像,从而可以在图形用户界面上实现具有阴影效果的控件,提升视图对象的立体感和层次感,优化图形用户界面的视觉表达效果。通过模糊遮罩滤镜快速、简单地完成阴影图像的绘制,能够有效提升电子设备在图形用户界面上实现阴影效果的便捷性和效率。此外,通过分别绘制与上述阴影图形适配兼容的前景和背景图像,能够便捷地实现完整的目标控件绘制流程,从而可以在电子设备的图形用户界面上实现带有阴影效果的卡片布局,得到统一的阴影视觉效果。It can be seen that by using the shadow generation device described in the above embodiments, the electronic device can draw the shadow image of the target control based on the blur mask filter when drawing the target control on the GUI, so that it can draw the target control on the GUI. Realize controls with shadow effects, improve the three-dimensional and layered sense of view objects, and optimize the visual expression effect of the GUI. The drawing of the shadow image can be completed quickly and simply by using the blur mask filter, which can effectively improve the convenience and efficiency of realizing the shadow effect on the graphical user interface of the electronic device. In addition, by drawing the foreground and background images compatible with the above-mentioned shadow graphics adaptation, the complete drawing process of the target control can be conveniently realized, so that the card layout with shadow effect can be realized on the graphical user interface of the electronic device, and unified shadow visual effect.
请参阅图10,图10是本申请实施例公开的一种电子设备的模块化示意图。如图10所示,该电子设备可以包括:Please refer to FIG. 10 . FIG. 10 is a schematic modular diagram of an electronic device disclosed in an embodiment of the present application. As shown in Figure 10, the electronic equipment may include:
存储有可执行程序代码的存储器1001;A memory 1001 storing executable program codes;
与存储器1001耦合的处理器1002;a processor 1002 coupled to the memory 1001;
其中,处理器1002调用存储器1001中存储的可执行程序代码,可以执行上述实施例所描述的任意一种阴影生成方法中的全部或部分步骤。Wherein, the processor 1002 invokes the executable program code stored in the memory 1001 to execute all or part of the steps in any shadow generating method described in the above-mentioned embodiments.
此外,本申请实施例进一步公开了一种计算机可读存储介质,其存储用于电子数据交换的计算机程序,其中,该计算机程序使得计算机可以执行上述实施例所描述的任意一种阴影生成方法中的全部或部分步骤。In addition, the embodiment of the present application further discloses a computer-readable storage medium, which stores a computer program for electronic data exchange, wherein the computer program enables the computer to execute any shadow generation method described in the above-mentioned embodiments. all or part of the steps.
此外,本申请实施例进一步公开一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机可以执行上述实施例所描述的任意一种阴影生成方法中的全部或部分步骤。In addition, the embodiments of the present application further disclose a computer program product. When the computer program product is run on a computer, the computer can execute all or part of the steps in any shadow generation method described in the above embodiments.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质包括只读存储器(Read-Only Memory,ROM)、随机存储器(Random Access Memory,RAM)、可编程只读存储器(Programmable Read-only Memory,PROM)、可擦除可编程只读存储器 (Erasable Programmable Read Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子抹除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其它光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其它介质。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes read-only Memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), programmable read-only memory (Programmable Read-only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc (Compact Disc Read-Only Memory, CD-ROM) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
以上对本申请实施例公开的一种阴影生成方法及装置、电子设备、存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A shadow generation method and device, electronic equipment, and storage medium disclosed in the embodiments of the present application have been described above in detail. In this paper, specific examples are used to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used To help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation and application scope. In summary, this specification The content should not be construed as a limitation of the application.

Claims (22)

  1. 一种阴影生成方法,其特征在于,包括:A method for generating shadows, comprising:
    获取图形用户界面中待绘制的目标控件的轮廓数据;Obtain the outline data of the target control to be drawn in the GUI;
    根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径;According to the outline data, determine a shadow drawing path corresponding to the target control outside the outline range corresponding to the target control;
    按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像,所述阴影图像用于在所述目标控件对应的视图对象上实现阴影效果。According to the shadow drawing path, a shadow image corresponding to the target control is drawn through a blur mask filter, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
  2. 根据权利要求1所述的方法,其特征在于,所述轮廓数据包括轮廓形状,所述根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径,包括:The method according to claim 1, wherein the outline data includes an outline shape, and according to the outline data, the shadow drawing path corresponding to the target control is determined outside the outline range corresponding to the target control, include:
    将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外确定所述目标控件对应的阴影绘制路径。The outline shape is used as an inner frame of the shadow image corresponding to the target control, and a shadow drawing path corresponding to the target control is determined outside the inner frame.
  3. 根据权利要求2所述的方法,其特征在于,所述获取图形用户界面中待绘制的目标控件的轮廓数据,包括:The method according to claim 2, wherein said acquiring the outline data of the target control to be drawn in the GUI comprises:
    通过视图轮廓接口获取图形用户界面中待绘制的目标控件对应的形状数据;Obtain the shape data corresponding to the target control to be drawn in the GUI through the view outline interface;
    若所述形状数据包括自定义形状,则将所述自定义形状确定为所述目标控件的轮廓形状;若所述形状数据不包括自定义形状,则将默认形状确定为所述目标控件的轮廓形状。If the shape data includes a custom shape, then determine the custom shape as the outline shape of the target control; if the shape data does not include a custom shape, determine a default shape as the outline of the target control shape.
  4. 根据权利要求2所述的方法,其特征在于,所述将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外确定所述目标控件对应的阴影绘制路径,包括:The method according to claim 2, wherein the contour shape is used as an inner frame of the shadow image corresponding to the target control, and a shadow drawing path corresponding to the target control is determined outside the inner frame, include:
    获取阴影范围参数,所述阴影范围参数用于定义阴影绘制范围,所述阴影绘制范围不受所述目标控件的父控件对应的轮廓范围限制;Obtain a shadow range parameter, the shadow range parameter is used to define a shadow drawing range, and the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control;
    将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外,且符合所述阴影范围参数定义的所述阴影绘制范围内,确定所述目标控件对应的阴影绘制路径。Using the outline shape as the inner border of the shadow image corresponding to the target control, outside the inner border and within the shadow drawing range defined by the shadow range parameter, determine the shadow drawing corresponding to the target control path.
  5. 根据权利要求1至4任一项所述的方法,其特征在于,在所述根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径之前,所述方法还包括:The method according to any one of claims 1 to 4, characterized in that before the shadow drawing path corresponding to the target control is determined outside the contour range corresponding to the target control according to the contour data, the The method also includes:
    获取阴影效果参数,所述阴影效果参数至少包括阴影颜色、阴影模糊半径、阴影偏移参数、阴影圆角参数中的任意一种;Acquire shadow effect parameters, where the shadow effect parameters at least include any one of shadow color, shadow blur radius, shadow offset parameters, and shadow fillet parameters;
    所述根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径,包括:According to the outline data, determining the shadow drawing path corresponding to the target control outside the outline range corresponding to the target control includes:
    根据所述轮廓数据及所述阴影效果参数,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径。According to the outline data and the shadow effect parameters, a shadow drawing path corresponding to the target control is determined outside the outline range corresponding to the target control.
  6. 根据权利要求5所述的方法,其特征在于,所述按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像,包括:The method according to claim 5, wherein drawing the shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path comprises:
    根据所述阴影效果参数,确定所述模糊遮罩滤镜的模糊处理模式,所述模糊处理模式指的是所述模糊遮罩滤镜实现模糊效果的模式;According to the shadow effect parameter, determine the blur processing mode of the blur mask filter, and the blur processing mode refers to the mode in which the blur mask filter realizes a blur effect;
    按照所述阴影绘制路径,通过所述模糊遮罩滤镜的模糊处理模式绘制所述目标控件对应的阴影图像。According to the shadow drawing path, the shadow image corresponding to the target control is drawn through the blur processing mode of the blur mask filter.
  7. 根据权利要求5所述的方法,其特征在于,在所述按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像之前,所述方法还包括:The method according to claim 5, wherein before drawing the shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path, the method further comprises:
    获取所述图形用户界面对应的目标渲染管道;Obtain a target rendering pipeline corresponding to the GUI;
    所述按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像, 包括:The step of drawing a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path includes:
    在所述目标渲染管道为非纯硬件渲染管道的情况下,按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像。In the case that the target rendering pipeline is a non-pure hardware rendering pipeline, according to the shadow drawing path, a shadow image corresponding to the target control is drawn through a blur mask filter.
  8. 根据权利要求7所述的方法,其特征在于,在所述获取所述图形用户界面对应的目标渲染管道之后,所述方法还包括:The method according to claim 7, wherein after said acquiring the target rendering pipeline corresponding to said GUI, said method further comprises:
    在所述目标渲染管道为纯硬件渲染管道的情况下,根据所述阴影效果参数执行兼容处理操作,并通过画笔对象绘制所述目标控件对应的阴影图像;When the target rendering pipeline is a pure hardware rendering pipeline, perform compatible processing operations according to the shadow effect parameters, and draw a shadow image corresponding to the target control through a brush object;
    其中,所述兼容处理操作包括:Wherein, the compatible processing operations include:
    根据所述阴影效果参数调整所述画笔对象的属性参数,所述属性参数用于定义所述画笔对象的绘制效果;Adjust the attribute parameters of the brush object according to the shadow effect parameters, the attribute parameters are used to define the drawing effect of the brush object;
    或者,根据所述阴影效果参数确定所述画笔对象绘制所述阴影图像的阴影绘制范围。Or, determine a shadow drawing range in which the brush object draws the shadow image according to the shadow effect parameter.
  9. 根据权利要求1至4任一项所述的方法,其特征在于,在所述按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像之后,所述方法还包括:The method according to any one of claims 1 to 4, characterized in that, after drawing the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path, the method further includes :
    根据所述轮廓数据,绘制与所述阴影图像匹配的背景图像,并在所述目标控件对应的轮廓范围内,绘制与所述阴影图像匹配的前景图像。Draw a background image matching the shadow image according to the outline data, and draw a foreground image matching the shadow image within the outline range corresponding to the target control.
  10. 根据权利要求9所述的方法,其特征在于,所述根据所述轮廓数据,绘制与所述阴影图像匹配的背景图像,包括:The method according to claim 9, wherein said drawing a background image matching said shadow image according to said outline data comprises:
    获取背景图像资源;Get the background image resource;
    根据所述轮廓数据对所述背景图像资源进行预处理,得到与所述目标控件对应的轮廓范围匹配的处理图像资源;Preprocessing the background image resource according to the outline data to obtain a processed image resource matching the outline range corresponding to the target control;
    根据所述处理图像资源的图像类型,通过画笔对象绘制与所述阴影图像匹配的背景图像。According to the image type of the processed image resource, a background image matching the shadow image is drawn through a brush object.
  11. 一种阴影生成装置,其特征在于,包括:A shadow generating device is characterized by comprising:
    轮廓获取单元,用于获取图形用户界面中待绘制的目标控件的轮廓数据;an outline acquiring unit, configured to acquire outline data of the target control to be drawn in the graphical user interface;
    路径确定单元,用于根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径;a path determining unit, configured to determine a shadow drawing path corresponding to the target control outside the range of the contour corresponding to the target control according to the contour data;
    阴影绘制单元,用于按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像,所述阴影图像用于在所述目标控件对应的视图对象上实现阴影效果。The shadow drawing unit is configured to draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path, and the shadow image is used to realize a shadow effect on a view object corresponding to the target control.
  12. 根据权利要求11所述的阴影生成装置,其特征在于,所述轮廓数据包括轮廓形状,所述路径确定单元在用于根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径时,包括:The shadow generation device according to claim 11, wherein the contour data includes a contour shape, and the path determination unit is used to determine the contour outside the contour range corresponding to the target control according to the contour data. When drawing the path for the shadow corresponding to the target control, it includes:
    将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外确定所述目标控件对应的阴影绘制路径。The outline shape is used as an inner frame of the shadow image corresponding to the target control, and a shadow drawing path corresponding to the target control is determined outside the inner frame.
  13. 根据权利要求12所述的阴影生成装置,其特征在于,所述轮廓获取单元在用于获取图形用户界面中待绘制的目标控件的轮廓数据时,包括:The shadow generation device according to claim 12, wherein when the outline acquisition unit is used to acquire the outline data of the target control to be drawn in the GUI, it comprises:
    通过视图轮廓接口获取图形用户界面中待绘制的目标控件对应的形状数据;Obtain the shape data corresponding to the target control to be drawn in the GUI through the view outline interface;
    若所述形状数据包括自定义形状,则将所述自定义形状确定为所述目标控件的轮廓形状;若所述形状数据不包括自定义形状,则将默认形状确定为所述目标控件的轮廓形状。If the shape data includes a custom shape, then determine the custom shape as the outline shape of the target control; if the shape data does not include a custom shape, determine a default shape as the outline of the target control shape.
  14. 根据权利要求12所述的阴影生成装置,其特征在于,所述路径确定单元在用于将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外确定所述目标控件对应的阴影绘制路径时,包括:The shadow generating device according to claim 12, wherein the path determination unit determines the inner border of the shadow image corresponding to the target control, and determines the inner border outside the inner border. When drawing the path for the shadow corresponding to the target control, it includes:
    获取阴影范围参数,所述阴影范围参数用于定义阴影绘制范围,所述阴影绘制范围不受所述目标控件的父控件对应的轮廓范围限制;Obtain a shadow range parameter, the shadow range parameter is used to define a shadow drawing range, and the shadow drawing range is not limited by the outline range corresponding to the parent control of the target control;
    将所述轮廓形状作为所述目标控件对应的阴影图像的内边框,在所述内边框外,且符合所述阴影范围参数定义的所述阴影绘制范围内,确定所述目标控件对应的阴影绘制路径。Using the outline shape as the inner border of the shadow image corresponding to the target control, outside the inner border and within the shadow drawing range defined by the shadow range parameter, determine the shadow drawing corresponding to the target control path.
  15. 根据权利要求11至14任一项所述的阴影生成装置,其特征在于,所述阴影生成装置还包括:The shadow generation device according to any one of claims 11 to 14, wherein the shadow generation device further comprises:
    第一获取单元,用于在所述路径确定单元根据所述轮廓数据,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径之前,获取阴影效果参数,所述阴影效果参数至少包括阴影颜色、阴影模糊半径、阴影偏移参数、阴影圆角参数中的任意一种;The first acquiring unit is configured to acquire shadow effect parameters before the path determination unit determines the shadow drawing path corresponding to the target control outside the contour range corresponding to the target control according to the contour data, and the shadow effect The parameters include at least any one of shadow color, shadow blur radius, shadow offset parameter, and shadow fillet parameter;
    所述路径确定单元,还用于根据所述轮廓数据及所述阴影效果参数,在所述目标控件对应的轮廓范围外确定所述目标控件对应的阴影绘制路径。The path determining unit is further configured to determine a shadow drawing path corresponding to the target control outside the range of the outline corresponding to the target control according to the outline data and the shadow effect parameters.
  16. 根据权利要求15所述的阴影生成装置,其特征在于,所述阴影绘制单元,还用于根据所述阴影效果参数,确定所述模糊遮罩滤镜的模糊处理模式,所述模糊处理模式指的是所述模糊遮罩滤镜实现模糊效果的模式;以及,按照所述阴影绘制路径,通过所述模糊遮罩滤镜的模糊处理模式绘制所述目标控件对应的阴影图像。The shadow generating device according to claim 15, wherein the shadow drawing unit is further configured to determine the blur processing mode of the blur mask filter according to the shadow effect parameters, and the blur processing mode refers to is the mode in which the blur mask filter realizes the blur effect; and, according to the shadow drawing path, the shadow image corresponding to the target control is drawn through the blur processing mode of the blur mask filter.
  17. 根据权利要求15所述的阴影生成装置,其特征在于,所述阴影生成装置还包括:The shadow generation device according to claim 15, wherein the shadow generation device further comprises:
    第二获取单元,用于在所述阴影绘制单元按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像之前,获取所述图形用户界面对应的目标渲染管道;The second acquiring unit is configured to acquire the target rendering pipeline corresponding to the GUI before the shadow drawing unit draws the shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path;
    所述阴影绘制单元,还用于在所述目标渲染管道为非纯硬件渲染管道的情况下,按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像。The shadow drawing unit is further configured to draw a shadow image corresponding to the target control through a blur mask filter according to the shadow drawing path when the target rendering pipeline is not a pure hardware rendering pipeline.
  18. 根据权利要求17所述的阴影生成装置,其特征在于,所述阴影生成装置还包括:The shadow generation device according to claim 17, wherein the shadow generation device further comprises:
    兼容单元,用于在所述第二获取单元获取所述图形用户界面对应的目标渲染管道之后,在所述目标渲染管道为纯硬件渲染管道的情况下,根据所述阴影效果参数执行兼容处理操作,并通过画笔对象绘制所述目标控件对应的阴影图像;A compatibility unit, configured to perform a compatible processing operation according to the shadow effect parameter if the target rendering pipeline is a pure hardware rendering pipeline after the second acquiring unit acquires the target rendering pipeline corresponding to the GUI , and draw the shadow image corresponding to the target control through the brush object;
    其中,所述兼容处理操作包括:Wherein, the compatible processing operations include:
    根据所述阴影效果参数调整所述画笔对象的属性参数,所述属性参数用于定义所述画笔对象的绘制效果;Adjust the attribute parameters of the brush object according to the shadow effect parameters, the attribute parameters are used to define the drawing effect of the brush object;
    或者,根据所述阴影效果参数确定所述画笔对象绘制所述阴影图像的阴影绘制范围。Or, determine a shadow drawing range in which the brush object draws the shadow image according to the shadow effect parameter.
  19. 根据权利要求11至14任一项所述的阴影生成装置,其特征在于,所述阴影生成装置还包括:The shadow generation device according to any one of claims 11 to 14, wherein the shadow generation device further comprises:
    前后景绘制单元,用于在所述阴影绘制单元按照所述阴影绘制路径,通过模糊遮罩滤镜绘制所述目标控件对应的阴影图像之后,根据所述轮廓数据,绘制与所述阴影图像匹配的背景图像,并在所述目标控件对应的轮廓范围内,绘制与所述阴影图像匹配的前景图像。A foreground and background drawing unit, configured to draw a shadow image matching the shadow image according to the outline data after the shadow drawing unit draws the shadow image corresponding to the target control through the blur mask filter according to the shadow drawing path. and draw a foreground image matching the shadow image within the outline range corresponding to the target control.
  20. 根据权利要求19所述的阴影生成装置,其特征在于,所述前后景绘制单元在用于根据所述轮廓数据,绘制与所述阴影图像匹配的背景图像时,包括:The shadow generation device according to claim 19, wherein when the foreground and background drawing unit is used to draw a background image matching the shadow image according to the outline data, it includes:
    获取背景图像资源;Get the background image resource;
    根据所述轮廓数据对所述背景图像资源进行预处理,得到与所述目标控件对应的轮廓范围匹配的处理图像资源;Preprocessing the background image resource according to the outline data to obtain a processed image resource matching the outline range corresponding to the target control;
    根据所述处理图像资源的图像类型,通过画笔对象绘制与所述阴影图像匹配的背景图像。According to the image type of the processed image resource, a background image matching the shadow image is drawn through a brush object.
  21. 一种电子设备,其特征在于,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如权利要求1至10任一项所述的阴影生成方法。An electronic device, characterized by comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor realizes any one of claims 1 to 10. The shadow generation method described in Item .
  22. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的阴影生成方法。A computer-readable storage medium on which a computer program is stored, wherein the computer program implements the shadow generation method according to any one of claims 1 to 10 when executed by a processor.
PCT/CN2022/117107 2021-09-07 2022-09-05 Shadow generation method and apparatus, electronic device and storage medium WO2023036089A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111044692.6A CN115774590A (en) 2021-09-07 2021-09-07 Shadow generation method and device, electronic equipment and storage medium
CN202111044692.6 2021-09-07

Publications (1)

Publication Number Publication Date
WO2023036089A1 true WO2023036089A1 (en) 2023-03-16

Family

ID=85387656

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/117107 WO2023036089A1 (en) 2021-09-07 2022-09-05 Shadow generation method and apparatus, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN115774590A (en)
WO (1) WO2023036089A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116483359A (en) * 2023-04-25 2023-07-25 成都赛力斯科技有限公司 New mimicry drawing method and device, electronic equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137238A1 (en) * 2010-11-29 2012-05-31 Microsoft Corporation Data visualization interface including range control and treemap integration
CN107346250A (en) * 2017-07-16 2017-11-14 北京酷我科技有限公司 A kind of stacking display algorithm of the progress bar of breath light effect
CN110389761A (en) * 2018-04-20 2019-10-29 广州优视网络科技有限公司 Shade drafting method, device, terminal and computer readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120137238A1 (en) * 2010-11-29 2012-05-31 Microsoft Corporation Data visualization interface including range control and treemap integration
CN107346250A (en) * 2017-07-16 2017-11-14 北京酷我科技有限公司 A kind of stacking display algorithm of the progress bar of breath light effect
CN110389761A (en) * 2018-04-20 2019-10-29 广州优视网络科技有限公司 Shade drafting method, device, terminal and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MING LANG: "Customized View uses BlurMaskFilter to implement a shadow effect", HTTPS://WWW.JIANSHU.COM/P/AFBFB7B310A0, WWW.JIANSHU.COM, JP, 22 June 2017 (2017-06-22), JP, pages 1 - 9, XP093047263, Retrieved from the Internet <URL:https://www.jianshu.com/p/afbfb7b310a0> [retrieved on 20230516] *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116483359A (en) * 2023-04-25 2023-07-25 成都赛力斯科技有限公司 New mimicry drawing method and device, electronic equipment and readable storage medium
CN116483359B (en) * 2023-04-25 2024-03-12 重庆赛力斯凤凰智创科技有限公司 New mimicry drawing method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN115774590A (en) 2023-03-10

Similar Documents

Publication Publication Date Title
EP3944080B1 (en) A method, an apparatus and a computer program product for creating a user interface view
WO2020088021A1 (en) Terminal screen, screen structure and control method therefor, apparatus, and terminal
CN111508039B (en) Word processing method of ink screen and communication terminal
CN104038807A (en) Layer mixing method and device based on open graphics library (OpenGL)
EP2329313A2 (en) Improvements in and relating to electronic visual displays
CN109298912B (en) Theme color adjusting method and device, storage medium and electronic equipment
US20130044123A1 (en) User-specified image colorization for application user interface
US8830251B2 (en) Method and system for creating an image
US11183105B2 (en) Display panel and device, image processing method and device, and virtual reality system
WO2023036089A1 (en) Shadow generation method and apparatus, electronic device and storage medium
CN111338743B (en) Interface processing method and device and storage medium
JP2003076355A (en) Picture display device, picture display method, recording medium, and program
CN115546410A (en) Window display method and device, electronic equipment and storage medium
CN113038141B (en) Video frame processing method and electronic equipment
CN110618852A (en) View processing method, view processing device and terminal equipment
US10699663B2 (en) Providing an image with a scaler chip in direct communication with an eye tracking device
CN108604367B (en) Display method and handheld electronic device
CA2711586A1 (en) Multi-format support for surface creation in a graphics processing system
CN113393391B (en) Image enhancement method, image enhancement device, electronic apparatus, and storage medium
CN113805830B (en) Distribution display method and related equipment
CN112653788B (en) User interface display method, mobile terminal and storage medium
US11341729B2 (en) Method and electronic device for correcting external reality pixels and virtual content pixels within an augmented reality environment
US20120313954A1 (en) Optimized on-screen video composition for mobile device
CN115116406B (en) Method, equipment, system and medium for compensating front bright point of reflecting screen module
CN116483359B (en) New mimicry drawing method and device, electronic equipment and readable storage medium

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: 22866552

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE