* BUG: Always add an alpha channel to loaded images, because gdk-pixbuf 
  RGB images rowstride is rounded up to a four bytes multiple. The gb.image 
  component does not support that yet!

[GB.IMAGE.IO]
* BUG: Always add an alpha channel to loaded images, because gdk-pixbuf 
  RGB images rowstride is rounded up to a four bytes multiple. The gb.image 
  component does not support that yet!


git-svn-id: svn://localhost/gambas/trunk@4176 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-10-07 09:35:29 +00:00
parent 505ced8d51
commit a3709f2654
3 changed files with 12 additions and 9 deletions

2
TODO
View file

@ -40,7 +40,6 @@ DEVELOPMENT ENVIRONMENT
- Be able to open a .tar.gz project, and compress it back when the project is closed.
- Conditional breakpoints.
- Define a control order somewhere for the toolbox.
- A "Save as" menu for saving any project file outside of the project tree.
- An option to interpreter "." and "," when reading float in a CSV import.
GUI RELATED STUFF
@ -51,6 +50,7 @@ GUI RELATED STUFF
- Moveable tabs.
- ListView and GridView selection interface should be the same.
- More clever vertical toolbar.
- Color.TooltipBackground and Color.TooltipForeground.
DESKTOP COMPONENT

View file

@ -68,11 +68,12 @@ static bool pixbufFromMemory(GdkPixbuf **img, char *addr, unsigned int len, bool
if (gdk_pixbuf_get_n_channels(*img) == 3)
{
// GdkPixbuf *aimg;
// aimg = gdk_pixbuf_add_alpha(*img, FALSE, 0, 0, 0);
// g_object_unref(G_OBJECT(*img));
// g_object_ref(G_OBJECT(aimg));
// *img = aimg;
// Rowstride breaks gb.image (it is rounded up so that a line is always a four bytes multiple).
GdkPixbuf *aimg;
aimg = gdk_pixbuf_add_alpha(*img, FALSE, 0, 0, 0);
g_object_unref(G_OBJECT(*img));
g_object_ref(G_OBJECT(aimg));
*img = aimg;
*trans = false;
}
else

View file

@ -69,14 +69,16 @@ BEGIN_METHOD(CIMAGE_load, GB_STRING path)
img = gdk_pixbuf_loader_get_pixbuf(loader);
g_object_ref(G_OBJECT(img));
/*if (gdk_pixbuf_get_n_channels(img) == 3)
// Rowstride breaks gb.image (it is rounded up so that a line is always a four bytes multiple).
if (gdk_pixbuf_get_n_channels(img) == 3)
{
// BM: convert to 4 bytes per pixels
GdkPixbuf *aimg;
aimg = gdk_pixbuf_add_alpha(img, FALSE, 0, 0, 0);
g_object_unref(G_OBJECT(img));
img = aimg;
}*/
}
//fprintf(stderr, "nchannels = %d size = %d x %d rowstride = %d\n", gdk_pixbuf_get_n_channels(img), gdk_pixbuf_get_width(img), gdk_pixbuf_get_height(img), gdk_pixbuf_get_rowstride(img));
switch (gdk_pixbuf_get_n_channels(img))
{