Module: Gdk::RGB

Defined in:
ext/gtk2/rbgdkrgb.c

Class Method Summary collapse

Class Method Details

.colormapObject



143
144
145
146
147
# File 'ext/gtk2/rbgdkrgb.c', line 143

static VALUE
rgb_get_cmap(VALUE self)
{
    return GOBJ2RVAL(gdk_rgb_get_colormap());
}

.ditherable?Boolean

Returns:

  • (Boolean)


149
150
151
152
153
# File 'ext/gtk2/rbgdkrgb.c', line 149

static VALUE
rgb_ditherable(VALUE self)
{
    return CBOOL2RVAL(gdk_rgb_ditherable());
}

.draw_gray_image(win, gc, x, y, w, h, dither, buf, rowstride) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
# File 'ext/gtk2/rbgdkrgb.c', line 77

static VALUE
rgb_draw_gray_image(VALUE self, VALUE win, VALUE gc, VALUE x, VALUE y, VALUE w, VALUE h, VALUE dither, VALUE buf, VALUE rowstride)
{
    gdk_draw_gray_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                        NUM2INT(x), NUM2INT(y),
                        NUM2INT(w), NUM2INT(h),
                        RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                        (guchar*)RVAL2CSTR(buf),
                        NUM2INT(rowstride));
    return self;
}

.draw_indexed_image(win, gc, x, y, w, h, dither, buf, rowstride, colors) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'ext/gtk2/rbgdkrgb.c', line 48

static VALUE
rgb_draw_indexed_image(VALUE self, VALUE win, VALUE gc, VALUE x, VALUE y, VALUE w, VALUE h, VALUE dither, VALUE buf, VALUE rowstride, VALUE colors)
{
    GdkRgbCmap* cmap;
    guint32* gcolors;
    gint i, n_colors;

    n_colors = RARRAY_LEN(colors);

    if (n_colors > 255)
        rb_raise(rb_eArgError, "colors: out of range (0 - 255)");

    gcolors = g_new(guint32, n_colors);
    for (i = 0; i < n_colors; i++) {
        gcolors[i] = NUM2UINT(RARRAY_PTR(colors)[i]);
    }

    cmap = gdk_rgb_cmap_new(gcolors, n_colors);
    
    gdk_draw_indexed_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                           NUM2INT(x), NUM2INT(y),
                           NUM2INT(w), NUM2INT(h),
                           RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                           (guchar*)RVAL2CSTR(buf), 
                           NUM2INT(rowstride), cmap);
    gdk_rgb_cmap_free(cmap);
    return self;
}

.draw_rgb_32_image(*args) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'ext/gtk2/rbgdkrgb.c', line 89

static VALUE
rgb_draw_rgb_32_image(int argc, VALUE *argv, VALUE self)
{
    VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;

    rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither, 
                 &buf, &rowstride, &xdith, &ydith);

    if (argc == 9){
        gdk_draw_rgb_32_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                              NUM2INT(x), NUM2INT(y),
                              NUM2INT(w), NUM2INT(h),
                              RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                              (guchar*)RVAL2CSTR(buf),
                              NUM2INT(rowstride));
    } else {
        gdk_draw_rgb_32_image_dithalign(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                                        NUM2INT(x), NUM2INT(y),
                                        NUM2INT(w), NUM2INT(h),
                                        RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                                        (guchar*)RVAL2CSTR(buf),
                                        NUM2INT(rowstride), NUM2INT(xdith), NUM2INT(ydith));
    }
    return self;
}

.draw_rgb_image(*args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/gtk2/rbgdkrgb.c', line 20

static VALUE
rgb_draw_rgb_image(int argc, VALUE *argv, VALUE self)
{
    VALUE win, gc, x, y, w, h, dither, buf, rowstride, xdith, ydith;

    rb_scan_args(argc, argv, "92", &win, &gc, &x, &y, &w, &h, &dither, 
                 &buf, &rowstride, &xdith, &ydith);

    if (argc == 9){
        gdk_draw_rgb_image(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                           NUM2INT(x), NUM2INT(y),
                           NUM2INT(w), NUM2INT(h),
                           RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                           (guchar*)RVAL2CSTR(buf),
                           NUM2INT(rowstride));
    } else {
        gdk_draw_rgb_image_dithalign(RVAL2DRAW(win), GDK_GC(RVAL2GOBJ(gc)),
                                     NUM2INT(x), NUM2INT(y),
                                     NUM2INT(w), NUM2INT(h),
                                     RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                                     (guchar*)RVAL2CSTR(buf),
                                     NUM2INT(rowstride),
                                     NUM2INT(xdith), NUM2INT(ydith));
    }

    return self;
}

.find_color(colormap, color) ⇒ Object



115
116
117
118
119
120
121
# File 'ext/gtk2/rbgdkrgb.c', line 115

static VALUE
rgb_find_color(VALUE self, VALUE colormap, VALUE color)
{
    gdk_rgb_find_color(GDK_COLORMAP(RVAL2GOBJ(colormap)),
                       RVAL2GDKCOLOR(color));
    return self;
}

.set_install(install) ⇒ Object



123
124
125
126
127
128
# File 'ext/gtk2/rbgdkrgb.c', line 123

static VALUE
rgb_set_install(VALUE self, VALUE install)
{
    gdk_rgb_set_install(RVAL2CBOOL(install));
    return self;
}

.set_min_colors(min_colors) ⇒ Object



130
131
132
133
134
135
# File 'ext/gtk2/rbgdkrgb.c', line 130

static VALUE
rgb_set_min_colors(VALUE self, VALUE min_colors)
{
    gdk_rgb_set_min_colors(NUM2INT(min_colors));
    return self;
}

.set_verbose(verbose) ⇒ Object



155
156
157
158
159
160
# File 'ext/gtk2/rbgdkrgb.c', line 155

static VALUE
rgb_set_verbose(VALUE self, VALUE verbose)
{
    gdk_rgb_set_verbose(RVAL2CBOOL(verbose));
    return self;
}

.visualObject



137
138
139
140
141
# File 'ext/gtk2/rbgdkrgb.c', line 137

static VALUE
rgb_get_visual(VALUE self)
{
    return GOBJ2RVAL(gdk_rgb_get_visual());
}