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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_ADAPTER_ROSEN_RENDER_CONTEXT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_ADAPTER_ROSEN_RENDER_CONTEXT_H 18 19 #include <cstdint> 20 #include <memory> 21 #include <optional> 22 #include <utility> 23 24 #include "include/core/SkCanvas.h" 25 #include "include/core/SkPictureRecorder.h" 26 #include "include/core/SkRefCnt.h" 27 #include "render_service_client/core/animation/rs_particle_params.h" 28 #include "render_service_client/core/ui/rs_node.h" 29 30 #include "base/geometry/dimension_offset.h" 31 #include "base/geometry/ng/offset_t.h" 32 #include "base/geometry/ng/rect_t.h" 33 #include "base/utils/noncopyable.h" 34 #include "core/components/common/properties/color.h" 35 #include "core/components_ng/event/event_hub.h" 36 #include "core/components_ng/image_provider/image_loading_context.h" 37 #include "core/components_ng/property/measure_property.h" 38 #include "core/components_ng/property/progress_mask_property.h" 39 #include "core/components_ng/render/adapter/graphic_modifier.h" 40 #include "core/components_ng/render/adapter/moon_progress_modifier.h" 41 #include "core/components_ng/render/adapter/rosen_modifier_property.h" 42 #include "core/components_ng/render/adapter/rosen_transition_effect.h" 43 #include "core/components_ng/render/render_context.h" 44 45 namespace OHOS::Ace::NG { 46 class BackgroundModifier; 47 class BorderImageModifier; 48 class DebugBoundaryModifier; 49 class MouseSelectModifier; 50 class FocusStateModifier; 51 class PageTransitionEffect; 52 class OverlayTextModifier; 53 class GradientStyleModifier; 54 class RosenRenderContext : public RenderContext { 55 DECLARE_ACE_TYPE(RosenRenderContext, NG::RenderContext) 56 public: 57 RosenRenderContext() = default; 58 ~RosenRenderContext() override; 59 60 void SetSurfaceChangedCallBack(const std::function<void(float, float, float, float)>& callback) override; 61 62 void RemoveSurfaceChangedCallBack() override; 63 64 void InitContext(bool isRoot, const std::optional<ContextParam>& param) override; 65 66 void SyncGeometryProperties(GeometryNode* geometryNode) override; 67 68 void SyncGeometryProperties(const RectF& paintRect) override; 69 70 void SetSandBox(const std::optional<OffsetF>& parentPosition) override; 71 72 void RebuildFrame(FrameNode* self, const std::list<RefPtr<FrameNode>>& children) override; 73 74 void AddFrameChildren(FrameNode* self, const std::list<RefPtr<FrameNode>>& children) override; 75 76 void RemoveFrameChildren(FrameNode* self, const std::list<RefPtr<FrameNode>>& children) override; 77 78 void MoveFrame(FrameNode* self, const RefPtr<FrameNode>& child, int32_t index) override; 79 80 void OnModifyDone() override; 81 82 void ResetBlendBgColor() override; 83 84 void BlendBgColor(const Color& color) override; 85 86 void ResetBlendBorderColor() override; 87 88 void BlendBorderColor(const Color& color) override; 89 90 // Paint focus state by component's setting. It will paint along the paintRect 91 void PaintFocusState(const RoundRect& paintRect, const Color& paintColor, const Dimension& paintWidth, 92 bool isAccessibilityFocus = false) override; 93 // Paint focus state by component's setting. It will paint along the frameRect(padding: focusPaddingVp) 94 void PaintFocusState(const RoundRect& paintRect, const Dimension& focusPaddingVp, const Color& paintColor, 95 const Dimension& paintWidth, bool isAccessibilityFocus = false) override; 96 // Paint focus state by default. It will paint along the component rect(padding: focusPaddingVp) 97 void PaintFocusState( 98 const Dimension& focusPaddingVp, const Color& paintColor, const Dimension& paintWidth) override; 99 100 void ClearFocusState() override; 101 102 const std::shared_ptr<Rosen::RSNode>& GetRSNode(); 103 104 void SetRSNode(const std::shared_ptr<Rosen::RSNode>& rsNode); 105 106 void StartRecording() override; 107 108 void StopRecordingIfNeeded() override; 109 SetDrawContentAtLast(bool useDrawContentLastOrder)110 void SetDrawContentAtLast(bool useDrawContentLastOrder) override 111 { 112 CHECK_NULL_VOID(rsNode_); 113 rsNode_->SetPaintOrder(useDrawContentLastOrder); 114 } 115 SetClipToFrame(bool useClip)116 void SetClipToFrame(bool useClip) override 117 { 118 CHECK_NULL_VOID(rsNode_); 119 rsNode_->SetClipToFrame(useClip); 120 } 121 SetClipToBounds(bool useClip)122 void SetClipToBounds(bool useClip) override 123 { 124 CHECK_NULL_VOID(rsNode_); 125 rsNode_->SetClipToBounds(useClip); 126 } 127 SetVisible(bool visible)128 void SetVisible(bool visible) override 129 { 130 CHECK_NULL_VOID(rsNode_); 131 rsNode_->SetVisible(visible); 132 } 133 134 void FlushContentDrawFunction(CanvasDrawFunction&& contentDraw) override; 135 136 void FlushForegroundDrawFunction(CanvasDrawFunction&& foregroundDraw) override; 137 138 void FlushOverlayDrawFunction(CanvasDrawFunction&& overlayDraw) override; 139 140 void AnimateHoverEffectScale(bool isHovered) override; 141 void AnimateHoverEffectBoard(bool isHovered) override; 142 void UpdateBackBlurRadius(const Dimension& radius) override; 143 void UpdateBackBlurStyle(const std::optional<BlurStyleOption>& bgBlurStyle) override; 144 void UpdateBackgroundEffect(const std::optional<EffectOption>& effectOption) override; 145 void UpdateFrontBlurRadius(const Dimension& radius) override; 146 void UpdateFrontBlurStyle(const std::optional<BlurStyleOption>& fgBlurStyle) override; 147 void ResetBackBlurStyle() override; 148 void OnSphericalEffectUpdate(double radio) override; 149 void OnPixelStretchEffectUpdate(const PixStretchEffectOption& option) override; 150 void OnLightUpEffectUpdate(double radio) override; 151 void OnParticleOptionArrayUpdate(const std::list<ParticleOption>& optionList) override; 152 153 void OnBackShadowUpdate(const Shadow& shadow) override; 154 void UpdateBorderWidthF(const BorderWidthPropertyF& value) override; 155 156 void OnTransformMatrixUpdate(const Matrix4& matrix) override; 157 158 void UpdateTransition(const TransitionOptions& options) override; 159 void UpdateChainedTransition(const RefPtr<NG::ChainedTransitionEffect>& effect) override; HasAppearingTransition()160 bool HasAppearingTransition() const 161 { 162 return propTransitionAppearing_ != nullptr; 163 } HasDisappearingTransition()164 bool HasDisappearingTransition() const 165 { 166 return propTransitionDisappearing_ != nullptr; 167 } 168 void OnNodeAppear(bool recursive) override; 169 void OnNodeDisappear(bool recursive) override; 170 void ClipWithRect(const RectF& rectF) override; 171 void ClipWithRRect(const RectF& rectF, const RadiusF& radiusF) override; 172 173 bool TriggerPageTransition(PageTransitionType type, const std::function<void()>& onFinish) override; 174 175 void SetSharedTranslate(float xTranslate, float yTranslate) override; 176 void ResetSharedTranslate() override; 177 void ResetPageTransitionEffect() override; 178 179 static std::list<std::shared_ptr<Rosen::RSNode>> GetChildrenRSNodes( 180 const std::list<RefPtr<FrameNode>>& frameChildren); 181 182 // if translate params use percent dimension, frameSize should be given correctly 183 static std::shared_ptr<Rosen::RSTransitionEffect> GetRSTransitionWithoutType( 184 const std::unique_ptr<TransitionOptions>& options, const SizeF& frameSize = SizeF()); 185 186 static float ConvertDimensionToScaleBySize(const Dimension& dimension, float size); 187 188 void FlushContentModifier(const RefPtr<Modifier>& modifier) override; 189 void FlushOverlayModifier(const RefPtr<Modifier>& modifier) override; 190 191 void AddChild(const RefPtr<RenderContext>& renderContext, int index) override; 192 void RemoveChild(const RefPtr<RenderContext>& renderContext) override; 193 void ClearChildren() override; 194 void SetBounds(float positionX, float positionY, float width, float height) override; 195 void OnTransformTranslateUpdate(const TranslateOptions& value) override; 196 197 RectF GetPaintRectWithTransform() override; 198 199 RectF GetPaintRectWithTranslate() override; 200 201 RectF GetPaintRectWithoutTransform() override; 202 203 // get position property 204 RectF GetPropertyOfPosition() override; 205 206 // append translate value and return origin value. 207 void UpdateTranslateInXY(const OffsetF& offset) override; 208 OffsetF GetShowingTranslateProperty() override; 209 210 void GetPointWithRevert(PointF& point) override; 211 212 void GetPointWithTransform(PointF& point) override; 213 214 void ClearDrawCommands() override; 215 216 void OpacityAnimation(const AnimationOption& option, double begin, double end) override; 217 void ScaleAnimation(const AnimationOption& option, double begin, double end) override; 218 219 void PaintAccessibilityFocus() override; 220 221 void ClearAccessibilityFocus() override; 222 223 void OnAccessibilityFocusUpdate(bool isAccessibilityFocus) override; 224 225 void OnMouseSelectUpdate(bool isSelected, const Color& fillColor, const Color& strokeColor) override; 226 void UpdateMouseSelectWithRect(const RectF& rect, const Color& fillColor, const Color& strokeColor) override; 227 228 void OnPositionUpdate(const OffsetT<Dimension>& value) override; 229 void OnZIndexUpdate(int32_t value) override; 230 void DumpInfo() const override; 231 void SetClipBoundsWithCommands(const std::string& commands) override; SetNeedDebugBoundary(bool flag)232 void SetNeedDebugBoundary(bool flag) override 233 { 234 needDebugBoundary_ = flag; 235 } 236 NeedDebugBoundary()237 bool NeedDebugBoundary() const override 238 { 239 return needDebugBoundary_; 240 } 241 242 void OnBackgroundAlignUpdate(const Alignment& align) override; 243 void OnBackgroundPixelMapUpdate(const RefPtr<PixelMap>& value) override; 244 void CreateBackgroundPixelMap(const RefPtr<FrameNode>& customNode) override; 245 246 void OnBackgroundColorUpdate(const Color& value) override; 247 void OnOpacityUpdate(double opacity) override; 248 249 void MarkContentChanged(bool isChanged) override; 250 void MarkDrivenRender(bool flag) override; 251 void MarkDrivenRenderItemIndex(int32_t index) override; 252 void MarkDrivenRenderFramePaintState(bool flag) override; 253 RefPtr<PixelMap> GetThumbnailPixelMap() override; 254 std::vector<double> transInfo_; 255 std::vector<double> GetTrans() override; 256 #ifndef USE_ROSEN_DRAWING 257 bool GetBitmap(SkBitmap& bitmap, std::shared_ptr<OHOS::Rosen::DrawCmdList> drawCmdList = nullptr); 258 #else 259 bool GetBitmap(RSBitmap& bitmap, std::shared_ptr<RSDrawCmdList> drawCmdList = nullptr); 260 #endif 261 #ifndef USE_ROSEN_DRAWING 262 bool GetPixelMap(const std::shared_ptr<Media::PixelMap>& pixelMap, 263 std::shared_ptr<OHOS::Rosen::DrawCmdList> drawCmdList = nullptr, SkRect* rect = nullptr); 264 #endif 265 void SetActualForegroundColor(const Color& value) override; 266 void AttachNodeAnimatableProperty(RefPtr<NodeAnimatablePropertyBase> property) override; 267 268 void RegisterSharedTransition(const RefPtr<RenderContext>& other) override; 269 void UnregisterSharedTransition(const RefPtr<RenderContext>& other) override; 270 271 void SetUsingContentRectForRenderFrame(bool value) override; 272 void SetFrameGravity(OHOS::Rosen::Gravity gravity) override; 273 274 private: 275 void OnBackgroundImageUpdate(const ImageSourceInfo& src) override; 276 void OnBackgroundImageRepeatUpdate(const ImageRepeat& imageRepeat) override; 277 void OnBackgroundImageSizeUpdate(const BackgroundImageSize& bgImgSize) override; 278 void OnBackgroundImagePositionUpdate(const BackgroundImagePosition& bgImgPosition) override; 279 280 void OnForegroundColorUpdate(const Color& value) override; 281 void OnForegroundColorStrategyUpdate(const ForegroundColorStrategy& value) override; 282 283 void OnBorderImageUpdate(const RefPtr<BorderImage>& borderImage) override; 284 void OnBorderImageSourceUpdate(const ImageSourceInfo& borderImageSourceInfo) override; OnHasBorderImageSliceUpdate(bool tag)285 void OnHasBorderImageSliceUpdate(bool tag) override {} OnHasBorderImageWidthUpdate(bool tag)286 void OnHasBorderImageWidthUpdate(bool tag) override {} OnHasBorderImageOutsetUpdate(bool tag)287 void OnHasBorderImageOutsetUpdate(bool tag) override {} OnHasBorderImageRepeatUpdate(bool tag)288 void OnHasBorderImageRepeatUpdate(bool tag) override {} 289 void OnBorderImageGradientUpdate(const Gradient& gradient) override; 290 291 void OnBorderRadiusUpdate(const BorderRadiusProperty& value) override; 292 void OnBorderColorUpdate(const BorderColorProperty& value) override; 293 void OnBorderStyleUpdate(const BorderStyleProperty& value) override; 294 295 void OnTransformScaleUpdate(const VectorF& value) override; 296 void OnTransformCenterUpdate(const DimensionOffset& value) override; 297 void OnTransformRotateUpdate(const Vector5F& value) override; 298 299 void OnOffsetUpdate(const OffsetT<Dimension>& value) override; 300 void OnAnchorUpdate(const OffsetT<Dimension>& value) override; 301 302 void OnClipShapeUpdate(const RefPtr<BasicShape>& basicShape) override; 303 void OnClipEdgeUpdate(bool isClip) override; 304 void OnClipMaskUpdate(const RefPtr<BasicShape>& basicShape) override; 305 306 void OnProgressMaskUpdate(const RefPtr<ProgressMaskProperty>& progress) override; 307 308 void OnLinearGradientUpdate(const NG::Gradient& value) override; 309 void OnSweepGradientUpdate(const NG::Gradient& value) override; 310 void OnRadialGradientUpdate(const NG::Gradient& value) override; 311 312 void OnFrontBrightnessUpdate(const Dimension& brightness) override; 313 void OnFrontGrayScaleUpdate(const Dimension& grayScale) override; 314 void OnFrontContrastUpdate(const Dimension& contrast) override; 315 void OnFrontSaturateUpdate(const Dimension& saturate) override; 316 void OnFrontSepiaUpdate(const Dimension& sepia) override; 317 void OnFrontInvertUpdate(const Dimension& invert) override; 318 void OnFrontHueRotateUpdate(float hueRotate) override; 319 void OnFrontColorBlendUpdate(const Color& colorBlend) override; 320 void OnLinearGradientBlurUpdate(const NG::LinearGradientBlurPara& blurPara) override; 321 void OnDynamicLightUpRateUpdate(const float rate) override; 322 void OnDynamicLightUpDegreeUpdate(const float degree) override; 323 324 void OnOverlayTextUpdate(const OverlayOptions& overlay) override; 325 void OnMotionPathUpdate(const MotionPathOption& motionPath) override; 326 327 void OnUseEffectUpdate(bool useEffect) override; 328 void OnFreezeUpdate(bool isFreezed) override; 329 void OnRenderGroupUpdate(bool isRenderGroup) override; 330 void OnRenderFitUpdate(RenderFit renderFit) override; 331 void ReCreateRsNodeTree(const std::list<RefPtr<FrameNode>>& children); 332 333 void NotifyTransitionInner(const SizeF& frameSize, bool isTransitionIn); 334 void NotifyTransition(bool isTransitionIn); HasTransitionOutAnimation()335 bool HasTransitionOutAnimation() const override 336 { 337 return disappearingTransitionCount_ > 0; 338 } HasTransition()339 bool HasTransition() const override 340 { 341 return transitionEffect_ != nullptr; 342 } 343 void OnTransitionInFinish(); 344 void OnTransitionOutFinish(); 345 void RemoveDefaultTransition(); 346 void SetTransitionPivot(const SizeF& frameSize, bool transitionIn); 347 void SetPivot(float xPivot, float yPivot, float zPivot = 0.0f); 348 void SetPositionToRSNode(); 349 350 RefPtr<PageTransitionEffect> GetDefaultPageTransition(PageTransitionType type); 351 RefPtr<PageTransitionEffect> GetPageTransitionEffect(const RefPtr<PageTransitionEffect>& transition); 352 353 // Convert BorderRadiusProperty to Rosen::Vector4f 354 static inline void ConvertRadius(const BorderRadiusProperty& value, Rosen::Vector4f& cornerRadius); 355 356 void PaintBackground(); 357 void PaintClipShape(const std::unique_ptr<ClipProperty>& clip, const SizeF& frameSize); 358 void PaintClipMask(const std::unique_ptr<ClipProperty>& clip, const SizeF& frameSize); 359 void PaintClip(const SizeF& frameSize); 360 void PaintProgressMask(); 361 void PaintGradient(const SizeF& frameSize); 362 void PaintGraphics(); 363 void PaintOverlayText(); 364 void PaintBorderImage(); 365 float ConvertDimensionToPx(Dimension& src, float size); 366 Rosen::ParticleParams ConvertParticleOptionToParams(const ParticleOption& particleOption, const RectF& rect); 367 Rosen::EmitterConfig ConvertParticleEmitterOption(const EmitterOption& emitterOption, const RectF& rect); 368 Rosen::ParticleVelocity ConvertParticleVelocityOption(const VelocityProperty& velocity); 369 Rosen::ParticleVelocity ConvertParticleDefaultVelocityOption(); 370 Rosen::ParticleAcceleration ConvertParticleAccelerationOption(const AccelerationProperty& acceleration); 371 Rosen::ParticleAcceleration ConvertParticleDefaultAccelerationOption(); 372 Rosen::ParticleColorParaType ConvertParticleColorOption(const ParticleColorPropertyOption& colorOption); 373 Rosen::ParticleColorParaType ConvertParticleDefaultColorOption( 374 std::optional<OHOS::Rosen::Range<OHOS::Rosen::RSColor>> rsInitRangeOpt); 375 Rosen::ParticleParaType<float> ConvertParticleFloatOption(const ParticleFloatPropertyOption& floatOption); 376 Rosen::ParticleParaType<float> ConvertParticleDefaultFloatOption(OHOS::Rosen::Range<float>& rsInitRange); 377 bool NeedPreloadImage(const std::list<ParticleOption>& optionList, RectF& rect); 378 void LoadParticleImage(const std::string& src, Dimension& width, Dimension& height); 379 void OnParticleImageLoaded(const std::string& src, const RefPtr<CanvasImage> canvas); 380 void SetRsParticleImage(std::shared_ptr<Rosen::RSImage>& rsImagePtr, std::string& imageSource); 381 #ifndef USE_ROSEN_DRAWING 382 void PaintSkBgImage(); 383 #else 384 void PaintRSBgImage(); 385 #endif 386 void PaintPixmapBgImage(); 387 void PaintBorderImageGradient(); 388 void PaintMouseSelectRect(const RectF& rect, const Color& fillColor, const Color& strokeColor); 389 void SetBackBlurFilter(); 390 void SetFrontBlurFilter(); 391 void GetPaddingOfFirstFrameNodeParent(Dimension& parentPaddingLeft, Dimension& parentPaddingTop); 392 void CombineMarginAndPosition(Dimension& resultX, Dimension& resultY, const Dimension& parentPaddingLeft, 393 const Dimension& parentPaddingTop, float widthPercentReference, float heightPercentReference); 394 395 void InitEventClickEffect(); 396 RefPtr<Curve> UpdatePlayAnimationValue(const ClickEffectLevel& level, float& scaleValue); 397 void ClickEffectPlayAnimation(const TouchType& touchType); 398 399 // helper function to check if paint rect is valid 400 bool RectIsNull(); 401 402 /** Set data to the modifier and bind it to rsNode_ 403 * If [modifier] not initialized, initialize it and add it to rsNode 404 * 405 * @param modifier shared_ptr to a member modifier 406 * @param data passed to SetCustomData, set to the modifier 407 */ 408 template<typename T, typename D> 409 void SetGraphicModifier(std::shared_ptr<T>& modifier, D data); 410 411 void AddModifier(const std::shared_ptr<Rosen::RSModifier>& modifier); 412 void RemoveModifier(const std::shared_ptr<Rosen::RSModifier>& modifier); 413 414 // helper function to update one of the graphic effects 415 template<typename T, typename D> 416 void UpdateGraphic(std::shared_ptr<T>& modifier, D data); 417 418 RectF AdjustPaintRect(); 419 420 DataReadyNotifyTask CreateBgImageDataReadyCallback(); 421 LoadSuccessNotifyTask CreateBgImageLoadSuccessCallback(); 422 DataReadyNotifyTask CreateBorderImageDataReadyCallback(); 423 LoadSuccessNotifyTask CreateBorderImageLoadSuccessCallback(); 424 void BdImagePaintTask(RSCanvas& canvas); 425 426 void PaintDebugBoundary(); 427 bool IsUsingPosition(const RefPtr<FrameNode>& frameNode); 428 429 void SetContentRectToFrame(RectF rect) override; 430 431 RefPtr<ImageLoadingContext> bgLoadingCtx_; 432 RefPtr<CanvasImage> bgImage_; 433 RefPtr<ImageLoadingContext> bdImageLoadingCtx_; 434 RefPtr<CanvasImage> bdImage_; 435 436 std::shared_ptr<Rosen::RSNode> rsNode_; 437 bool isHoveredScale_ = false; 438 bool isHoveredBoard_ = false; 439 bool firstTransitionIn_ = false; 440 bool isBreakingPoint_ = false; 441 bool isBackBlurChanged_ = false; 442 bool needDebugBoundary_ = false; 443 bool isDisappearing_ = false; 444 bool hasDefaultTransition_ = false; 445 bool measureTriggered_ = false; 446 bool particleAnimationPlaying_ = false; 447 int appearingTransitionCount_ = 0; 448 int disappearingTransitionCount_ = 0; 449 int sandBoxCount_ = 0; 450 std::map<std::string, RefPtr<ImageLoadingContext>> particleImageContextMap_; 451 std::map<std::string, RefPtr<CanvasImage>> particleImageMap_; 452 Color blendColor_ = Color::TRANSPARENT; 453 Color hoveredColor_ = Color::TRANSPARENT; 454 455 RefPtr<RosenTransitionEffect> transitionEffect_; 456 std::shared_ptr<DebugBoundaryModifier> debugBoundaryModifier_; 457 std::shared_ptr<BackgroundModifier> backgroundModifier_; 458 std::shared_ptr<BorderImageModifier> borderImageModifier_; 459 std::shared_ptr<MouseSelectModifier> mouseSelectModifier_; 460 RefPtr<MoonProgressModifier> moonProgressModifier_; 461 std::shared_ptr<Rosen::RSClipBoundsModifier> clipBoundModifier_; 462 std::shared_ptr<Rosen::RSMaskModifier> clipMaskModifier_; 463 std::shared_ptr<FocusStateModifier> focusStateModifier_; 464 std::shared_ptr<FocusStateModifier> accessibilityFocusStateModifier_; 465 std::optional<TransformMatrixModifier> transformMatrixModifier_; 466 std::shared_ptr<Rosen::RSProperty<Rosen::Vector2f>> pivotProperty_; 467 std::unique_ptr<SharedTransitionModifier> sharedTransitionModifier_; 468 std::shared_ptr<OverlayTextModifier> modifier_ = nullptr; 469 470 // translate modifiers for developer 471 std::shared_ptr<Rosen::RSTranslateModifier> translateXY_; 472 473 // graphics modifiers 474 struct GraphicModifiers { 475 std::shared_ptr<GrayScaleModifier> grayScale; 476 std::shared_ptr<BrightnessModifier> brightness; 477 std::shared_ptr<ContrastModifier> contrast; 478 std::shared_ptr<SaturateModifier> saturate; 479 std::shared_ptr<SepiaModifier> sepia; 480 std::shared_ptr<InvertModifier> invert; 481 std::shared_ptr<HueRotateModifier> hueRotate; 482 std::shared_ptr<ColorBlendModifier> colorBlend; 483 }; 484 std::unique_ptr<GraphicModifiers> graphics_; 485 486 RefPtr<TouchEventImpl> touchListener_; 487 VectorF currentScale_ = VectorF(1.0f, 1.0f); 488 bool isTouchUpFinished_ = true; 489 490 bool useContentRectForRSFrame_; 491 492 template<typename Modifier, typename PropertyType> 493 friend class PropertyTransitionEffectTemplate; 494 friend class RosenPivotTransitionEffect; 495 496 ACE_DISALLOW_COPY_AND_MOVE(RosenRenderContext); 497 }; 498 } // namespace OHOS::Ace::NG 499 500 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PAINTS_ADAPTER_ROSEN_RENDER_CONTEXT_H 501