SDL_image & Gimp

Hello,

Looking at the source code of SDL_image, I discovered that the lib
was able to load Gimp images directly (XCF), very nice.
It was just a remark in case some of you didn’t know it, just
as me.

Julien CLEMENT

That is cool. It flattens the layers though, right?

Jonny DOn Thu, Jan 28, 2010 at 4:02 AM, julien CLEMENT wrote:

Hello,

Looking at the source code of SDL_image, I discovered that the lib
was able to load Gimp images directly (XCF), very nice.
It was just a remark in case some of you didn’t know it, just
as me.

Julien CLEMENT


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I didn’t know that :slight_smile: thanks
does that mean it flattens the layers or only shows single layer?

/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle— On Thu, 28/1/10, julien CLEMENT wrote:

From: julien CLEMENT
Subject: [SDL] SDL_image & Gimp
To: “SDL”
Received: Thursday, 28 January, 2010, 8:02 PM
Hello,

Looking at the source code of SDL_image, I discovered that
the lib
was able to load Gimp images directly (XCF), very nice.
It was just a remark in case some of you didn’t know it,
just
as me.

Julien CLEMENT

? ? ?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  __________________________________________________________________________________

Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and for free at PLUS7. www.tv.yahoo.com.au/plus7

Judging by the source code IMG_xcf.c, especially this part:

<<<
// Blit layers backwards, because Gimp saves them highest first
for (i = offsets; i > 0; i–) {
SDL_Rect rs, rd;
SDL_RWseek (src, head->layer_file_offsets [i-1], RW_SEEK_SET);

layer = read_xcf_layer (src);
do_layer_surface (lays, src, head, layer, load_tile);
rs.x = 0;
rs.y = 0;
rs.w = layer->width;
rs.h = layer->height;
rd.x = layer->offset_x;
rd.y = layer->offset_y;
rd.w = layer->width;
rd.h = layer->height;

if (layer->visible)
  SDL_BlitSurface (lays, &rs, surface, &rd);
free_xcf_layer (layer);

}

SDL_FreeSurface (lays);

it seems that it does a projection of all the layers (flattening)
into the loaded SDL_Surface.

Regards,

Julien CLEMENT

Hi,

Layers are flattened, but I needed to one tool extract all layers and
developed module. I attache the code (look on methods from xcfImage).

Regards,
D

Friday 29 of January 2010 08:57:37 julien CLEMENT napisa?(a):> Judging by the source code IMG_xcf.c, especially this part:

<<<
// Blit layers backwards, because Gimp saves them highest first
for (i = offsets; i > 0; i–) {
SDL_Rect rs, rd;
SDL_RWseek (src, head->layer_file_offsets [i-1], RW_SEEK_SET);

layer = read_xcf_layer (src);
do_layer_surface (lays, src, head, layer, load_tile);
rs.x = 0;
rs.y = 0;
rs.w = layer->width;
rs.h = layer->height;
rd.x = layer->offset_x;
rd.y = layer->offset_y;
rd.w = layer->width;
rd.h = layer->height;

if (layer->visible)
  SDL_BlitSurface (lays, &rs, surface, &rd);
free_xcf_layer (layer);

}

SDL_FreeSurface (lays);

it seems that it does a projection of all the layers (flattening)
into the loaded SDL_Surface.

Regards,

Julien CLEMENT


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pozdrawiam,
Dominik Dagiel
@Dominik_Dagiel
tel. 695-534-932
www.dagiel.pl
-------------- next part --------------
A non-text attachment was scrubbed…
Name: xcfimage.cpp
Type: text/x-c++src
Size: 18907 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100129/c6df7ffb/attachment.cpp
-------------- next part --------------
A non-text attachment was scrubbed…
Name: xcfimage.h
Type: text/x-c++hdr
Size: 2193 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100129/c6df7ffb/attachment.hpp