~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/sgi/sgi.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: sgi.c,v 1.47 2004/10/28 12:12:52 neo Exp $"
3
 
 *
4
2
 *   SGI image file plug-in for the GIMP.
5
3
 *
6
4
 *   Copyright 1997-1998 Michael Sweet (mike@easysw.com)
33
31
 
34
32
#include "config.h"
35
33
 
36
 
#include <stdio.h>
37
 
#include <stdlib.h>
38
 
#include <signal.h>
39
 
 
40
 
#include <gtk/gtk.h>
 
34
#include <string.h>
41
35
 
42
36
#include <libgimp/gimp.h>
43
37
#include <libgimp/gimpui.h>
44
38
 
45
 
#include "sgi.h"                /* SGI image library definitions */
 
39
#include "sgi.h"                /* SGI image library definitions */
46
40
 
47
41
#include "libgimp/stdplugins-intl.h"
48
42
 
51
45
 * Constants...
52
46
 */
53
47
 
 
48
#define LOAD_PROC        "file-sgi-load"
 
49
#define SAVE_PROC        "file-sgi-save"
 
50
#define PLUG_IN_BINARY   "sgi"
54
51
#define PLUG_IN_VERSION  "1.1.1 - 17 May 1998"
55
52
 
56
53
 
58
55
 * Local functions...
59
56
 */
60
57
 
61
 
static void     query       (void);
62
 
static void     run         (const gchar      *name,
63
 
                             gint              nparams,
64
 
                             const GimpParam  *param,
65
 
                             gint             *nreturn_vals,
66
 
                             GimpParam       **return_vals);
 
58
static void     query       (void);
 
59
static void     run         (const gchar      *name,
 
60
                             gint              nparams,
 
61
                             const GimpParam  *param,
 
62
                             gint             *nreturn_vals,
 
63
                             GimpParam       **return_vals);
67
64
 
68
 
static gint32   load_image  (const gchar      *filename);
69
 
static gint     save_image  (const gchar      *filename,
70
 
                             gint32            image_ID,
71
 
                             gint32            drawable_ID);
 
65
static gint32   load_image  (const gchar      *filename);
 
66
static gint     save_image  (const gchar      *filename,
 
67
                             gint32            image_ID,
 
68
                             gint32            drawable_ID);
72
69
 
73
70
static gboolean save_dialog (void);
74
71
 
76
73
 * Globals...
77
74
 */
78
75
 
79
 
GimpPlugInInfo  PLUG_IN_INFO =
 
76
const GimpPlugInInfo  PLUG_IN_INFO =
80
77
{
81
78
  NULL,  /* init_proc  */
82
79
  NULL,  /* quit_proc  */
92
89
static void
93
90
query (void)
94
91
{
95
 
  static GimpParamDef load_args[] =
 
92
  static const GimpParamDef load_args[] =
96
93
  {
97
 
    { GIMP_PDB_INT32,      "run_mode",     "Interactive, non-interactive" },
 
94
    { GIMP_PDB_INT32,      "run-mode",     "Interactive, non-interactive" },
98
95
    { GIMP_PDB_STRING,     "filename",     "The name of the file to load" },
99
 
    { GIMP_PDB_STRING,     "raw_filename", "The name of the file to load" },
 
96
    { GIMP_PDB_STRING,     "raw-filename", "The name of the file to load" },
100
97
  };
101
 
  static GimpParamDef load_return_vals[] =
 
98
  static const GimpParamDef load_return_vals[] =
102
99
  {
103
100
    { GIMP_PDB_IMAGE,      "image",        "Output image" },
104
101
  };
105
102
 
106
 
  static GimpParamDef save_args[] =
 
103
  static const GimpParamDef save_args[] =
107
104
  {
108
 
    { GIMP_PDB_INT32,   "run_mode",     "Interactive, non-interactive" },
109
 
    { GIMP_PDB_IMAGE,   "image",        "Input image" },
110
 
    { GIMP_PDB_DRAWABLE,        "drawable",     "Drawable to save" },
111
 
    { GIMP_PDB_STRING,  "filename",     "The name of the file to save the image in" },
112
 
    { GIMP_PDB_STRING,  "raw_filename", "The name of the file to save the image in" },
113
 
    { GIMP_PDB_INT32,   "compression",  "Compression level (0 = none, 1 = RLE, 2 = ARLE)" }
 
105
    { GIMP_PDB_INT32,    "run-mode",     "Interactive, non-interactive" },
 
106
    { GIMP_PDB_IMAGE,    "image",        "Input image" },
 
107
    { GIMP_PDB_DRAWABLE, "drawable",     "Drawable to save" },
 
108
    { GIMP_PDB_STRING,   "filename",     "The name of the file to save the image in" },
 
109
    { GIMP_PDB_STRING,   "raw-filename", "The name of the file to save the image in" },
 
110
    { GIMP_PDB_INT32,    "compression",  "Compression level (0 = none, 1 = RLE, 2 = ARLE)" }
114
111
  };
115
112
 
116
 
  gimp_install_procedure ("file_sgi_load",
117
 
                          "Loads files in SGI image file format",
118
 
                          "This plug-in loads SGI image files.",
119
 
                          "Michael Sweet <mike@easysw.com>",
120
 
                          "Copyright 1997-1998 by Michael Sweet",
121
 
                          PLUG_IN_VERSION,
122
 
                          N_("Silicon Graphics IRIS image"),
123
 
                          NULL,
124
 
                          GIMP_PLUGIN,
125
 
                          G_N_ELEMENTS (load_args),
126
 
                          G_N_ELEMENTS (load_return_vals),
127
 
                          load_args,
128
 
                          load_return_vals);
129
 
 
130
 
  gimp_register_file_handler_mime ("file_sgi_load", "image/x-sgi");
131
 
  gimp_register_magic_load_handler ("file_sgi_load",
132
 
                                    "sgi,rgb,bw,icon",
133
 
                                    "",
134
 
                                    "0,short,474");
135
 
 
136
 
  gimp_install_procedure ("file_sgi_save",
137
 
                          "Saves files in SGI image file format",
138
 
                          "This plug-in saves SGI image files.",
139
 
                          "Michael Sweet <mike@easysw.com>",
140
 
                          "Copyright 1997-1998 by Michael Sweet",
141
 
                          PLUG_IN_VERSION,
142
 
                          N_("Silicon Graphics IRIS image"),
143
 
                          "RGB*,GRAY*",
144
 
                          GIMP_PLUGIN,
145
 
                          G_N_ELEMENTS (save_args),
146
 
                          0,
147
 
                          save_args,
148
 
                          NULL);
149
 
 
150
 
  gimp_register_file_handler_mime ("file_sgi_save", "image/x-sgi");
151
 
  gimp_register_save_handler ("file_sgi_save", "sgi,rgb,bw,icon", "");
 
113
  gimp_install_procedure (LOAD_PROC,
 
114
                          "Loads files in SGI image file format",
 
115
                          "This plug-in loads SGI image files.",
 
116
                          "Michael Sweet <mike@easysw.com>",
 
117
                          "Copyright 1997-1998 by Michael Sweet",
 
118
                          PLUG_IN_VERSION,
 
119
                          N_("Silicon Graphics IRIS image"),
 
120
                          NULL,
 
121
                          GIMP_PLUGIN,
 
122
                          G_N_ELEMENTS (load_args),
 
123
                          G_N_ELEMENTS (load_return_vals),
 
124
                          load_args,
 
125
                          load_return_vals);
 
126
 
 
127
  gimp_register_file_handler_mime (LOAD_PROC, "image/x-sgi");
 
128
  gimp_register_magic_load_handler (LOAD_PROC,
 
129
                                    "sgi,rgb,bw,icon",
 
130
                                    "",
 
131
                                    "0,short,474");
 
132
 
 
133
  gimp_install_procedure (SAVE_PROC,
 
134
                          "Saves files in SGI image file format",
 
135
                          "This plug-in saves SGI image files.",
 
136
                          "Michael Sweet <mike@easysw.com>",
 
137
                          "Copyright 1997-1998 by Michael Sweet",
 
138
                          PLUG_IN_VERSION,
 
139
                          N_("Silicon Graphics IRIS image"),
 
140
                          "RGB*,GRAY*",
 
141
                          GIMP_PLUGIN,
 
142
                          G_N_ELEMENTS (save_args),
 
143
                          0,
 
144
                          save_args,
 
145
                          NULL);
 
146
 
 
147
  gimp_register_file_handler_mime (SAVE_PROC, "image/x-sgi");
 
148
  gimp_register_save_handler (SAVE_PROC, "sgi,rgb,bw,icon", "");
152
149
}
153
150
 
154
151
static void
161
158
  static GimpParam  values[2];
162
159
  GimpRunMode       run_mode;
163
160
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
164
 
  gint32            image_ID;
 
161
  gint32            image_ID;
165
162
  gint32            drawable_ID;
166
163
  GimpExportReturn  export = GIMP_EXPORT_CANCEL;
167
164
 
174
171
 
175
172
  INIT_I18N ();
176
173
 
177
 
  if (strcmp (name, "file_sgi_load") == 0)
 
174
  if (strcmp (name, LOAD_PROC) == 0)
178
175
    {
179
176
      image_ID = load_image (param[1].data.d_string);
180
177
 
181
178
      if (image_ID != -1)
182
 
        {
183
 
          *nreturn_vals = 2;
184
 
          values[1].type         = GIMP_PDB_IMAGE;
185
 
          values[1].data.d_image = image_ID;
186
 
        }
 
179
        {
 
180
          *nreturn_vals = 2;
 
181
          values[1].type         = GIMP_PDB_IMAGE;
 
182
          values[1].data.d_image = image_ID;
 
183
        }
187
184
      else
188
 
        {
189
 
          status = GIMP_PDB_EXECUTION_ERROR;
190
 
        }
 
185
        {
 
186
          status = GIMP_PDB_EXECUTION_ERROR;
 
187
        }
191
188
    }
192
 
  else if (strcmp (name, "file_sgi_save") == 0)
 
189
  else if (strcmp (name, SAVE_PROC) == 0)
193
190
    {
194
191
      image_ID    = param[1].data.d_int32;
195
192
      drawable_ID = param[2].data.d_int32;
196
193
 
197
194
      /*  eventually export the image */
198
195
      switch (run_mode)
199
 
        {
200
 
        case GIMP_RUN_INTERACTIVE:
201
 
        case GIMP_RUN_WITH_LAST_VALS:
202
 
          gimp_ui_init ("sgi", FALSE);
203
 
          export = gimp_export_image (&image_ID, &drawable_ID, "SGI",
204
 
                                      (GIMP_EXPORT_CAN_HANDLE_RGB  |
205
 
                                       GIMP_EXPORT_CAN_HANDLE_GRAY |
206
 
                                       GIMP_EXPORT_CAN_HANDLE_ALPHA));
207
 
          if (export == GIMP_EXPORT_CANCEL)
208
 
            {
209
 
              values[0].data.d_status = GIMP_PDB_CANCEL;
210
 
              return;
211
 
            }
212
 
          break;
213
 
        default:
214
 
          break;
215
 
        }
 
196
        {
 
197
        case GIMP_RUN_INTERACTIVE:
 
198
        case GIMP_RUN_WITH_LAST_VALS:
 
199
          gimp_ui_init (PLUG_IN_BINARY, FALSE);
 
200
          export = gimp_export_image (&image_ID, &drawable_ID, "SGI",
 
201
                                      (GIMP_EXPORT_CAN_HANDLE_RGB  |
 
202
                                       GIMP_EXPORT_CAN_HANDLE_GRAY |
 
203
                                       GIMP_EXPORT_CAN_HANDLE_ALPHA));
 
204
          if (export == GIMP_EXPORT_CANCEL)
 
205
            {
 
206
              values[0].data.d_status = GIMP_PDB_CANCEL;
 
207
              return;
 
208
            }
 
209
          break;
 
210
        default:
 
211
          break;
 
212
        }
216
213
 
217
214
      switch (run_mode)
218
 
        {
219
 
        case GIMP_RUN_INTERACTIVE:
220
 
          /*
221
 
           * Possibly retrieve data...
222
 
           */
223
 
          gimp_get_data ("file_sgi_save", &compression);
 
215
        {
 
216
        case GIMP_RUN_INTERACTIVE:
 
217
          /*
 
218
           * Possibly retrieve data...
 
219
           */
 
220
          gimp_get_data (SAVE_PROC, &compression);
224
221
 
225
 
          /*
226
 
           * Then acquire information with a dialog...
227
 
           */
 
222
          /*
 
223
           * Then acquire information with a dialog...
 
224
           */
228
225
          if (!save_dialog ())
229
226
            status = GIMP_PDB_CANCEL;
230
227
          break;
231
228
 
232
 
        case GIMP_RUN_NONINTERACTIVE:
233
 
          /*
234
 
           * Make sure all the arguments are there!
235
 
           */
 
229
        case GIMP_RUN_NONINTERACTIVE:
 
230
          /*
 
231
           * Make sure all the arguments are there!
 
232
           */
236
233
          if (nparams != 6)
237
 
            {
238
 
              status = GIMP_PDB_CALLING_ERROR;
239
 
            }
 
234
            {
 
235
              status = GIMP_PDB_CALLING_ERROR;
 
236
            }
240
237
          else
241
 
            {
242
 
              compression = param[5].data.d_int32;
243
 
 
244
 
              if (compression < 0 || compression > 2)
245
 
                status = GIMP_PDB_CALLING_ERROR;
246
 
            };
247
 
          break;
248
 
 
249
 
        case GIMP_RUN_WITH_LAST_VALS:
250
 
          /*
251
 
           * Possibly retrieve data...
252
 
           */
253
 
          gimp_get_data ("file_sgi_save", &compression);
254
 
          break;
255
 
 
256
 
        default:
257
 
          break;
258
 
        };
 
238
            {
 
239
              compression = param[5].data.d_int32;
 
240
 
 
241
              if (compression < 0 || compression > 2)
 
242
                status = GIMP_PDB_CALLING_ERROR;
 
243
            };
 
244
          break;
 
245
 
 
246
        case GIMP_RUN_WITH_LAST_VALS:
 
247
          /*
 
248
           * Possibly retrieve data...
 
249
           */
 
250
          gimp_get_data (SAVE_PROC, &compression);
 
251
          break;
 
252
 
 
253
        default:
 
254
          break;
 
255
        };
259
256
 
260
257
      if (status == GIMP_PDB_SUCCESS)
261
 
        {
262
 
          if (save_image (param[3].data.d_string, image_ID, drawable_ID))
263
 
            {
264
 
              gimp_set_data ("file_sgi_save",
265
 
                             &compression, sizeof (compression));
266
 
            }
267
 
          else
268
 
            {
269
 
              status = GIMP_PDB_EXECUTION_ERROR;
270
 
            }
271
 
        }
 
258
        {
 
259
          if (save_image (param[3].data.d_string, image_ID, drawable_ID))
 
260
            {
 
261
              gimp_set_data (SAVE_PROC, &compression, sizeof (compression));
 
262
            }
 
263
          else
 
264
            {
 
265
              status = GIMP_PDB_EXECUTION_ERROR;
 
266
            }
 
267
        }
272
268
 
273
269
      if (export == GIMP_EXPORT_EXPORT)
274
 
        gimp_image_delete (image_ID);
 
270
        gimp_image_delete (image_ID);
275
271
    }
276
272
  else
277
273
    {
306
302
                *pixel,       /* Pixel data */
307
303
                *pptr;        /* Current pixel */
308
304
  gushort      **rows;        /* SGI image data */
309
 
  gchar         *progress;    /* Title for progress display... */
310
305
 
311
306
 /*
312
307
  * Open the file for reading...
320
315
      return -1;
321
316
    };
322
317
 
323
 
  progress = g_strdup_printf (_("Opening '%s'..."),
324
 
                               gimp_filename_to_utf8 (filename));
325
 
  gimp_progress_init (progress);
326
 
  g_free (progress);
 
318
  gimp_progress_init_printf (_("Opening '%s'"),
 
319
                             gimp_filename_to_utf8 (filename));
327
320
 
328
321
  /*
329
322
   * Get the image dimensions and create the image...
330
323
   */
331
324
 
332
325
  bytes = sgip->zsize;
333
 
  
 
326
 
334
327
  switch (sgip->zsize)
335
328
    {
336
 
    case 1 :    /* Grayscale */
 
329
    case 1 :    /* Grayscale */
337
330
      image_type = GIMP_GRAY;
338
331
      layer_type = GIMP_GRAY_IMAGE;
339
332
      break;
340
333
 
341
 
    case 2 :    /* Grayscale + alpha */
 
334
    case 2 :    /* Grayscale + alpha */
342
335
      image_type = GIMP_GRAY;
343
336
      layer_type = GIMP_GRAYA_IMAGE;
344
337
      break;
345
338
 
346
 
    case 3 :    /* RGB */
 
339
    case 3 :    /* RGB */
347
340
      image_type = GIMP_RGB;
348
341
      layer_type = GIMP_RGB_IMAGE;
349
342
      break;
350
343
 
351
 
    case 4 :    /* RGBA */
 
344
    case 4 :    /* RGBA */
352
345
      image_type = GIMP_RGB;
353
346
      layer_type = GIMP_RGBA_IMAGE;
354
347
      break;
355
 
    
 
348
 
356
349
    default:
357
350
      image_type = GIMP_RGB;
358
351
      layer_type = GIMP_RGBA_IMAGE;
374
367
   */
375
368
 
376
369
  layer = gimp_layer_new (image, _("Background"), sgip->xsize, sgip->ysize,
377
 
                          layer_type, 100, GIMP_NORMAL_MODE);
 
370
                          layer_type, 100, GIMP_NORMAL_MODE);
378
371
  gimp_image_add_layer (image, layer, 0);
379
372
 
380
373
  /*
412
405
       y ++, count ++)
413
406
    {
414
407
      if (count >= tile_height)
415
 
        {
416
 
          gimp_pixel_rgn_set_rect (&pixel_rgn, pixel,
417
 
                                   0, y - count, drawable->width, count);
418
 
          count = 0;
 
408
        {
 
409
          gimp_pixel_rgn_set_rect (&pixel_rgn, pixel,
 
410
                                   0, y - count, drawable->width, count);
 
411
          count = 0;
419
412
 
420
 
          gimp_progress_update ((double) y / (double) sgip->ysize);
421
 
        }
 
413
          gimp_progress_update ((double) y / (double) sgip->ysize);
 
414
        }
422
415
 
423
416
      for (i = 0; i < sgip->zsize; i ++)
424
 
        if (sgiGetRow (sgip, rows[i], sgip->ysize - 1 - y, i) < 0)
425
 
          printf("sgiGetRow(sgip, rows[i], %d, %d) failed!\n",
426
 
                 sgip->ysize - 1 - y, i);
 
417
        if (sgiGetRow (sgip, rows[i], sgip->ysize - 1 - y, i) < 0)
 
418
          printf("sgiGetRow(sgip, rows[i], %d, %d) failed!\n",
 
419
                 sgip->ysize - 1 - y, i);
427
420
 
428
421
      if (sgip->bpp == 1)
429
 
        {
430
 
          /*
431
 
           * 8-bit (unsigned) pixels...
432
 
           */
 
422
        {
 
423
          /*
 
424
           * 8-bit (unsigned) pixels...
 
425
           */
433
426
 
434
 
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
435
 
            for (i = 0; i < bytes; i ++, pptr ++)
436
 
              *pptr = rows[i][x];
437
 
        }
 
427
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
 
428
            for (i = 0; i < bytes; i ++, pptr ++)
 
429
              *pptr = rows[i][x];
 
430
        }
438
431
      else
439
 
        {
440
 
          /*
441
 
           * 16-bit (unsigned) pixels...
442
 
           */
 
432
        {
 
433
          /*
 
434
           * 16-bit (unsigned) pixels...
 
435
           */
443
436
 
444
 
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
445
 
            for (i = 0; i < bytes; i ++, pptr ++)
446
 
              *pptr = rows[i][x] >> 8;
447
 
        }
 
437
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
 
438
            for (i = 0; i < bytes; i ++, pptr ++)
 
439
              *pptr = rows[i][x] >> 8;
 
440
        }
448
441
    }
449
442
 
450
443
  /*
452
445
   */
453
446
 
454
447
  gimp_pixel_rgn_set_rect (&pixel_rgn, pixel, 0,
455
 
                           y - count, drawable->width, count);
 
448
                           y - count, drawable->width, count);
456
449
 
457
450
  /*
458
451
   * Done with the file...
482
475
 
483
476
static gint
484
477
save_image (const gchar *filename,
485
 
            gint32       image_ID,
486
 
            gint32       drawable_ID)
 
478
            gint32       image_ID,
 
479
            gint32       drawable_ID)
487
480
{
488
481
  gint        i, j,        /* Looping var */
489
482
              x,           /* Current X coordinate */
491
484
              tile_height, /* Height of tile in GIMP */
492
485
              count,       /* Count of rows to put in image */
493
486
              zsize;       /* Number of channels in file */
494
 
  sgi_t      *sgip;        /* File pointer */
 
487
  sgi_t      *sgip;        /* File pointer */
495
488
  GimpDrawable  *drawable;    /* Drawable for layer */
496
489
  GimpPixelRgn   pixel_rgn;   /* Pixel region for layer */
497
490
  guchar    **pixels,      /* Pixel rows */
498
491
             *pixel,       /* Pixel data */
499
492
             *pptr;        /* Current pixel */
500
493
  gushort   **rows;        /* SGI image data */
501
 
  gchar      *progress;    /* Title for progress display... */
502
494
 
503
495
  /*
504
496
   * Get the drawable for the current image...
507
499
  drawable = gimp_drawable_get (drawable_ID);
508
500
 
509
501
  gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
510
 
                       drawable->height, FALSE, FALSE);
 
502
                       drawable->height, FALSE, FALSE);
511
503
 
512
504
  zsize = 0;
513
505
  switch (gimp_drawable_type (drawable_ID))
534
526
   */
535
527
 
536
528
  sgip = sgiOpen ((char *) filename, SGI_WRITE, compression, 1,
537
 
                  drawable->width, drawable->height, zsize);
 
529
                  drawable->width, drawable->height, zsize);
538
530
  if (sgip == NULL)
539
531
    {
540
532
      g_message (_("Could not open '%s' for writing."),
542
534
      return FALSE;
543
535
    };
544
536
 
545
 
  progress = g_strdup_printf (_("Saving '%s'..."),
546
 
                               gimp_filename_to_utf8 (filename));
547
 
  gimp_progress_init (progress);
548
 
  g_free (progress);
 
537
  gimp_progress_init_printf (_("Saving '%s'"),
 
538
                             gimp_filename_to_utf8 (filename));
549
539
 
550
540
  /*
551
541
   * Allocate memory for "tile_height" rows...
575
565
       */
576
566
 
577
567
      if ((y + tile_height) >= drawable->height)
578
 
        count = drawable->height - y;
 
568
        count = drawable->height - y;
579
569
      else
580
 
        count = tile_height;
 
570
        count = tile_height;
581
571
 
582
572
      gimp_pixel_rgn_get_rect (&pixel_rgn, pixel, 0, y, drawable->width, count);
583
573
 
586
576
       */
587
577
 
588
578
      for (i = 0, pptr = pixels[0]; i < count; i ++)
589
 
        {
590
 
          for (x = 0; x < drawable->width; x ++)
591
 
            for (j = 0; j < zsize; j ++, pptr ++)
592
 
              rows[j][x] = *pptr;
 
579
        {
 
580
          for (x = 0; x < drawable->width; x ++)
 
581
            for (j = 0; j < zsize; j ++, pptr ++)
 
582
              rows[j][x] = *pptr;
593
583
 
594
 
          for (j = 0; j < zsize; j ++)
595
 
            sgiPutRow (sgip, rows[j], drawable->height - 1 - y - i, j);
596
 
        };
 
584
          for (j = 0; j < zsize; j ++)
 
585
            sgiPutRow (sgip, rows[j], drawable->height - 1 - y - i, j);
 
586
        };
597
587
 
598
588
      gimp_progress_update ((double) y / (double) drawable->height);
599
589
    };
615
605
static gboolean
616
606
save_dialog (void)
617
607
{
618
 
  GtkWidget *dlg;
 
608
  GtkWidget *dialog;
619
609
  GtkWidget *frame;
620
610
  gboolean   run;
621
611
 
622
 
  dlg = gimp_dialog_new (_("Save as SGI"), "sgi",
623
 
                         NULL, 0,
624
 
                         gimp_standard_help_func, "file-sgi-save",
625
 
 
626
 
                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
627
 
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,
628
 
 
629
 
                         NULL);
 
612
  dialog = gimp_dialog_new (_("Save as SGI"), PLUG_IN_BINARY,
 
613
                            NULL, 0,
 
614
                            gimp_standard_help_func, SAVE_PROC,
 
615
 
 
616
                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 
617
                            GTK_STOCK_SAVE,   GTK_RESPONSE_OK,
 
618
 
 
619
                            NULL);
 
620
 
 
621
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
622
                                           GTK_RESPONSE_OK,
 
623
                                           GTK_RESPONSE_CANCEL,
 
624
                                           -1);
 
625
 
 
626
  gimp_window_set_transient (GTK_WINDOW (dialog));
630
627
 
631
628
  frame = gimp_int_radio_group_new (TRUE, _("Compression type"),
632
 
                                    G_CALLBACK (gimp_radio_button_update),
633
 
                                    &compression, compression,
634
 
 
635
 
                                    _("No compression"),
636
 
                                    SGI_COMP_NONE, NULL,
637
 
                                    _("RLE compression"),
638
 
                                    SGI_COMP_RLE, NULL,
639
 
                                    _("Aggressive RLE\n(not supported by SGI)"),
640
 
                                    SGI_COMP_ARLE, NULL,
641
 
 
642
 
                                    NULL);
 
629
                                    G_CALLBACK (gimp_radio_button_update),
 
630
                                    &compression, compression,
 
631
 
 
632
                                    _("No compression"),
 
633
                                    SGI_COMP_NONE, NULL,
 
634
                                    _("RLE compression"),
 
635
                                    SGI_COMP_RLE, NULL,
 
636
                                    _("Aggressive RLE\n(not supported by SGI)"),
 
637
                                    SGI_COMP_ARLE, NULL,
 
638
 
 
639
                                    NULL);
643
640
 
644
641
  gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
645
 
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
 
642
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
 
643
                      frame, TRUE, TRUE, 0);
646
644
  gtk_widget_show (frame);
647
645
 
648
 
  gtk_widget_show (dlg);
649
 
 
650
 
  run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
651
 
 
652
 
  gtk_widget_destroy (dlg);
 
646
  gtk_widget_show (dialog);
 
647
 
 
648
  run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
 
649
 
 
650
  gtk_widget_destroy (dialog);
653
651
 
654
652
  return run;
655
653
}