/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
//Set up the texture set
TextureSet textureSet = TextureSet::New();
- Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
- textureSet.SetImage( 0u, lookupTexture );
+ Dali::Texture lookupTexture = mGradient->GenerateLookupTexture();
+ textureSet.SetTexture( 0u, lookupTexture );
Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
Sampler sampler = Sampler::New();
sampler.SetWrapMode( wrap, wrap );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* If the stops have not covered the whole zero to one range,
* the REPEAT spread behaves different from the two others in the lookup texture generation.
*/
-BufferImage Gradient::GenerateLookupTexture()
+Dali::Texture Gradient::GenerateLookupTexture()
{
std::sort( mGradientStops.Begin(), mGradientStops.End() );
* Generate the pixels with the color transit from one stop to next.
*/
unsigned int resolution = EstimateTextureResolution();
- BufferImage texture = BufferImage::New( resolution, 1 );
- PixelBuffer* pixels = texture.GetBuffer();
+
+ unsigned int bufferSize = resolution * 4u;
+ unsigned char* pixels = new unsigned char[ bufferSize ];
+ PixelData pixelData = PixelData::New( pixels, bufferSize, resolution, 1u, Pixel::RGBA8888, PixelData::DELETE_ARRAY );
+
int segmentStart = 0;
int segmentEnd = 0;
int k = 0;
segmentStart = segmentEnd;
}
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, resolution, 1u );
+ texture.Upload( pixelData );
+
// remove the stops added temporarily for generating the pixels, as the spread method might get changed later
if( tempLastStop )
{
#define __DALI_TOOLKIT_INTERNAL_GRADIENT_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/devel-api/rendering/texture.h>
namespace Dali
{
/**
* Generate the lookup texture with the gradient stops.
- * @return the lookup texture which transit smoothly between stops.
+ * @return The lookup texture which transit smoothly between stops.
*/
- BufferImage GenerateLookupTexture();
+ Dali::Texture GenerateLookupTexture();
private: