• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CANVAS_IMAGE_DATA_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CANVAS_IMAGE_DATA_H
18 
19 #include "base/memory/referenced.h"
20 #include "bridge/declarative_frontend/engine/bindings_defines.h"
21 
22 
23 namespace OHOS::Ace::Framework {
24 
25 class JSCanvasImageData : public Referenced {
26 public:
27     JSCanvasImageData();
28     ~JSCanvasImageData() override = default;
29 
30     static void JSBind(BindingTarget globalObj);
31     static void Constructor(const JSCallbackInfo& args);
32     static void Destructor(JSCanvasImageData* scroller);
33 
34     void getData(const JSCallbackInfo& args);
35 
36     double width_ = 0;
37     double height_ = 0;
38 
39     double GetWidth() const;
40     double GetHeight() const;
41 
setX(int32_t x)42     void setX(int32_t x)
43     {
44         x_ = x;
45     }
getX()46     int32_t getX() const
47     {
48         return x_;
49     }
setY(int32_t y)50     void setY(int32_t y)
51     {
52         y_ = y;
53     }
getY()54     int32_t getY() const
55     {
56         return y_;
57     }
setDirtyX(int32_t dirtyX)58     void setDirtyX(int32_t dirtyX)
59     {
60         dirtyX_ = dirtyX;
61     }
getDirtyX()62     int32_t getDirtyX() const
63     {
64         return dirtyX_;
65     }
setDirtyY(int32_t dirtyY)66     void setDirtyY(int32_t dirtyY)
67     {
68         dirtyY_ = dirtyY;
69     }
getDirtyY()70     int32_t getDirtyY() const
71     {
72         return dirtyY_;
73     }
setDirtyWidth(int32_t dirtyWidth)74     void setDirtyWidth(int32_t dirtyWidth)
75     {
76         dirtyWidth_ = dirtyWidth;
77     }
getDirtyWidth()78     int32_t getDirtyWidth() const
79     {
80         return dirtyWidth_;
81     }
setDirtyHeight(int32_t dirtyHeight)82     void setDirtyHeight(int32_t dirtyHeight)
83     {
84         dirtyHeight_ = dirtyHeight;
85     }
getDirtyHeight()86     int32_t getDirtyHeight() const
87     {
88         return dirtyHeight_;
89     }
setData(const std::vector<Color> & data)90     void setData(const std::vector<Color>& data)
91     {
92         data_ = data;
93     }
94 
95 private:
96     int32_t x_ = 0;
97     int32_t y_ = 0;
98     int32_t dirtyX_ = 0;
99     int32_t dirtyY_ = 0;
100     int32_t dirtyWidth_ = 0;
101     int32_t dirtyHeight_ = 0;
102     std::vector<Color> data_;
103 
104     ACE_DISALLOW_COPY_AND_MOVE(JSCanvasImageData);
105 };
106 
107 } // OHOS::Ace::Framework
108 
109 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CANVAS_IMAGE_DATA_H