// INTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/devel-api/images/pixel-data.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/devel-api/text-abstraction/font-list.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
* @param[in] glyphIndex The index of a glyph within the specified font.
* @return A valid BufferImage, or an empty handle if the glyph could not be rendered.
*/
- BufferImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+ PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
/**
* @brief Create a vector representation of a glyph.
if( preferColor )
{
- BufferImage bitmap = CreateBitmap( fontId, GetGlyphIndex(fontId,charcode) );
+ PixelData bitmap = CreateBitmap( fontId, GetGlyphIndex(fontId,charcode) );
if( bitmap &&
Pixel::BGRA8888 == bitmap.GetPixelFormat() )
{
#endif
}
-BufferImage FontClient::Plugin::CreateBitmap( FontId fontId,
+PixelData FontClient::Plugin::CreateBitmap( FontId fontId,
GlyphIndex glyphIndex )
{
- BufferImage bitmap;
+ PixelData bitmap;
if( fontId > 0 &&
fontId-1 < mFontCache.size() )
return id;
}
-void FontClient::Plugin::ConvertBitmap( BufferImage& destBitmap,
+void FontClient::Plugin::ConvertBitmap( PixelData& destBitmap,
FT_Bitmap srcBitmap )
{
if( srcBitmap.width*srcBitmap.rows > 0 )
{
if( srcBitmap.pitch == static_cast< int >( srcBitmap.width ) )
{
- destBitmap = BufferImage::New( srcBitmap.width, srcBitmap.rows, Pixel::L8 );
-
- PixelBuffer* destBuffer = destBitmap.GetBuffer();
- if( destBuffer )
- {
- memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows );
- }
- else
- {
- DALI_LOG_ERROR( "GetBuffer returns null\n" );
- }
+ unsigned int bufferSize( srcBitmap.width * srcBitmap.rows );
+ unsigned char* buffer = new unsigned char[bufferSize];
+ memcpy( buffer, srcBitmap.buffer,bufferSize );
+ destBitmap = PixelData::New( buffer, bufferSize, srcBitmap.width, srcBitmap.rows, Pixel::L8, PixelData::DELETE_ARRAY );
}
break;
}
{
if ( srcBitmap.pitch == static_cast< int >( srcBitmap.width << 2 ) )
{
- destBitmap = BufferImage::New( srcBitmap.width, srcBitmap.rows, Pixel::BGRA8888 );
-
- PixelBuffer* destBuffer = destBitmap.GetBuffer();
- if( destBuffer )
- {
- memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows*4 );
- }
- else
- {
- DALI_LOG_ERROR( "GetBuffer returns null\n" );
- }
+ unsigned int bufferSize( srcBitmap.width * srcBitmap.rows * 4 );
+ unsigned char* buffer = new unsigned char[bufferSize];
+ memcpy( buffer, srcBitmap.buffer,bufferSize );
+ destBitmap = PixelData::New( buffer, bufferSize, srcBitmap.width, srcBitmap.rows, Pixel::BGRA8888, PixelData::DELETE_ARRAY );
}
break;
}
/**
* @copydoc Dali::FontClient::CreateBitmap()
*/
- BufferImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
+ PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex );
/**
* @copydoc Dali::FontClient::CreateVectorBlob()
* @param[in] destBitmap
* @param[in] srcBitmap
*/
- void ConvertBitmap( BufferImage& destBitmap, FT_Bitmap srcBitmap );
+ void ConvertBitmap( PixelData& destBitmap, FT_Bitmap srcBitmap );
/**
* @brief Finds in the cache if there is a triplet with the path to the font file name, the font point size and the face index.