• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup RenderNodeDisplay
18  * @{
19  *
20  * @brief Display render nodes.
21  */
22 
23 /**
24  * @file rs_modifier_extractor.h
25  *
26  * @brief Defines the properties and methods for RSModifierExtractor class.
27  *
28  * Used to get the properties of the modifier.
29  */
30 #ifndef RENDER_SERVICE_CLIENT_CORE_MODIFIER_RS_MODIFIER_EXTRACTOR_H
31 #define RENDER_SERVICE_CLIENT_CORE_MODIFIER_RS_MODIFIER_EXTRACTOR_H
32 
33 #include "common/rs_common_def.h"
34 #include "property/rs_properties.h"
35 #include "property/rs_properties_def.h"
36 
37 namespace OHOS {
38 namespace Rosen {
39 class RSNode;
40 class RSUIContext;
41 
42 /**
43  * @class RSModifierExtractor
44  *
45  * @brief The class for extracting properties from a modifier.
46  */
47 class RSC_EXPORT RSModifierExtractor {
48 public:
49     /**
50      * @brief Constructor for RSModifierExtractor.
51      *
52      * @param id The ID of the node to extract modifiers from.
53      * @param rsUIContext The RSUIContext to use for extracting modifiers.Default is nullptr.
54      */
55     RSModifierExtractor(NodeId id, std::shared_ptr<RSUIContext> rsUIContext = nullptr);
56 
57     /**
58      * @brief Destructor for RSModifierExtractor.
59      */
60     virtual ~RSModifierExtractor() = default;
61 
62     /**
63      * @brief Gets the bounds of modifier.
64      *
65      * @return A Vector4f object representing the bounds.
66      */
67     Vector4f GetBounds() const;
68 
69     /**
70      * @brief Gets the frame of modifier.
71      *
72      * @return A Vector4f object representing the frame.
73      */
74     Vector4f GetFrame() const;
75 
76     /**
77      * @brief Gets the positionZ of modifier.
78      *
79      * @return A float representing the positionZ.
80      */
81     float GetPositionZ() const;
82 
83     /**
84      * @brief Gets the pivot of modifier.
85      *
86      * @return A Vector2f object representing the pivot of x and y axes.
87      */
88     Vector2f GetPivot() const;
89 
90     /**
91      * @brief Gets the pivotZ of modifier.
92      *
93      * @return A float representing the pivot of z-axis.
94      */
95     float GetPivotZ() const;
96 
97     /**
98      * @brief Gets the Quaternion of modifier.
99      *
100      * @return A Quaternion object.
101      */
102     Quaternion GetQuaternion() const;
103 
104     /**
105      * @brief Gets the rotation of modifier.
106      *
107      * @return A float representing the rotation.
108      */
109     float GetRotation() const;
110 
111     /**
112      * @brief Gets the rotationX of modifier.
113      *
114      * @return A float representing the rotation of x-axis.
115      */
116     float GetRotationX() const;
117 
118     /**
119      * @brief Gets the rotationY of modifier.
120      *
121      * @return A float representing the rotation of y-axis.
122      */
123     float GetRotationY() const;
124 
125     /**
126      * @brief Gets the distance of the camera.
127      *
128      * @return The distance of the camera.
129      */
130     float GetCameraDistance() const;
131 
132     /**
133      * @brief Gets the translate of modifier on the x and y axes.
134      *
135      * @return A Vector2f object representing the translation distance.
136      */
137     Vector2f GetTranslate() const;
138 
139     /**
140      * @brief Gets the translate of modifier on the z-axis.
141      *
142      * @return A float representing the translation distance on the z-axis.
143      */
144     float GetTranslateZ() const;
145 
146     /**
147      * @brief Gets the scale of modifier.
148      *
149      * @return A Vector2f object representing the scale  on the x and y axes.
150      */
151     Vector2f GetScale() const;
152 
153     /**
154      * @brief Gets the scale of modifier on the z-axis.
155      *
156      * @return A float representing the scale on the z-axis.
157      */
158     float GetScaleZ() const;
159 
160     /**
161      * @brief Gets the skew of modifier.
162      *
163      * @return A Vector3f object representing the skew.
164      */
165     Vector3f GetSkew() const;
166 
167     /**
168      * @brief Gets the perspective of modifier.
169      *
170      * @return A Vector4f object representing the perspective.
171      */
172     Vector4f GetPersp() const;
173 
174     /**
175      * @brief Gets the alpha of modifier.
176      *
177      * @return The alpha of the modifier.
178      */
179     float GetAlpha() const;
180 
181     /**
182      * @brief Gets the offscreen alpha of modifier.
183      *
184      * @return true if offscreen alpha is enabled; false otherwise.
185      */
186     bool GetAlphaOffscreen() const;
187 
188     /**
189      * @brief Gets the corner radius of modifier.
190      *
191      * @return A Vector4f representing the corner radius for each corner.
192      */
193     Vector4f GetCornerRadius() const;
194 
195     /**
196      * @brief Gets the foreground color of modifier.
197      *
198      * @return The foreground color.
199      */
200     Color GetForegroundColor() const;
201 
202     /**
203      * @brief Gets the background color of modifier.
204      *
205      * @return The backround color.
206      */
207     Color GetBackgroundColor() const;
208 
209     /**
210      * @brief Gets the background shader of modifier.
211      *
212      * @return The pointer to background shader.
213      */
214     std::shared_ptr<RSShader> GetBackgroundShader() const;
215 
216     /**
217      * @brief Gets the background image.
218      *
219      * @return A shared pointer to the RSImage representing the background image.
220      */
221     std::shared_ptr<RSImage> GetBgImage() const;
222 
223     /**
224      * @brief Gets the background image width.
225      *
226      * @return The width of the background image.
227      */
228     float GetBgImageWidth() const;
229 
230     /**
231      * @brief Gets the background image height.
232      *
233      * @return The height of the background image.
234      */
235     float GetBgImageHeight() const;
236 
237     /**
238      * @brief Gets the background image position on the x-axis.
239      *
240      * @return The x-coordinate of the background image position.
241      */
242     float GetBgImagePositionX() const;
243 
244     /**
245      * @brief Gets the background image position on the y-axis.
246      *
247      * @return The y-coordinate of the background image position.
248      */
249     float GetBgImagePositionY() const;
250 
251     /**
252      * @brief Gets the border color.
253      *
254      * @return A Vector4 containing the colors of the border.
255      */
256     Vector4<Color> GetBorderColor() const;
257 
258     /**
259      * @brief Gets the border width.
260      *
261      * @return A Vector4f containing the widths of the border.
262      */
263     Vector4f GetBorderWidth() const;
264 
265     /**
266      * @brief Gets the border style.
267      *
268      * @return A Vector4 containing the styles of the border.
269      */
270     Vector4<uint32_t> GetBorderStyle() const;
271 
272     /**
273      * @brief Gets the width of border dash.
274      *
275      * @return A Vector4f containing the width of the border dash.
276      */
277     Vector4f GetBorderDashWidth() const;
278 
279     /**
280      * @brief Gets the gap of border dash.
281      *
282      * @return A Vector4f containing the gap of the border dash.
283      */
284     Vector4f GetBorderDashGap() const;
285 
286     /**
287      * @brief Gets the outline color.
288      *
289      * @return A Vector4 containing the colors of the Outline.
290      */
291     Vector4<Color> GetOutlineColor() const;
292 
293     /**
294      * @brief Gets the outline width.
295      *
296      * @return A Vector4f containing the widths of the Outline
297      */
298     Vector4f GetOutlineWidth() const;
299 
300     /**
301      * @brief Gets the outline style.
302      *
303      * @return A Vector4 containing the styles of the Outline.
304      */
305     Vector4<uint32_t> GetOutlineStyle() const;
306 
307     /**
308      * @brief Gets the outline dash width.
309      *
310      * @return A Vector4f containing the width of the Outline dash.
311      */
312     Vector4f GetOutlineDashWidth() const;
313 
314     /**
315      * @brief Gets the outline dash gap.
316      *
317      * @return A Vector4f containing the gap of the Outline dash.
318      */
319     Vector4f GetOutlineDashGap() const;
320 
321     /**
322      * @brief Gets the outline radius.
323      *
324      * @return A Vector4f containing the radius of the Outline.
325      */
326     Vector4f GetOutlineRadius() const;
327 
328     /**
329      * @brief Gets the radius of foreground effect.
330      *
331      * @return The radius of the foreground effect.
332      */
333     float GetForegroundEffectRadius() const;
334 
335     /**
336      * @brief Gets the color of shadow.
337      *
338      * @return The color of shadow.
339      */
340     Color GetShadowColor() const;
341 
342     /**
343      * @brief Gets the X-axis offset of shadow.
344      *
345      * @return The X-axis offset of the shadow.
346      */
347     float GetShadowOffsetX() const;
348 
349     /**
350      * @brief Gets the Y-axis offset of shadow.
351      *
352      * @return The Y-axis offset of the shadow.
353      */
354     float GetShadowOffsetY() const;
355 
356     /**
357      * @brief Gets the alpha of shadow.
358      *
359      * @return The alpha value of the shadow.
360      */
361     float GetShadowAlpha() const;
362 
363     /**
364      * @brief Gets the elevation of shadow.
365      *
366      * @return The elevation of the shadow.
367      */
368     float GetShadowElevation() const;
369 
370     /**
371      * @brief Gets the radius of shadow.
372      *
373      * @return The radius of the shadow.
374      */
375     float GetShadowRadius() const;
376 
377     /**
378      * @brief Gets the shadow path.
379      *
380      * @return A shared pointer to the RSPath representing the shadow path.
381      */
382     std::shared_ptr<RSPath> GetShadowPath() const;
383 
384     /**
385      * @brief Gets the shadow mask.
386      *
387      * @return  The strategy for shadow Mask.
388      */
389     int GetShadowMask() const;
390 
391     /**
392      * @brief Gets the shadow fill status.
393      *
394      * @return true if shadow is filled; false otherwise.
395      */
396     bool GetShadowIsFilled() const;
397 
398     /**
399      * @brief Gets the strategy for shadow color.
400      *
401      * @return The strategy for shadow color.
402      */
403     int GetShadowColorStrategy() const;
404 
405     /**
406      * @brief Gets the gravity of the frame.
407      *
408      * @return The gravity of the frame.
409      */
410     Gravity GetFrameGravity() const;
411 
412     /**
413      * @brief Gets the bounds of the clip.
414      *
415      * @return A shared pointer to the RSPath representing the clip bounds.
416      */
417     std::shared_ptr<RSPath> GetClipBounds() const;
418 
419     /**
420      * @brief Gets whether enabled to clip to bounds.
421      *
422      * @return true if clipping to bounds is enabled; false otherwise.
423      */
424     bool GetClipToBounds() const;
425 
426     /**
427      * @brief Gets whether enabled to clip to frame.
428      *
429      * @return true if clipping to frame is enabled; false otherwise.
430      */
431     bool GetClipToFrame() const;
432 
433     /**
434      * @brief Gets whether the modifier is visible.
435      *
436      * @return true if the modifier is visible; false otherwise.
437      */
438     bool GetVisible() const;
439 
440     std::shared_ptr<RSMask> GetMask() const;
441 
442     /**
443      * @brief Gets the degree of sphericity.
444      *
445      * @return The spherize degree.
446      */
447     float GetSpherizeDegree() const;
448 
449     /**
450      * @brief Gets the brightness ratio of HDR UI component.
451      *
452      * @return The HDR UI component brightness ratio.
453      */
454     float GetHDRUIBrightness() const;
455 
456     /**
457      * @brief Gets the HDR brightness factor of displayNode.
458      *
459      * @return The HDR brightness factor of displayNode.
460      */
461     float GetHDRBrightnessFactor() const;
462 
463     /**
464      * @brief Gets the degree of light up effect.
465      *
466      * @return The light up effect degree.
467      */
468     float GetLightUpEffectDegree() const;
469 
470     /**
471      * @brief Gets the degree of dynamic dimension.
472      *
473      * @return The dynamic dimension degree.
474      */
475     float GetDynamicDimDegree() const;
476 
477     /**
478      * @brief Gets the transformation progress of the meteor animation effect.
479      *
480      * @return The transformation progress of the meteor animation effect.
481      */
482     float GetAttractionFractionValue() const;
483 
484     /**
485      * @brief Gets the destination point of the meteor animation effect.
486      *
487      * @return The destination point of the meteor animation effect.
488      */
489     Vector2f GetAttractionDstPointValue() const;
490 
491     /**
492      * @brief Gets the radius used for background blur.
493      *
494      * @return The radius used for background blur.
495      */
496     float GetBackgroundBlurRadius() const;
497 
498     /*
499      * @brief Gets the saturation of background blur.
500      *
501      * @return The saturation of background blur.
502      */
503     float GetBackgroundBlurSaturation() const;
504 
505     /**
506      * @brief Gets the brightness of background blur.
507      *
508      * @return The brightness of background blur.
509      */
510     float GetBackgroundBlurBrightness() const;
511 
512     /**
513      * @brief Gets the color of background blur mask.
514      *
515      * @return The color of background blur mask.
516      */
517     Color GetBackgroundBlurMaskColor() const;
518 
519     /**
520      * @brief Gets the color mode of background blur.
521      *
522      * @return The color mode of background blur.
523      */
524     int GetBackgroundBlurColorMode() const;
525 
526     /**
527      * @brief Gets the radius of background blur on the x-axis.
528      *
529      * @return The radius of background blur on the x-axis.
530      */
531     float GetBackgroundBlurRadiusX() const;
532 
533     /**
534      * @brief Gets the radius of background blur on the y-axis.
535      *
536      * @return The radius of background blur on the y-axis.
537      */
538     float GetBackgroundBlurRadiusY() const;
539 
540     /**
541      * @brief Gets whether system adaptation is disabled for background blur.
542      *
543      * @return true if system adaptation is disabled; false otherwise.
544      */
545     bool GetBgBlurDisableSystemAdaptation() const;
546 
547     /**
548      * @brief Gets whether the modifier is always in snapshot mode.
549      *
550      * @return true if always in snapshot mode; false otherwise.
551      */
552     bool GetAlwaysSnapshot() const;
553 
554     /**
555      * @brief Gets the foreground blur radius.
556      *
557      * @return The foreground blur radius.
558      */
559     float GetForegroundBlurRadius() const;
560 
561     /**
562      * @brief Gets the saturation of foreground blur.
563      *
564      * @return The saturation of foreground blur.
565      */
566     float GetForegroundBlurSaturation() const;
567 
568     /**
569      * @brief Gets the brightness of foreground blur.
570      *
571      * @return The brightness of foreground blur.
572      */
573     float GetForegroundBlurBrightness() const;
574 
575     /**
576      * @brief Gets the color of foreground blur mask.
577      *
578      * @return The color of foreground blur mask.
579      */
580     Color GetForegroundBlurMaskColor() const;
581 
582     /**
583      * @brief Gets the color mode of foreground blur.
584      *
585      * @return The color mode of foreground blur.
586      */
587     int GetForegroundBlurColorMode() const;
588 
589     /**
590      * @brief Gets the radius of foreground blur on the x-axis.
591      *
592      * @return The radius of foreground blur on the x-axis.
593      */
594     float GetForegroundBlurRadiusX() const;
595 
596     /**
597      * @brief Gets the radius of foreground blur on the y-axis.
598      *
599      * @return The radius of foreground blur on the y-axis.
600      */
601     float GetForegroundBlurRadiusY() const;
602 
603     /**
604      * @brief Gets whether system adaptation is disabled for foreground blur.
605      *
606      * @return true if system adaptation is disabled; false otherwise.
607      */
608     bool GetFgBlurDisableSystemAdaptation() const;
609 
610     /**
611      * @brief Gets light intensity.
612      *
613      * @return The light intensity.
614      */
615     float GetLightIntensity() const;
616 
617     /**
618      * @brief Gets light color.
619      *
620      * @return The light color.
621      */
622     Color GetLightColor() const;
623 
624     /**
625      * @brief Gets light position.
626      *
627      * @return The light position.
628      */
629     Vector4f GetLightPosition() const;
630 
631     /**
632      * @brief Gets the width of the illuminated border.
633      *
634      * @return The width of the illuminated border.
635      */
636     float GetIlluminatedBorderWidth() const;
637 
638     /**
639      * @brief Gets the type of the illuminated.
640      *
641      * @return The type of the illuminated.
642      */
643     int GetIlluminatedType() const;
644 
645     /**
646      * @brief Gets the bloom value.
647      *
648      * @return The bloom value.
649      */
650     float GetBloom() const;
651 
652     /**
653      * @brief Gets the mode of color blend.
654      *
655      * @return The mode of color blend.
656      */
657     int GetColorBlendMode() const;
658 
659     /**
660      * @brief Gets the application type of color blending.
661      *
662      * @return The application type of color blending.
663      */
664     int GetColorBlendApplyType() const;
665 
666     /**
667      * @brief Generates debugging information.
668      *
669      * @return The debug information.
670      */
671     std::string Dump() const;
672 private:
673     Vector4f GetBgImageDstRect() const;
674 
675     NodeId id_;
676     std::weak_ptr<RSUIContext> rsUIContext_;
677 };
678 } // namespace Rosen
679 } // namespace OHOS
680 
681 /** @} */
682 #endif // RENDER_SERVICE_CLIENT_CORE_MODIFIER_RS_MODIFIER_EXTRACTOR_H
683