~keruspe/gnome-paint/latest-gtk2

« back to all changes in this revision

Viewing changes to src/gp-image.c

  • Committer: Rogério Ferro do Nascimento
  • Date: 2010-07-04 23:10:58 UTC
  • Revision ID: rogerio@rogerio-laptop-20100704231058-cbnylgmfna44x4c9
- added first version of selection area with move and resize. 
  - This version have an approach a litle different: first you need to select than you double click to modify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
                GdkPixbuf *tmp ;
327
327
                tmp = gdk_pixbuf_add_alpha(pixbuf, FALSE, 0, 0, 0);
328
328
                g_object_unref(pixbuf);
329
 
                pixbuf = tmp;
 
329
                image->priv->pixbuf = tmp;
330
330
        }
331
331
        m_pixbuf        =   gdk_pixbuf_copy ( pixbuf );
332
332
        
369
369
gp_image_draw ( GpImage *image, 
370
370
                GdkDrawable *drawable,
371
371
                GdkGC *gc,
372
 
                                gint x, gint y )
 
372
                                gint x, gint y,
 
373
                gint width, gint height )
373
374
{
 
375
        gboolean        resized;
 
376
        GdkPixbuf   *pixbuf;
 
377
        gint            wo,ho,w,h;
 
378
 
 
379
        g_return_if_fail ( GP_IS_IMAGE (image) );
 
380
 
 
381
        wo = gp_image_get_width  (image);
 
382
        ho = gp_image_get_height (image);
 
383
        w = (width  == -1)?wo:width;
 
384
        h = (height == -1)?ho:height;
 
385
 
 
386
        if ( w == wo && h == ho )
 
387
        {
 
388
                pixbuf  = image->priv->pixbuf;
 
389
                resized = FALSE;
 
390
        }
 
391
        else
 
392
        {
 
393
                pixbuf = gdk_pixbuf_scale_simple ( image->priv->pixbuf, w, h, GDK_INTERP_HYPER );
 
394
                resized = TRUE;
 
395
        }
 
396
        
374
397
        gdk_draw_pixbuf ( drawable,
375
398
                                  gc,
376
 
                                  image->priv->pixbuf,
 
399
                                  pixbuf,
377
400
                                  0, 0,
378
401
                                  x, y,
379
402
                                  -1, -1,
380
403
                                  GDK_RGB_DITHER_NORMAL, 
381
404
                              0, 0);
 
405
        if ( resized )
 
406
        {
 
407
                g_object_unref ( pixbuf );
 
408
        }
382
409
}
383
410
 
384
411
gint
408
435
        return mask;
409
436
}
410
437
 
411