Using bitmaps with Symbian and Maemo Platforms
This article compares the task of using bitmaps on Symbian and Maemo/MeeGo platforms. It is part of the series Comparing S60 and Maemo Platforms.
Article Metadata
This article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.
Reasons: hamishwillee (17 Nov 2011)
Article incomplete - the description of MeeGo has no comments, and the explanation for Symbian is empty. Also Qt is the application development framework for both platforms, and this should also be demonstrated.
Reasons: hamishwillee (17 Nov 2011)
Article incomplete - the description of MeeGo has no comments, and the explanation for Symbian is empty. Also Qt is the application development framework for both platforms, and this should also be demonstrated.
S60 Platform
Maemo Platform
/* create image */
GdkImage* create_image(GdkPixmap* pixmap,GdkDrawable* drawable,gint W,gint H,gint X,gint Y)
{
GdkImage* image1 = NULL;
GdkImage* image2 = NULL;
guint32 ref, pixel;
gint i,j;
image1 = gdk_drawable_copy_to_image(pixmap,NULL,0,0,0,0,W,H);
image2 = gdk_drawable_copy_to_image(drawable,NULL,X,Y,0,0,W,H);
ref = gdk_image_get_pixel(image1,0,0);
for ( i=0; i<W; i++ )
for ( j=1; j<H; j++ )
{
pixel = gdk_image_get_pixel(image1,i,j);
if ( pixel != ref ) gdk_image_put_pixel(image2,i,j,pixel);
}
g_object_unref(image1);
return image2;
}
/* redraw */
void callback_redraw (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
...
GdkPixmap* pixmap = NULL;
...
pixmap = mainview->pixmaps[index].pixmap;
if ( pixmap!=NULL )
{
gdk_drawable_get_size(pixmap, &width, &height);
if ( spacing(mainview->pixmaps[index].utf_category) )
{
total_width += width;
}
else
{
X = mainview->drawing_area->allocation.width - total_width +
mainview->X + mainview->pixmaps[index].X;
Y = mainview->Y + i * ROW_HEIGHT + mainview->pixmaps[index].Y;
image = create_image(pixmap,widget->window,width,height,X,Y);
gdk_draw_image(widget->window,gc,image,0,0,X,Y,-1,-1);
g_object_unref(image);
}
}
...
}


(no comments yet)