Class: Caca::Canvas

Inherits:
Object
  • Object
show all
Defined in:
ext/caca/caca-canvas.c

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'ext/caca/caca-canvas.c', line 53

static VALUE canvas_initialize(VALUE self, VALUE width, VALUE height)
{
    caca_canvas_t *canvas;

    canvas = caca_create_canvas(NUM2INT(width), NUM2INT(height));

    if(canvas == NULL)
    {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }

    _SELF = canvas;

    return self;
}

Class Method Details

.export_listObject

.import_listObject

Instance Method Details

#add_dirty_rect(x, y, w, h) ⇒ Object

FIXME Handle an array for the rect



697
698
699
700
701
# File 'ext/caca/caca-canvas.c', line 697

static VALUE add_dirty_rect(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
{
    caca_add_dirty_rect(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
    return self;
}

#attr=(attr) ⇒ Object



150
151
152
153
154
155
156
# File 'ext/caca/caca-canvas.c', line 150

static VALUE set_attr(VALUE self, VALUE attr)
{
    if(caca_set_attr(_SELF, NUM2ULONG(attr)) <0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#blit(*args) ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'ext/caca/caca-canvas.c', line 210

static VALUE blit(int argc, VALUE* argv, VALUE self) {
    VALUE x, y, src, mask;
    caca_canvas_t *csrc, *cmask;

    rb_scan_args(argc, argv, "31", &x, &y, &src, &mask);

    Check_Type(x, T_FIXNUM);
    Check_Type(y, T_FIXNUM);

    if(CLASS_OF(src) != cCanvas)
    {
        rb_raise(rb_eArgError, "src is not a Caca::Canvas");
    }
    Data_Get_Struct(src, caca_canvas_t, csrc);

    if(!NIL_P(mask))
    {
        if(CLASS_OF(mask) != cCanvas)
        {
            rb_raise(rb_eArgError, "mask is not a Caca::Canvas");
        }
        Data_Get_Struct(mask, caca_canvas_t, cmask);
    }
    else
        cmask = NULL;

    if(caca_blit(_SELF, NUM2INT(x), NUM2INT(y), csrc, cmask)<0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#clearObject

#clear_dirty_rect_listObject

#create_frame(id) ⇒ Object



557
558
559
560
561
562
563
# File 'ext/caca/caca-canvas.c', line 557

static VALUE create_frame(VALUE self, VALUE id)
{
    if(caca_create_frame(_SELF, NUM2INT(id))<0) {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }
    return self;
}

#dirty_rectObject

#dirty_rect_countObject

#dirty_rectsObject



684
685
686
687
688
689
690
691
692
693
694
# File 'ext/caca/caca-canvas.c', line 684

static VALUE dirty_rects(VALUE self)
{
    int n = caca_get_dirty_rect_count(_SELF), i;
    VALUE ary;
    ary = rb_ary_new();
    for(i=0; i<n; i++)
    {
        rb_ary_push(ary, dirty_rect(self, INT2NUM(i)));
    }
    return ary;
}

#disable_dirty_rectObject

#dither_bitmap(x, y, w, h, d, pixels) ⇒ Object



510
511
512
513
514
515
516
517
518
# File 'ext/caca/caca-canvas.c', line 510

static VALUE dither_bitmap(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE d, VALUE pixels)
{
    if(CLASS_OF(d) != cDither)
        rb_raise(rb_eArgError, "d is not a Caca::Dither");
    Check_Type(pixels, T_STRING);

    caca_dither_bitmap(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), DATA_PTR(d), StringValuePtr(pixels));
    return self;
}

#draw_box(x, y, w, h, ch) ⇒ Object



412
413
414
415
416
# File 'ext/caca/caca-canvas.c', line 412

static VALUE draw_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE ch)
{
    caca_draw_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch));
    return self;
}

#draw_circle(x, y, r, ch) ⇒ Object



388
389
390
391
392
# File 'ext/caca/caca-canvas.c', line 388

static VALUE draw_circle(VALUE self, VALUE x, VALUE y, VALUE r, VALUE ch)
{
    caca_draw_circle(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(r), NUM2ULONG(ch));
    return self;
}

#draw_cp437_box(x, y, w, h) ⇒ Object



424
425
426
427
428
# File 'ext/caca/caca-canvas.c', line 424

static VALUE draw_cp437_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
{
    caca_draw_cp437_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
    return self;
}

#draw_ellipse(x, y, a, b, ch) ⇒ Object



394
395
396
397
398
# File 'ext/caca/caca-canvas.c', line 394

static VALUE draw_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b, VALUE ch)
{
    caca_draw_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch));
    return self;
}

#draw_lineObject

#draw_polyline(points, ch) ⇒ Object



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'ext/caca/caca-canvas.c', line 270

static VALUE draw_polyline(VALUE self, VALUE points, VALUE ch)
{
    int i, n;
    int *ax, *ay;
    int error = 0;
    VALUE v, x, y;

    n = RARRAY_LEN(points);

    ax = (int*)malloc(n*sizeof(int));
    if(!ax)
        rb_raise(rb_eNoMemError,"Out of memory");

    ay = (int*)malloc(n*sizeof(int));
    if(!ay)
    {
        free(ax);
        rb_raise(rb_eNoMemError,"Out of memory");
    }

    for(i=0; i<n; i++)
    {
        v = rb_ary_entry(points, i);
        if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2))
        {
            x = rb_ary_entry(v,0);
            y = rb_ary_entry(v,1);
            if(rb_obj_is_kind_of(x, rb_cInteger) &&
               rb_obj_is_kind_of(y, rb_cInteger))
            {
                ax[i] = NUM2INT(x);
                ay[i] = NUM2INT(y);
            } else
                error = 1;
        }
        else
            error = 1;
    }

    if(error)
    {
        free(ax);
        free(ay);
        rb_raise(rb_eArgError, "Invalid list of points");
    }

    n--;

    caca_draw_polyline(_SELF, ax, ay, n, NUM2ULONG(ch));

    free(ax);
    free(ay);

    return self;
}

#draw_thin_box(x, y, w, h) ⇒ Object



418
419
420
421
422
# File 'ext/caca/caca-canvas.c', line 418

static VALUE draw_thin_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
{
    caca_draw_thin_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
    return self;
}

#draw_thin_ellipse(x, y, a, b) ⇒ Object



400
401
402
403
404
# File 'ext/caca/caca-canvas.c', line 400

static VALUE draw_thin_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b)
{
    caca_draw_thin_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b));
    return self;
}

#draw_thin_line(x1, y1, x2, y2) ⇒ Object



326
327
328
329
330
# File 'ext/caca/caca-canvas.c', line 326

static VALUE draw_thin_line(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2)
{
    caca_draw_thin_line(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2));
    return self;
}

#draw_thin_polyline(points) ⇒ Object



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'ext/caca/caca-canvas.c', line 332

static VALUE draw_thin_polyline(VALUE self, VALUE points)
{
    int i, n;
    int *ax, *ay;
    int error = 0;
    VALUE v, x, y;

    n = RARRAY_LEN(points);

    ax = (int*)malloc(n*sizeof(int));
    if(!ax)
        rb_raise(rb_eNoMemError,"Out of memory");

    ay = (int*)malloc(n*sizeof(int));
    if(!ay)
    {
        free(ax);
        rb_raise(rb_eNoMemError,"Out of memory");
    }

    for(i=0; i<n; i++)
    {
        v = rb_ary_entry(points, i);
        if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2))
        {
            x = rb_ary_entry(v,0);
            y = rb_ary_entry(v,1);
            if(rb_obj_is_kind_of(x, rb_cInteger) &&
               rb_obj_is_kind_of(y, rb_cInteger))
            {
                ax[i] = NUM2INT(x);
                ay[i] = NUM2INT(y);
            } else
                error = 1;
        }
        else
            error = 1;
    }

    if(error)
    {
        free(ax);
        free(ay);
        rb_raise(rb_eArgError, "Invalid list of points");
    }

    n--;

    caca_draw_thin_polyline(_SELF, ax, ay, n);

    free(ax);
    free(ay);

    return self;
}

#draw_thin_triangle(x1, y1, x2, y2, x3, y3) ⇒ Object



442
443
444
445
446
# File 'ext/caca/caca-canvas.c', line 442

static VALUE draw_thin_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3)
{
    caca_draw_thin_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2),  NUM2INT(x3), NUM2INT(y3));
    return self;
}

#draw_triangle(x1, y1, x2, y2, x3, y3, ch) ⇒ Object



436
437
438
439
440
# File 'ext/caca/caca-canvas.c', line 436

static VALUE draw_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3, VALUE ch)
{
    caca_draw_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2),  NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch));
    return self;
}

#enable_dirty_rectObject

#export_area_to_memory(x, y, w, h, format) ⇒ Object



640
641
642
643
644
645
646
647
648
649
# File 'ext/caca/caca-canvas.c', line 640

static VALUE export_area_to_memory(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE format)
{
    size_t bytes;
    void *result;
    VALUE ret;
    result = caca_export_area_to_memory (_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), StringValuePtr(format), &bytes);
    ret = rb_str_new(result, bytes);
    free(result);
    return ret;
}

#export_to_memory(format) ⇒ Object



651
652
653
654
655
656
657
658
659
660
# File 'ext/caca/caca-canvas.c', line 651

static VALUE export_to_memory(VALUE self, VALUE format)
{
    size_t bytes;
    void *result;
    VALUE ret;
    result = caca_export_canvas_to_memory (_SELF, StringValuePtr(format), &bytes);
    ret = rb_str_new(result, bytes);
    free(result);
    return ret;
}

#fill_box(x, y, w, h, ch) ⇒ Object



430
431
432
433
434
# File 'ext/caca/caca-canvas.c', line 430

static VALUE fill_box(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h, VALUE ch)
{
    caca_fill_box(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h), NUM2ULONG(ch));
    return self;
}

#fill_ellipse(x, y, a, b, ch) ⇒ Object



406
407
408
409
410
# File 'ext/caca/caca-canvas.c', line 406

static VALUE fill_ellipse(VALUE self, VALUE x, VALUE y, VALUE a, VALUE b, VALUE ch)
{
    caca_fill_ellipse(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(a), NUM2INT(b), NUM2ULONG(ch));
    return self;
}

#fill_triangle(x1, y1, x2, y2, x3, y3, ch) ⇒ Object



448
449
450
451
452
# File 'ext/caca/caca-canvas.c', line 448

static VALUE fill_triangle(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3, VALUE ch)
{
    caca_fill_triangle(_SELF, NUM2INT(x1), NUM2INT(y1), NUM2INT(x2), NUM2INT(y2),  NUM2INT(x3), NUM2INT(y3), NUM2ULONG(ch));
    return self;
}

#fill_triangle_textured(coords, texture, uv) ⇒ Object



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'ext/caca/caca-canvas.c', line 454

static VALUE fill_triangle_textured(VALUE self, VALUE coords, VALUE texture, VALUE uv)
{
    caca_canvas_t *ctexture;
    int i, l;
    int ccoords[6];
    float cuv[6];
    VALUE v;

    l = RARRAY_LEN(coords);
    if(l != 6 && l != 3)
    {
        rb_raise(rb_eArgError, "invalid coords list");
    }
    for(i=0; i<l; i++)
    {
        v = rb_ary_entry(coords, i);
        if(l==6)
            ccoords[i] = NUM2INT(v);
        else
        {
            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
                rb_raise(rb_eArgError, "invalid coords list");
            ccoords[2*i] = NUM2INT(rb_ary_entry(v, 0));
            ccoords[2*i+1] = NUM2INT(rb_ary_entry(v, 1));
        }
    }

    l = RARRAY_LEN(uv);
    if(l != 6 && l != 3)
    {
        rb_raise(rb_eArgError, "invalid uv list");
    }
    for(i=0; i<l; i++)
    {
        v = rb_ary_entry(uv, i);
        if(l==6)
            cuv[i] = NUM2DBL(v);
        else
        {
            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
                rb_raise(rb_eArgError, "invalid uv list");
            ccoords[2*i] = NUM2DBL(rb_ary_entry(v, 0));
            ccoords[2*i+1] = NUM2DBL(rb_ary_entry(v, 1));
        }
    }

    if(CLASS_OF(texture) != cCanvas)
    {
        rb_raise(rb_eArgError, "texture is not a Caca::Canvas");
    }
    Data_Get_Struct(texture, caca_canvas_t, ctexture);

    caca_fill_triangle_textured(_SELF, ccoords, ctexture, cuv);
    return self;
}

#flipObject

#flopObject

#frame=Object

#frame_countObject

#frame_nameObject



538
539
540
541
# File 'ext/caca/caca-canvas.c', line 538

static VALUE get_frame_name(VALUE self)
{
    return rb_str_new2(caca_get_frame_name(_SELF));
}

#frame_name=(name) ⇒ Object



543
544
545
546
547
548
549
# File 'ext/caca/caca-canvas.c', line 543

static VALUE set_frame_name(VALUE self, VALUE name)
{
    if(caca_set_frame_name(_SELF, StringValuePtr(name))<0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#free_frame(id) ⇒ Object



565
566
567
568
569
570
571
# File 'ext/caca/caca-canvas.c', line 565

static VALUE free_frame(VALUE self, VALUE id)
{
    if(caca_free_frame(_SELF, NUM2INT(id))<0) {
        rb_raise(rb_eArgError, "%s", strerror(errno));
    }
    return self;
}

#get_attr(x, y) ⇒ Object



143
144
145
146
147
148
# File 'ext/caca/caca-canvas.c', line 143

static VALUE get_attr(VALUE self, VALUE x, VALUE y)
{
    unsigned long int ch;
    ch = caca_get_attr(_SELF, NUM2INT(x), NUM2INT(y));
    return INT2NUM(ch);
}

#get_char(x, y) ⇒ Object



130
131
132
133
134
135
# File 'ext/caca/caca-canvas.c', line 130

static VALUE get_char(VALUE self, VALUE x, VALUE y)
{
    unsigned long int ch;
    ch = caca_get_char(_SELF, NUM2INT(x), NUM2INT(y));
    return INT2NUM(ch);
}

#gotoxy(x, y) ⇒ Object

*



104
105
106
107
108
109
110
# File 'ext/caca/caca-canvas.c', line 104

static VALUE gotoxy(VALUE self, VALUE x, VALUE y)
{
    if( caca_gotoxy(_SELF, NUM2INT(x), NUM2INT(y)) <0) {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }
    return self;
}

#handle_xObject

#handle_yObject

#heightObject

#height=(height) ⇒ Object



84
85
86
87
88
# File 'ext/caca/caca-canvas.c', line 84

static VALUE set_canvas_height(VALUE self, VALUE height)
{
    caca_set_canvas_size(_SELF, caca_get_canvas_width(_SELF), NUM2INT(height));
    return height;
}

#import_area_from_file(x, y, filename, format) ⇒ Object



630
631
632
633
634
635
636
637
638
# File 'ext/caca/caca-canvas.c', line 630

static VALUE import_area_from_file(VALUE self, VALUE x, VALUE y, VALUE filename, VALUE format)
{
    long int bytes;
    bytes = caca_import_area_from_file (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(filename), StringValuePtr(format));
    if(bytes <= 0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#import_area_from_memory(x, y, data, format) ⇒ Object



610
611
612
613
614
615
616
617
618
# File 'ext/caca/caca-canvas.c', line 610

static VALUE import_area_from_memory(VALUE self, VALUE x, VALUE y, VALUE data, VALUE format)
{
    long int bytes;
    bytes = caca_import_area_from_memory (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format));
    if(bytes <= 0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#import_from_file(filename, format) ⇒ Object



620
621
622
623
624
625
626
627
628
# File 'ext/caca/caca-canvas.c', line 620

static VALUE import_from_file(VALUE self, VALUE filename, VALUE format)
{
    long int bytes;
    bytes = caca_import_canvas_from_file (_SELF, StringValuePtr(filename), StringValuePtr(format));
    if(bytes <= 0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#import_from_memory(data, format) ⇒ Object



600
601
602
603
604
605
606
607
608
# File 'ext/caca/caca-canvas.c', line 600

static VALUE import_from_memory(VALUE self, VALUE data, VALUE format)
{
    long int bytes;
    bytes = caca_import_canvas_from_memory (_SELF, StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format));
    if(bytes <= 0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#invertObject

#printf(*args) ⇒ Object



188
189
190
191
192
193
194
195
196
197
198
# File 'ext/caca/caca-canvas.c', line 188

static VALUE cprintf(int argc, VALUE* argv, VALUE self)
{
    int x, y;
    VALUE rx, ry, format, rest, string;
    rb_scan_args(argc, argv, "3*", &rx, &ry, &format, &rest);
    x = NUM2INT(rx);
    y = NUM2INT(ry);
    string = rb_funcall2(rb_mKernel, rb_intern("sprintf"), argc-2, argv+2);
    caca_put_str(_SELF, x, y, StringValuePtr(string));
    return self;
}

#put_attr(x, y, attr) ⇒ Object



164
165
166
167
168
169
170
# File 'ext/caca/caca-canvas.c', line 164

static VALUE put_attr(VALUE self, VALUE x, VALUE y, VALUE attr)
{
    if(caca_put_attr(_SELF, NUM2INT(x), NUM2INT(y), NUM2ULONG(attr)) <0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#put_charObject

#put_str(x, y, str) ⇒ Object



137
138
139
140
141
# File 'ext/caca/caca-canvas.c', line 137

static VALUE put_str(VALUE self, VALUE x, VALUE y, VALUE str)
{
    caca_put_str(_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(str));
    return self;
}

#remove_dirty_rect(x, y, w, h) ⇒ Object



703
704
705
706
707
# File 'ext/caca/caca-canvas.c', line 703

static VALUE remove_dirty_rect(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
{
    caca_remove_dirty_rect(_SELF, NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
    return self;
}

#render(font, width, height, pitch) ⇒ Object

*



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'ext/caca/caca-canvas.c', line 575

static VALUE render_canvas(VALUE self, VALUE font, VALUE width, VALUE height, VALUE pitch)
{
    void *buf;
    caca_font_t *f;
    VALUE b;

    if(CLASS_OF(font) != cFont)
    {
        rb_raise(rb_eArgError, "First argument is not a Caca::Font");
    }

    buf = malloc(width*height*4);
    if(buf == NULL)
    {
        rb_raise(rb_eNoMemError, "Out of memory");
    }

    f = DATA_PTR(font);
    caca_render_canvas(_SELF, f, buf, NUM2UINT(width), NUM2UINT(height), NUM2UINT(pitch));

    b = rb_str_new(buf, width*height*4);
    free(buf);
    return b;
}

#rotate_180Object

#rotate_leftObject

#rotate_rightObject

#set_attr(attr) ⇒ Object



158
159
160
161
162
# File 'ext/caca/caca-canvas.c', line 158

static VALUE set_attr2(VALUE self, VALUE attr)
{
    set_attr(self, attr);
    return self;
}

#set_boundaries(x, y, w, h) ⇒ Object



242
243
244
245
246
247
248
249
# File 'ext/caca/caca-canvas.c', line 242

static VALUE set_canvas_boundaries(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
{
    if(caca_set_canvas_boundaries(_SELF, NUM2INT(x), NUM2INT(y), NUM2UINT(w), NUM2UINT(h))<0)
    {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }
    return self;
}

#set_color_ansi(fg, bg) ⇒ Object



172
173
174
175
176
177
178
# File 'ext/caca/caca-canvas.c', line 172

static VALUE set_color_ansi(VALUE self, VALUE fg, VALUE bg)
{
    if(caca_set_color_ansi(_SELF, NUM2INT(fg), NUM2INT(bg)) <0)
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));

    return self;
}

#set_color_argb(fg, bg) ⇒ Object



180
181
182
183
184
185
186
# File 'ext/caca/caca-canvas.c', line 180

static VALUE set_color_argb(VALUE self, VALUE fg, VALUE bg)
{
    if(caca_set_color_argb(_SELF, NUM2UINT(fg), NUM2UINT(bg)) <0) {
        rb_raise(rb_eRuntimeError, "%s", strerror(errno));
    }
    return self;
}

#set_frame(id) ⇒ Object



532
533
534
535
536
# File 'ext/caca/caca-canvas.c', line 532

static VALUE set_frame2(VALUE self, VALUE id)
{
    set_frame(self, id);
    return self;
}

#set_frame_name(name) ⇒ Object



551
552
553
554
555
# File 'ext/caca/caca-canvas.c', line 551

static VALUE set_frame_name2(VALUE self, VALUE name)
{
    set_frame_name(self, name);
    return self;
}

#set_handleObject

#set_height(height) ⇒ Object



90
91
92
93
94
# File 'ext/caca/caca-canvas.c', line 90

static VALUE set_canvas_height2(VALUE self, VALUE height)
{
    set_canvas_height(self, height);
    return self;
}

#set_size(height, width) ⇒ Object



96
97
98
99
100
# File 'ext/caca/caca-canvas.c', line 96

static VALUE set_canvas_size(VALUE self, VALUE height, VALUE width)
{
    caca_set_canvas_size(_SELF, NUM2INT(width), NUM2INT(height));
    return self;
}

#set_width(width) ⇒ Object



78
79
80
81
82
# File 'ext/caca/caca-canvas.c', line 78

static VALUE set_canvas_width2(VALUE self, VALUE width)
{
    set_canvas_width(self, width);
    return self;
}

#stretch_leftObject

#stretch_rightObject

#wherexObject



112
113
114
115
# File 'ext/caca/caca-canvas.c', line 112

static VALUE wherex(VALUE self)
{
    return INT2NUM(caca_wherex(_SELF));
}

#whereyObject



117
118
119
120
# File 'ext/caca/caca-canvas.c', line 117

static VALUE wherey(VALUE self)
{
    return INT2NUM(caca_wherey(_SELF));
}

#widthObject

#width=Object