Module: PixbufUtils

Defined in:
ext/pixbufutils/pixbufutils.c

Class Method Summary collapse

Class Method Details

.auto_equalize(__v_src) ⇒ Object



806
807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'ext/pixbufutils/pixbufutils.c', line 806

static VALUE
PixbufUtils_CLASS_auto_equalize(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 391 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((auto_equalize(src, gdk_pixbuf_copy(src)))); goto out; } while(0);
out:
;
  return __p_retval;
}

.blend5050(__v_src1, __v_src2) ⇒ Object



821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# File 'ext/pixbufutils/pixbufutils.c', line 821

static VALUE
PixbufUtils_CLASS_blend5050(VALUE self OPTIONAL_ATTR , VALUE __v_src1 OPTIONAL_ATTR, VALUE __v_src2 OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src1; GdkPixbuf * __orig_src1;
  GdkPixbuf * src2; GdkPixbuf * __orig_src2;
  __orig_src1 = src1 = GDK_PIXBUF(RVAL2GOBJ(__v_src1));
  __orig_src2 = src2 = GDK_PIXBUF(RVAL2GOBJ(__v_src2));

#line 395 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_blend5050(src1, src2))); goto out; } while(0);
out:
;
;
  return __p_retval;
}

.blur(__v_src, __v_radius) ⇒ Object



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'ext/pixbufutils/pixbufutils.c', line 400

static VALUE
PixbufUtils_CLASS_blur(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_radius OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int radius; int __orig_radius;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_radius = radius = NUM2INT(__v_radius);

#line 288 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_blur(gdk_pixbuf_copy(src), radius))); goto out; } while(0);
out:
;
  return __p_retval;
}

.brightness(__v_src, __v_adjust) ⇒ Object



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'ext/pixbufutils/pixbufutils.c', line 468

static VALUE
PixbufUtils_CLASS_brightness(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_adjust OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int adjust; int __orig_adjust;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_adjust = adjust = NUM2INT(__v_adjust);

#line 304 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_adjust_brightness(src, gdk_pixbuf_copy(src), adjust))); goto out; } while(0);
out:
;
  return __p_retval;
}

.contrast(__v_src, __v_adjust) ⇒ Object



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'ext/pixbufutils/pixbufutils.c', line 417

static VALUE
PixbufUtils_CLASS_contrast(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_adjust OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int adjust; int __orig_adjust;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_adjust = adjust = NUM2INT(__v_adjust);

#line 292 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_adjust_contrast(src, gdk_pixbuf_copy(src), adjust))); goto out; } while(0);
out:
;
  return __p_retval;
}

.draw_scaled(*__p_argv, self) ⇒ Object



914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
# File 'ext/pixbufutils/pixbufutils.c', line 914

static VALUE
PixbufUtils_CLASS_draw_scaled(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_drawable = Qnil;
  GdkDrawable * drawable; GdkDrawable * __orig_drawable;
  VALUE __v_src = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  VALUE __v_x = Qnil;
  int x; int __orig_x;
  VALUE __v_y = Qnil;
  int y; int __orig_y;
  VALUE __v_width = Qnil;
  int width; int __orig_width;
  VALUE __v_height = Qnil;
  int height; int __orig_height;
  VALUE __v_interp = Qnil;
  GdkInterpType interp; GdkInterpType __orig_interp;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "61",&__v_drawable, &__v_src, &__v_x, &__v_y, &__v_width, &__v_height, &__v_interp);

  /* Set defaults */
  __orig_drawable = drawable = RVAL2GOBJ(__v_drawable);

  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

  __orig_x = x = NUM2INT(__v_x);

  __orig_y = y = NUM2INT(__v_y);

  __orig_width = width = NUM2INT(__v_width);

  __orig_height = height = NUM2INT(__v_height);

  if (__p_argc > 6)
    __orig_interp = interp = RVAL2GENUM(__v_interp, GDK_TYPE_INTERP_TYPE);
  else
    interp = GDK_INTERP_BILINEAR;


#line 421 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"

  do {
  GdkPixbuf * tmp  ;
 IGNORE(self);
  if((width == gdk_pixbuf_get_width(src)) && (height == gdk_pixbuf_get_height(src))) { tmp = src;
  } else if (((tmp = (GdkPixbuf*)g_object_get_data(G_OBJECT(src), "pixbuf_utils_scaled")) == NULL) || ((width != gdk_pixbuf_get_width(tmp)) || (height != gdk_pixbuf_get_height(tmp)))) { if (tmp) fprintf(stderr, "Old pixbuf is %i,%i\n", gdk_pixbuf_get_width(tmp), gdk_pixbuf_get_height(tmp));
  fprintf(stderr, "Scaling pixbuf to %i,%i\n", width, height);
  tmp = gdk_pixbuf_scale_simple(src, width, height, interp);
  g_object_set_data_full(G_OBJECT(src), "pixbuf_utils_scaled", tmp, g_object_unref);
  } g_return_val_if_fail(tmp != NULL, Qfalse);
  gdk_draw_pixbuf(/* GdkDrawable *drawable */ drawable, /* GdkGC *gc */ NULL, /* GdkPixbuf *pixbuf */ tmp, /* gint src_x */ 0, /* gint src_y */ 0, /* gint dest_x */ x, /* gint dest_y */ y, /* gint width */ width, /* gint height */ height, /* GdkRgbDither dither */ GDK_RGB_DITHER_NORMAL, /* gint x_dither */ 0, /* gint y_dither */ 0);
  do { __p_retval = Qtrue; goto out; } while(0);

  } while(0);

out:
;
;
;
  return __p_retval;
}

.draw_scaled_clip(*__p_argv, self) ⇒ Object



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
# File 'ext/pixbufutils/pixbufutils.c', line 978

static VALUE
PixbufUtils_CLASS_draw_scaled_clip(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_drawable = Qnil;
  GdkDrawable * drawable; GdkDrawable * __orig_drawable;
  VALUE __v_src = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  VALUE __v_x = Qnil;
  int x; int __orig_x;
  VALUE __v_y = Qnil;
  int y; int __orig_y;
  VALUE __v_width = Qnil;
  int width; int __orig_width;
  VALUE __v_height = Qnil;
  int height; int __orig_height;
  VALUE __v_clip_area = Qnil;
  GdkRectangle * clip_area; GdkRectangle * __orig_clip_area;
  VALUE __v_interp = Qnil;
  GdkInterpType interp; GdkInterpType __orig_interp;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "71",&__v_drawable, &__v_src, &__v_x, &__v_y, &__v_width, &__v_height, &__v_clip_area, &__v_interp);

  /* Set defaults */
  __orig_drawable = drawable = RVAL2GOBJ(__v_drawable);

  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

  __orig_x = x = NUM2INT(__v_x);

  __orig_y = y = NUM2INT(__v_y);

  __orig_width = width = NUM2INT(__v_width);

  __orig_height = height = NUM2INT(__v_height);

  __orig_clip_area = clip_area = RVAL2BOXED(__v_clip_area, GDK_TYPE_RECTANGLE);

  if (__p_argc > 7)
    __orig_interp = interp = RVAL2GENUM(__v_interp, GDK_TYPE_INTERP_TYPE);
  else
    interp = GDK_INTERP_BILINEAR;


#line 457 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"

  do {
  GdkPixbuf * tmp  ;
 GdkGC * gc  ;
 IGNORE(self);
  if((width == gdk_pixbuf_get_width(src)) && (height == gdk_pixbuf_get_height(src))) { tmp = src;
  } else if (((tmp = (GdkPixbuf*)g_object_get_data(G_OBJECT(src), "pixbuf_utils_scaled")) == NULL) || ((width != gdk_pixbuf_get_width(tmp)) || (height != gdk_pixbuf_get_height(tmp)))) { if (tmp) fprintf(stderr, "Old pixbuf is %i,%i\n", gdk_pixbuf_get_width(tmp), gdk_pixbuf_get_height(tmp));
  fprintf(stderr, "Scaling pixbuf to %i,%i\n", width, height);
  tmp = gdk_pixbuf_scale_simple(src, width, height, interp);
  g_object_set_data_full(G_OBJECT(src), "pixbuf_utils_scaled", tmp, g_object_unref);
  } g_return_val_if_fail(tmp != NULL, Qfalse);
  gc = gdk_gc_new(drawable);
  gdk_gc_set_clip_rectangle(GDK_GC(gc), clip_area);
  gdk_draw_pixbuf(/* GdkDrawable *drawable */ drawable, /* GdkGC *gc */ gc, /* GdkPixbuf *pixbuf */ tmp, /* gint src_x */ clip_area->x, /* gint src_y */ clip_area->y, /* gint dest_x */ x + clip_area->x, /* gint dest_y */ y + clip_area->y, /* gint width */ clip_area->width, /* gint height */ clip_area->height, /* GdkRgbDither dither */ GDK_RGB_DITHER_NORMAL, /* gint x_dither */ 0, /* gint y_dither */ 0);
  g_object_unref(gc);
  do { __p_retval = Qtrue; goto out; } while(0);

  } while(0);

out:
;
;
;
;
  return __p_retval;
}

.extract_alpha(*__p_argv, self) ⇒ Object



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'ext/pixbufutils/pixbufutils.c', line 364

static VALUE
PixbufUtils_CLASS_extract_alpha(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_src = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  VALUE __v_cutoff = Qnil;
  int cutoff; int __orig_cutoff;
  VALUE __v_force_2bit = Qnil;
  bool force_2bit; bool __orig_force_2bit;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "12",&__v_src, &__v_cutoff, &__v_force_2bit);

  /* Set defaults */
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

  if (__p_argc > 1)
    __orig_cutoff = cutoff = NUM2INT(__v_cutoff);
  else
    cutoff = 127;

  if (__p_argc > 2)
    __orig_force_2bit = force_2bit = RTEST(__v_force_2bit);
  else
    force_2bit = FALSE;


#line 284 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_extract_alpha(src, cutoff, force_2bit))); goto out; } while(0);
out:
;
  return __p_retval;
}

.filter(__v_src, filter, __v_divisor) ⇒ Object



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'ext/pixbufutils/pixbufutils.c', line 485

static VALUE
PixbufUtils_CLASS_filter(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE filter OPTIONAL_ATTR, VALUE __v_divisor OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  double divisor; double __orig_divisor;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  Check_Type(filter, T_ARRAY);
  __orig_divisor = divisor = NUM2DBL(__v_divisor);

#line 308 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"

  do {
  int matrix_size = RARRAY_LEN(filter), len, i;
  double * matrix  ;
 IGNORE(self);
  len = (int) sqrt((double)matrix_size);
  if ((len * len) != matrix_size) { rb_raise(rb_eArgError, "Invalid matrix size - sqrt(%i)*sqrt(%i) != %i", matrix_size, matrix_size, matrix_size);
  } matrix = ALLOCA_N(double, matrix_size);
  for (i = 0;
  i < matrix_size;
  i ++) { matrix[i] = NUM2DBL(RARRAY_PTR(filter)[i]);
  } do { __p_retval = unref_pixbuf((pixbuf_convolution_matrix(src, gdk_pixbuf_copy(src), len, matrix, divisor))); goto out; } while(0);

  } while(0);

out:
;
  return __p_retval;
}

.gamma(__v_src, __v_level) ⇒ Object



630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'ext/pixbufutils/pixbufutils.c', line 630

static VALUE
PixbufUtils_CLASS_gamma(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_level OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  double level; double __orig_level;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_level = level = NUM2DBL(__v_level);

#line 355 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_gamma(src, gdk_pixbuf_copy(src), level))); goto out; } while(0);
out:
;
  return __p_retval;
}

.gamma!(__v_src, __v_level) ⇒ Object



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'ext/pixbufutils/pixbufutils.c', line 596

static VALUE
PixbufUtils_CLASS_gamma_pling(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_level OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  double level; double __orig_level;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_level = level = NUM2DBL(__v_level);

#line 347 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = GOBJ2RVAL(pixbuf_gamma(src, src, level)); goto out; } while(0);
out:
;
  return __p_retval;
}

.greyscale(__v_src) ⇒ Object



679
680
681
682
683
684
685
686
687
688
689
690
691
692
# File 'ext/pixbufutils/pixbufutils.c', line 679

static VALUE
PixbufUtils_CLASS_greyscale(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 367 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_greyscale(src, gdk_pixbuf_copy(src)))); goto out; } while(0);
out:
;
  return __p_retval;
}

.greyscale!(__v_src) ⇒ Object



647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'ext/pixbufutils/pixbufutils.c', line 647

static VALUE
PixbufUtils_CLASS_greyscale_pling(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 359 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = GOBJ2RVAL(pixbuf_greyscale(src, src)); goto out; } while(0);
out:
;
  return __p_retval;
}

.greyscale_go(__v_src) ⇒ Object



709
710
711
712
713
714
715
716
717
718
719
720
721
722
# File 'ext/pixbufutils/pixbufutils.c', line 709

static VALUE
PixbufUtils_CLASS_greyscale_go(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 375 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_greyscale_go(src, gdk_pixbuf_copy(src)))); goto out; } while(0);
out:
;
  return __p_retval;
}

.greyscale_go!(__v_src) ⇒ Object



694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'ext/pixbufutils/pixbufutils.c', line 694

static VALUE
PixbufUtils_CLASS_greyscale_go_pling(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 371 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = GOBJ2RVAL(pixbuf_greyscale_go(src, src)); goto out; } while(0);
out:
;
  return __p_retval;
}

.mask(__v_src, __v_mask) ⇒ Object



788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
# File 'ext/pixbufutils/pixbufutils.c', line 788

static VALUE
PixbufUtils_CLASS_mask(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_mask OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  GdkPixbuf * mask; GdkPixbuf * __orig_mask;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_mask = mask = GDK_PIXBUF(RVAL2GOBJ(__v_mask));

#line 387 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_mask(src, mask))); goto out; } while(0);
out:
;
;
  return __p_retval;
}

.mask_area(*__p_argv, self) ⇒ Object



839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'ext/pixbufutils/pixbufutils.c', line 839

static VALUE
PixbufUtils_CLASS_mask_area(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_mask = Qnil;
  GdkPixbuf * mask; GdkPixbuf * __orig_mask;
  VALUE __v_cutoff = Qnil;
  int cutoff; int __orig_cutoff;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "11",&__v_mask, &__v_cutoff);

  /* Set defaults */
  __orig_mask = mask = GDK_PIXBUF(RVAL2GOBJ(__v_mask));

  if (__p_argc > 1)
    __orig_cutoff = cutoff = NUM2INT(__v_cutoff);
  else
    cutoff = 127;


#line 399 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = pixbuf_mask_area(mask, cutoff); goto out; } while(0);
out:
;
  return __p_retval;
}

.perspect_v(__v_src, __v_top_x1, __v_top_x2, __v_bot_x1, __v_bot_x2) ⇒ Object



765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
# File 'ext/pixbufutils/pixbufutils.c', line 765

static VALUE
PixbufUtils_CLASS_perspect_v(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_top_x1 OPTIONAL_ATTR, VALUE __v_top_x2 OPTIONAL_ATTR, VALUE __v_bot_x1 OPTIONAL_ATTR, VALUE __v_bot_x2 OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int top_x1; int __orig_top_x1;
  int top_x2; int __orig_top_x2;
  int bot_x1; int __orig_bot_x1;
  int bot_x2; int __orig_bot_x2;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_top_x1 = top_x1 = NUM2INT(__v_top_x1);
  __orig_top_x2 = top_x2 = NUM2INT(__v_top_x2);
  __orig_bot_x1 = bot_x1 = NUM2INT(__v_bot_x1);
  __orig_bot_x2 = bot_x2 = NUM2INT(__v_bot_x2);

#line 383 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_perspect_v(src, top_x1, top_x2, bot_x1, bot_x2))); goto out; } while(0);
out:
;
  return __p_retval;
}

.remove_alpha(__v_src, __v_col) ⇒ Object

Code



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'ext/pixbufutils/pixbufutils.c', line 315

static VALUE
PixbufUtils_CLASS_remove_alpha(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_col OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  GdkColor * col; GdkColor * __orig_col;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_col = col = RVAL2BOXED(__v_col, GDK_TYPE_COLOR);

#line 259 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"

  do {
  GdkPixbuf * dest  ;
 uint w,h, pixcol;
  IGNORE(self);
  pixcol = (((col->red >> 8)&0xff) << 24) | (((col->green >> 8)&0xff) << 16) | (((col->blue >> 8)&0xff) << 8) | 0xFF;
  w=gdk_pixbuf_get_width(src);
  h=gdk_pixbuf_get_height(src);
  dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h);
  if(!dest) rb_raise(rb_eNoMemError, "Unable to allocate memory for pixbuf");
  gdk_pixbuf_fill(dest, pixcol);
  gdk_pixbuf_composite(src, dest, 0, 0, w, h, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 0xff);
  do { __p_retval = unref_pixbuf((dest)); goto out; } while(0);

  } while(0);

out:
;
;
  return __p_retval;
}

.rotate(__v_src, __v_angle) ⇒ Object



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'ext/pixbufutils/pixbufutils.c', line 563

static VALUE
PixbufUtils_CLASS_rotate(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_angle OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int angle; int __orig_angle;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_angle = angle = NUM2INT(__v_angle);

#line 338 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  g_assert(angle == 0 || angle == 90 || angle == 180 || angle == 270);
  do { __p_retval = unref_pixbuf((pixbuf_rotate(src, (rotate_angle_t)angle))); goto out; } while(0);
out:
;
  return __p_retval;
}

.rotate_180(__v_src) ⇒ Object



548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'ext/pixbufutils/pixbufutils.c', line 548

static VALUE
PixbufUtils_CLASS_rotate_180(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 334 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_rotate(src, ANGLE_180))); goto out; } while(0);
out:
;
  return __p_retval;
}

.rotate_90(__v_src, __v_counter_clockwise) ⇒ Object



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'ext/pixbufutils/pixbufutils.c', line 516

static VALUE
PixbufUtils_CLASS_rotate_90(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_counter_clockwise OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  bool counter_clockwise; bool __orig_counter_clockwise;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_counter_clockwise = counter_clockwise = RTEST(__v_counter_clockwise);

#line 326 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_rotate(src, counter_clockwise ? ANGLE_270 : ANGLE_90))); goto out; } while(0);
out:
;
  return __p_retval;
}

.rotate_ccw(__v_src) ⇒ Object



581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'ext/pixbufutils/pixbufutils.c', line 581

static VALUE
PixbufUtils_CLASS_rotate_ccw(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 343 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_rotate(src, ANGLE_270))); goto out; } while(0);
out:
;
  return __p_retval;
}

.rotate_cw(__v_src) ⇒ Object



533
534
535
536
537
538
539
540
541
542
543
544
545
546
# File 'ext/pixbufutils/pixbufutils.c', line 533

static VALUE
PixbufUtils_CLASS_rotate_cw(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

#line 330 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_rotate(src, ANGLE_90))); goto out; } while(0);
out:
;
  return __p_retval;
}

.saturation(__v_src, __v_adjust) ⇒ Object



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'ext/pixbufutils/pixbufutils.c', line 451

static VALUE
PixbufUtils_CLASS_saturation(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_adjust OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int adjust; int __orig_adjust;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_adjust = adjust = NUM2INT(__v_adjust);

#line 300 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_adjust_saturation(src, gdk_pixbuf_copy(src), adjust))); goto out; } while(0);
out:
;
  return __p_retval;
}

.scale_max(*__p_argv, self) ⇒ Object



868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
# File 'ext/pixbufutils/pixbufutils.c', line 868

static VALUE
PixbufUtils_CLASS_scale_max(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_src = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  VALUE __v_max = Qnil;
  gulong max; gulong __orig_max;
  VALUE __v_interp = Qnil;
  GdkInterpType interp; GdkInterpType __orig_interp;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "21",&__v_src, &__v_max, &__v_interp);

  /* Set defaults */
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

  __orig_max = max = NUM2UINT(__v_max);

  if (__p_argc > 2)
    __orig_interp = interp = RVAL2GENUM(__v_interp, GDK_TYPE_INTERP_TYPE);
  else
    interp = GDK_INTERP_BILINEAR;


#line 403 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"

  do {
  gulong width, height, largest;
  gdouble  scale  ;
 IGNORE(self);
  width = gdk_pixbuf_get_width(src);
  height = gdk_pixbuf_get_height(src);
  largest = MAX(width, height);
  if (max > largest) { do { __p_retval = unref_pixbuf((gdk_pixbuf_copy(src))); goto out; } while(0); } scale = (double)(max) / (double)(largest);
  do { __p_retval = unref_pixbuf((gdk_pixbuf_scale_simple(src, (int)(scale * width), (int)(scale * height), interp))); goto out; } while(0);

  } while(0);

out:
;
;
;
  return __p_retval;
}

.sharpen(__v_src, __v_radius) ⇒ Object



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'ext/pixbufutils/pixbufutils.c', line 347

static VALUE
PixbufUtils_CLASS_sharpen(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_radius OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int radius; int __orig_radius;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_radius = radius = NUM2INT(__v_radius);

#line 280 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_sharpen(src, radius))); goto out; } while(0);
out:
;
  return __p_retval;
}

.soften_edges!(__v_src, __v_size) ⇒ Object



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'ext/pixbufutils/pixbufutils.c', line 613

static VALUE
PixbufUtils_CLASS_soften_edges_pling(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_size OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int size; int __orig_size;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_size = size = NUM2INT(__v_size);

#line 351 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = GOBJ2RVAL(pixbuf_soften_edges(src, size)); goto out; } while(0);
out:
;
  return __p_retval;
}

.tint(*__p_argv, self) ⇒ Object



724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# File 'ext/pixbufutils/pixbufutils.c', line 724

static VALUE
PixbufUtils_CLASS_tint(int __p_argc, VALUE *__p_argv, VALUE self)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  VALUE __v_src = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  VALUE __v_r = Qnil;
  int r; int __orig_r;
  VALUE __v_g = Qnil;
  int g; int __orig_g;
  VALUE __v_b = Qnil;
  int b; int __orig_b;
  VALUE __v_alpha = Qnil;
  int alpha; int __orig_alpha;

  /* Scan arguments */
  rb_scan_args(__p_argc, __p_argv, "41",&__v_src, &__v_r, &__v_g, &__v_b, &__v_alpha);

  /* Set defaults */
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));

  __orig_r = r = NUM2INT(__v_r);

  __orig_g = g = NUM2INT(__v_g);

  __orig_b = b = NUM2INT(__v_b);

  if (__p_argc > 4)
    __orig_alpha = alpha = NUM2INT(__v_alpha);
  else
    alpha = 255;


#line 379 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_tint(src, gdk_pixbuf_copy(src), r, g, b, alpha))); goto out; } while(0);
out:
;
  return __p_retval;
}

.to_tiff(__v_src, __v_filename) ⇒ Object



662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'ext/pixbufutils/pixbufutils.c', line 662

static VALUE
PixbufUtils_CLASS_to_tiff(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_filename OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  char * filename; char * __orig_filename;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_filename = filename = ( NIL_P(__v_filename) ? NULL : StringValuePtr(__v_filename) );

#line 363 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval =  ((pixbuf_save_tiff(src, filename)) ? Qtrue : Qfalse); goto out; } while(0);
out:
;
  return __p_retval;
}

.vibrance(__v_src, __v_adjust) ⇒ Object



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'ext/pixbufutils/pixbufutils.c', line 434

static VALUE
PixbufUtils_CLASS_vibrance(VALUE self OPTIONAL_ATTR , VALUE __v_src OPTIONAL_ATTR, VALUE __v_adjust OPTIONAL_ATTR)
{
  VALUE __p_retval OPTIONAL_ATTR = Qnil;
  GdkPixbuf * src; GdkPixbuf * __orig_src;
  int adjust; int __orig_adjust;
  __orig_src = src = GDK_PIXBUF(RVAL2GOBJ(__v_src));
  __orig_adjust = adjust = NUM2INT(__v_adjust);

#line 296 "/home/geoff/Projects/pixbufutils/ext/pixbufutils/pixbufutils.cr"
  IGNORE(self);
  do { __p_retval = unref_pixbuf((pixbuf_adjust_vibrance(src, gdk_pixbuf_copy(src), adjust))); goto out; } while(0);
out:
;
  return __p_retval;
}