2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/actors/image-actor.h>
22 #include <dali/internal/event/actors/image-actor-impl.h>
23 #include <dali/internal/event/images/image-impl.h>
24 #include <dali/public-api/common/dali-common.h>
29 ImageActor::ImageActor()
33 ImageActor ImageActor::New()
36 Internal::ImageActorPtr internal = Internal::ImageActor::New(NULL);
37 return ImageActor(internal.Get());
40 ImageActor ImageActor::New(Image image)
42 Internal::ImageActorPtr internal;
45 internal = Internal::ImageActor::New(&GetImplementation(image));
50 internal = Internal::ImageActor::New(NULL);
53 return ImageActor(internal.Get());
56 ImageActor ImageActor::New(Image image, PixelArea pixelArea)
58 Internal::ImageActorPtr internal;
61 internal = Internal::ImageActor::New(&GetImplementation(image), pixelArea);
66 internal = Internal::ImageActor::New(NULL, pixelArea);
69 return ImageActor(internal.Get());
72 ImageActor ImageActor::DownCast( BaseHandle handle )
74 return ImageActor( dynamic_cast<Dali::Internal::ImageActor*>(handle.GetObjectPtr()) );
77 ImageActor::~ImageActor()
81 void ImageActor::SetImage(Image image)
85 GetImplementation(*this).SetImage(&GetImplementation(image));
89 GetImplementation(*this).SetImage(NULL);
93 Image ImageActor::GetImage()
95 return GetImplementation(*this).GetImage();
98 void ImageActor::SetToNaturalSize()
100 GetImplementation(*this).SetToNaturalSize();
103 void ImageActor::SetPixelArea(const PixelArea& pixelArea)
105 GetImplementation(*this).SetPixelArea(pixelArea);
108 ImageActor::PixelArea ImageActor::GetPixelArea() const
110 return GetImplementation(*this).GetPixelArea();
113 bool ImageActor::IsPixelAreaSet() const
115 return GetImplementation(*this).IsPixelAreaSet();
118 void ImageActor::ClearPixelArea()
120 GetImplementation(*this).ClearPixelArea();
123 void ImageActor::SetStyle(Style style)
125 GetImplementation(*this).SetStyle(style);
128 ImageActor::Style ImageActor::GetStyle() const
130 return GetImplementation(*this).GetStyle();
133 void ImageActor::SetNinePatchBorder(const Vector4& border)
135 GetImplementation(*this).SetNinePatchBorder(border, true/*in pixels*/);
138 Vector4 ImageActor::GetNinePatchBorder() const
140 return GetImplementation(*this).GetNinePatchBorder();
143 void ImageActor::SetFadeIn(bool enableFade)
145 GetImplementation(*this).SetFadeIn(enableFade);
148 bool ImageActor::GetFadeIn() const
150 return GetImplementation(*this).GetFadeIn();
153 void ImageActor::SetFadeInDuration(float durationSeconds)
155 GetImplementation(*this).SetFadeInDuration(durationSeconds);
158 float ImageActor::GetFadeInDuration() const
160 return GetImplementation(*this).GetFadeInDuration();
163 Vector2 ImageActor::GetCurrentImageSize() const
165 return GetImplementation(*this).GetCurrentImageSize();
168 ImageActor::ImageActor(Internal::ImageActor* internal)
169 : RenderableActor(internal)