#include <algorithm>
#include <map>
#include <dali-toolkit/dali-toolkit.h>
+#include <iostream>
// INTERNAL INCLUDES
#include "grid-flags.h"
{
/** Controls the output of application logging. */
-const bool DEBUG_PRINT_DIAGNOSTICS = false;
+//#define DEBUG_PRINT_DIAGNOSTICS;
-const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-4.jpg" );
+const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" );
const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
const char* APPLICATION_TITLE( "Image Scaling Modes" );
const char* TOGGLE_SCALING_IMAGE( DALI_IMAGE_DIR "icon-change.png" );
*/
Image CreateImage(const std::string& filename, unsigned int width, unsigned int height, ImageAttributes::ScalingMode scalingMode )
{
- if( DEBUG_PRINT_DIAGNOSTICS )
- {
+#ifdef DEBUG_PRINT_DIAGNOSTICS
fprintf( stderr, "CreateImage(%s, %u, %u, scalingMode=%u)\n", filename.c_str(), width, height, unsigned( scalingMode ) );
- }
+#endif
ImageAttributes attributes;
attributes.SetSize( width, height );
attributes.SetScalingMode( scalingMode );
- Image image = Image::New( filename, attributes );
+ Image image = ResourceImage::New( filename, attributes );
return image;
}
"" );
// Create an image scaling toggle button. (right of toolbar)
- Image toggleScalingImage = Image::New( TOGGLE_SCALING_IMAGE );
+ Image toggleScalingImage = ResourceImage::New( TOGGLE_SCALING_IMAGE );
Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New();
toggleScalingButton.SetBackgroundImage( toggleScalingImage );
toggleScalingButton.ClickedSignal().Connect( this, &ImageScalingIrregularGridController::OnToggleScalingTouched );
bool allocated = grid.AllocateRegion( config->dimensions, cellX, cellY, imageGridDims );
if( !allocated )
{
- if( DEBUG_PRINT_DIAGNOSTICS )
- {
+#ifdef DEBUG_PRINT_DIAGNOSTICS
fprintf( stderr, "Failed to allocate image in grid with dims (%f, %f) and path: %s.\n", config->dimensions.x, config->dimensions.y, config->path );
- }
+#endif
continue;
}
// coordinates in a frame defined by a parent actor:
Actor gridActor = Actor::New();
- gridActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
gridActor.SetParentOrigin( ParentOrigin::CENTER );
gridActor.SetAnchorPoint( AnchorPoint::CENTER );
ImageActor imageActor = ImageActor::DownCast( actor );
Image oldImage = imageActor.GetImage();
- Image newImage = CreateImage( oldImage.GetFilename(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode );
+ Image newImage = CreateImage( ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width + 0.5f, imageSize.height + 0.5f, newMode );
imageActor.SetImage( newImage );
mScalingModes[id] = newMode;
}
const Vector2 imageSize = mSizes[gridImageActor.GetId()];
ImageAttributes::ScalingMode newMode = NextMode( mScalingModes[gridImageActor.GetId()] );
Image oldImage = gridImageActor.GetImage();
- Image newImage = CreateImage( oldImage.GetFilename(), imageSize.width, imageSize.height, newMode );
+ Image newImage = CreateImage(ResourceImage::DownCast(oldImage).GetUrl(), imageSize.width, imageSize.height, newMode );
gridImageActor.SetImage( newImage );
mScalingModes[gridImageActor.GetId()] = newMode;