Class: XCB::QueryColorsReply

Inherits:
Object
  • Object
show all
Defined in:
ext/xproto.c

Instance Method Summary collapse

Instance Method Details

#colorsObject



4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
# File 'ext/xproto.c', line 4124

static VALUE
r_XCB_QueryColorsReply_get_colors(VALUE r_self)
{
  xcb_query_colors_reply_t *reply;
  Data_Get_Struct(r_self, xcb_query_colors_reply_t, reply);
  xcb_rgb_iterator_t iterator = xcb_query_colors_colors_iterator(reply);
  VALUE r_colors = rb_ary_new();
  while (iterator.rem != 0) {
    xcb_rgb_t *data = malloc(sizeof(xcb_rgb_t));
    if (data == NULL)
      rb_raise(rb_eNoMemError, "NoMemoryError");
    VALUE r_data = Data_Wrap_Struct(r_XCB_RGB, NULL, NULL, data);
    *data = *iterator.data;
    rb_ary_push(r_colors, r_data);
    xcb_rgb_next(&iterator);
  }
  return r_colors;
}

#colors_lenObject



4117
4118
4119
4120
4121
4122
4123
# File 'ext/xproto.c', line 4117

static VALUE
r_XCB_QueryColorsReply_get_colors_len(VALUE r_self)
{
  xcb_query_colors_reply_t *reply;
  Data_Get_Struct(r_self, xcb_query_colors_reply_t, reply);
  return INT2FIX(reply->colors_len);
}