+ NinePatchImage ninePatch = NinePatchImage::New( url );
+ if( ninePatch )
+ {
+ BufferImage croppedImage = ninePatch.CreateCroppedBufferImage();
+ if( croppedImage )
+ {
+ Data* data = new Data();
+ data->hash = hash;
+ data->url = url;
+ data->textureSet = TextureSet::New();
+ TextureSetImage( data->textureSet, 0u, croppedImage );
+ data->croppedWidth = croppedImage.GetWidth();
+ data->croppedHeight = croppedImage.GetHeight();
+ data->stretchPixelsX = ninePatch.GetStretchPixelsX();
+ data->stretchPixelsY = ninePatch.GetStretchPixelsY();
+ data->border = Rect< int >( 0, 0, 0, 0 );
+ mCache.PushBack( data );
+
+ return mCache.Count(); // valid ids start from 1u
+ }
+ }
+ }
+ else
+ {
+ // Load image from file
+ PixelData pixels = SyncImageLoader::Load( url );
+ if( pixels )