NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
+ mImage(),
+ mCroppedImage(),
+ mImageUrl(),
+ mStretchPixelsX(),
+ mStretchPixelsY(),
+ mImageSize(),
mBorderOnly( false )
{
}
+NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly )
+: Visual::Base( factoryCache ),
+ mImage(),
+ mCroppedImage(),
+ mImageUrl( imageUrl ),
+ mStretchPixelsX(),
+ mStretchPixelsY(),
+ mImageSize(),
+ mBorderOnly( borderOnly )
+{
+ NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
+ InitializeFromImage( nPatch );
+}
+
+NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly )
+: Visual::Base( factoryCache ),
+ mImage( image ),
+ mCroppedImage(),
+ mImageUrl(),
+ mStretchPixelsX(),
+ mStretchPixelsY(),
+ mImageSize(),
+ mBorderOnly( borderOnly )
+{
+ InitializeFromImage( image );
+}
+
NPatchVisual::~NPatchVisual()
{
}
{
ApplyImageToSampler();
}
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void NPatchVisual::DoSetOffStage( Actor& actor )
map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
}
+void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
+{
+ // TODO
+}
+
+Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index )
+{
+ // TODO
+ return Dali::Property::Value();
+}
+
void NPatchVisual::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t oldGridY )
{
//check to see if the border style has changed
}
}
-void NPatchVisual::SetImage( const std::string& imageUrl, bool borderOnly )
-{
- bool oldBorderOnly = mBorderOnly;
- size_t oldGridX = mStretchPixelsX.Size();
- size_t oldGridY = mStretchPixelsY.Size();
-
- mBorderOnly = borderOnly;
- mImage.Reset();
- if( mImageUrl == imageUrl )
- {
- return;
- }
-
- mImageUrl = imageUrl;
- if( mImpl->mRenderer )
- {
- NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
- InitializeFromImage( nPatch );
-
- ChangeRenderer( oldBorderOnly, oldGridX, oldGridY );
-
- if( mCroppedImage )
- {
- ApplyImageToSampler();
- }
- }
-}
-
-void NPatchVisual::SetImage( NinePatchImage image, bool borderOnly )
-{
- bool oldBorderOnly = mBorderOnly;
- size_t oldGridX = mStretchPixelsX.Size();
- size_t oldGridY = mStretchPixelsY.Size();
-
- mBorderOnly = borderOnly;
- mImageUrl.empty();
- if( mImage == image )
- {
- return;
- }
-
- mImage = image;
- if( mImpl->mRenderer )
- {
- InitializeFromImage( mImage );
- ChangeRenderer( oldBorderOnly, oldGridX, oldGridY );
-
- if( mCroppedImage )
- {
- ApplyImageToSampler();
- }
- }
-}
-
void NPatchVisual::InitializeFromImage( NinePatchImage nPatch )
{
mCroppedImage = nPatch.CreateCroppedBufferImage();