Dali 3D User Interface Engine
image-actor-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_IMAGE_ACTOR_H__
2 #define __DALI_INTERNAL_IMAGE_ACTOR_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // INTERNAL INCLUDES
31 
32 namespace Dali
33 {
34 
35 namespace Internal
36 {
37 
38 class Image;
39 
53 class ImageActor : public Actor
54 {
55 public:
56 
58 
63  static ImageActorPtr New();
64 
68  void OnInitialize() ;
69 
74  void SetImage( ImagePtr& image );
75 
80  ImagePtr GetImage() const;
81 
85  void SetPixelArea( const PixelArea& pixelArea );
86 
90  const PixelArea& GetPixelArea() const;
91 
95  bool IsPixelAreaSet() const;
96 
100  void ClearPixelArea();
101 
105  void SetStyle( Dali::ImageActor::Style style );
106 
111 
115  void SetNinePatchBorder( const Vector4& border );
116 
120  Vector4 GetNinePatchBorder() const;
121 
125  void SetSortModifier(float modifier);
126 
130  float GetSortModifier() const;
131 
135  void SetCullFace(CullFaceMode mode);
136 
140  CullFaceMode GetCullFace() const;
141 
145  void SetBlendMode( BlendingMode::Type mode );
146 
151 
155  void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba );
156 
160  void SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb,
161  BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha );
162 
166  void GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb,
167  BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const;
168 
172  void SetBlendEquation( BlendingEquation::Type equationRgba );
173 
177  void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha );
178 
182  void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const;
183 
187  void SetBlendColor( const Vector4& color );
188 
192  const Vector4& GetBlendColor() const;
193 
197  void SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter );
198 
202  void GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const;
203 
207  void EffectImageUpdated();
208 
209 public:
213  virtual void SetShaderEffect(ShaderEffect& effect);
214 
218  virtual ShaderEffectPtr GetShaderEffect() const;
219 
223  virtual void RemoveShaderEffect();
224 
225 private:
226 
230  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
231 
235  virtual void OnSizeSet( const Vector3& targetSize );
236 
237 public: // Default property extensions from Object
238 
242  virtual unsigned int GetDefaultPropertyCount() const;
243 
247  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
248 
252  virtual const char* GetDefaultPropertyName(Property::Index index) const;
253 
257  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
258 
262  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
263 
267  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
268 
272  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
273 
278 
282  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
283 
287  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
288 
289 public: // From Actor
290 
294  virtual Vector3 GetNaturalSize() const;
295 
296 protected:
297 
301  ImageActor();
302 
306  virtual ~ImageActor();
307 
308 private:
309 
316 
320  void UpdateGeometry();
321 
325  void UpdateTexureRect();
326 
327 private:
328 
337  size_t mTextureIndex;
343 };
344 
345 } // namespace Internal
346 
347 // Helpers for public-api forwarding methods
348 
350 {
351  DALI_ASSERT_ALWAYS(image && "Image handle is empty");
352 
353  BaseObject& handle = image.GetBaseObject();
354 
355  return static_cast<Internal::ImageActor&>(handle);
356 }
357 
359 {
360  DALI_ASSERT_ALWAYS(image && "Image handle is empty");
361 
362  const BaseObject& handle = image.GetBaseObject();
363 
364  return static_cast<const Internal::ImageActor&>(handle);
365 }
366 
367 } // namespace Dali
368 
369 #endif // __DALI_INTERNAL_IMAGE_ACTOR_H__
Dali Docs Home
Read more about Dali