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()
35 Internal::ImageActorPtr internal = Internal::ImageActor::New();
36 return ImageActor( internal.Get() );
39 ImageActor ImageActor::New(Image image)
41 ImageActor actor = ImageActor::New();
42 actor.SetImage( image );
47 ImageActor ImageActor::New(Image image, PixelArea pixelArea)
49 ImageActor actor = ImageActor::New();
50 actor.SetImage( image );
51 actor.SetPixelArea( pixelArea );
56 ImageActor ImageActor::DownCast( BaseHandle handle )
58 return ImageActor( dynamic_cast<Dali::Internal::ImageActor*>(handle.GetObjectPtr()) );
61 ImageActor::~ImageActor()
65 ImageActor::ImageActor(const ImageActor& copy)
66 : RenderableActor(copy)
70 ImageActor& ImageActor::operator=(const ImageActor& rhs)
72 BaseHandle::operator=(rhs);
76 ImageActor& ImageActor::operator=(BaseHandle::NullType* rhs)
78 DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
83 void ImageActor::SetImage(Image image)
85 Internal::ImagePtr imagePtr;
88 imagePtr = &GetImplementation(image);
90 GetImplementation(*this).SetImage( imagePtr );
93 Image ImageActor::GetImage()
95 Internal::ImagePtr imagePtr( GetImplementation(*this).GetImage() );
96 return Dali::Image( imagePtr.Get() );
99 void ImageActor::SetToNaturalSize()
101 GetImplementation(*this).SetToNaturalSize();
104 void ImageActor::SetPixelArea(const PixelArea& pixelArea)
106 GetImplementation(*this).SetPixelArea(pixelArea);
109 ImageActor::PixelArea ImageActor::GetPixelArea() const
111 return GetImplementation(*this).GetPixelArea();
114 bool ImageActor::IsPixelAreaSet() const
116 return GetImplementation(*this).IsPixelAreaSet();
119 void ImageActor::ClearPixelArea()
121 GetImplementation(*this).ClearPixelArea();
124 void ImageActor::SetStyle(Style style)
126 GetImplementation(*this).SetStyle(style);
129 ImageActor::Style ImageActor::GetStyle() const
131 return GetImplementation(*this).GetStyle();
134 void ImageActor::SetNinePatchBorder(const Vector4& border)
136 GetImplementation(*this).SetNinePatchBorder(border, true/*in pixels*/);
139 Vector4 ImageActor::GetNinePatchBorder() const
141 return GetImplementation(*this).GetNinePatchBorder();
144 ImageActor::ImageActor(Internal::ImageActor* internal)
145 : RenderableActor(internal)