IMG_xcf.c
changeset 70 ef5fe56a0f07
parent 53 96b084473b47
child 80 e793c7a63324
     1.1 --- a/IMG_xcf.c	Sun Apr 14 21:57:25 2002 +0000
     1.2 +++ b/IMG_xcf.c	Fri May 03 02:10:44 2002 +0000
     1.3 @@ -166,6 +166,7 @@
     1.4  
     1.5    Uint32 offset_x;
     1.6    Uint32 offset_y;
     1.7 +  int visible;
     1.8  } xcf_layer;
     1.9  
    1.10  typedef struct {
    1.11 @@ -178,7 +179,8 @@
    1.12  
    1.13    Uint32 color;
    1.14    Uint32 opacity;
    1.15 -  int selection : 1;
    1.16 +  int selection;
    1.17 +  int visible;
    1.18  } xcf_channel;
    1.19  
    1.20  typedef struct {
    1.21 @@ -245,7 +247,9 @@
    1.22    prop->id = SDL_ReadBE32 (src);
    1.23    prop->length = SDL_ReadBE32 (src);
    1.24  
    1.25 +#if 0
    1.26    printf ("%.8X: %s: %d\n", SDL_RWtell (src), prop->id < 25 ? prop_names [prop->id] : "unknown", prop->length);
    1.27 +#endif
    1.28  
    1.29    switch (prop->id) {
    1.30    case PROP_COLORMAP:
    1.31 @@ -265,6 +269,9 @@
    1.32    case PROP_COLOR:
    1.33      SDL_RWread (src, &prop->data, prop->length, 1);
    1.34      break;
    1.35 +  case PROP_VISIBLE:
    1.36 +    prop->data.visible = SDL_ReadBE32 (src);
    1.37 +    break;
    1.38    default:
    1.39      //    SDL_RWread (src, &prop->data, prop->length, 1);
    1.40      SDL_RWseek (src, prop->length, SEEK_CUR);
    1.41 @@ -332,6 +339,8 @@
    1.42      if (prop.id == PROP_OFFSETS) {
    1.43        l->offset_x = prop.data.offset.x;
    1.44        l->offset_y = prop.data.offset.y;
    1.45 +    } else if (prop.id == PROP_VISIBLE) {
    1.46 +      l->visible = prop.data.visible ? 1 : 0;
    1.47      }
    1.48    } while (prop.id != PROP_END);
    1.49  
    1.50 @@ -371,6 +380,9 @@
    1.51      case PROP_SELECTION:
    1.52        l->selection = 1;
    1.53        break;
    1.54 +    case PROP_VISIBLE:
    1.55 +      l->visible = prop.data.visible ? 1 : 0;
    1.56 +      break;
    1.57      default:
    1.58      }
    1.59    } while (prop.id != PROP_END);
    1.60 @@ -724,9 +736,10 @@
    1.61      rd.y = layer->offset_y;
    1.62      rd.w = layer->width;
    1.63      rd.h = layer->height;
    1.64 +
    1.65 +    if (layer->visible)
    1.66 +      SDL_BlitSurface (lays, &rs, surface, &rd);
    1.67      free_xcf_layer (layer);
    1.68 -
    1.69 -    SDL_BlitSurface (lays, &rs, surface, &rd);
    1.70    }
    1.71  
    1.72    SDL_FreeSurface (lays);
    1.73 @@ -756,7 +769,7 @@
    1.74      }
    1.75      for (i = 0; i < chnls; i++) {
    1.76        //      printf ("CNLBLT %i\n", i);
    1.77 -      if (!channel [i]->selection) {
    1.78 +      if (!channel [i]->selection && channel [i]->visible) {
    1.79  	create_channel_surface (chs, head->image_type, channel [i]->color, channel [i]->opacity);
    1.80  	SDL_BlitSurface (chs, NULL, surface, NULL);
    1.81        }