Class: Cairo::Win32Surface
- Defined in:
- ext/cairo/rb_cairo_surface.c
Instance Method Summary collapse
- #hdc ⇒ Object
- #image ⇒ Object
-
#initialize ⇒ Object
constructor
Win32 surface functions.
Methods inherited from Surface
#clone, #content, #copy_page, create, #create_similar, #create_similar_image, #destroy, #device, #device_offset, #device_scale, #dup, #fallback_resolution, #finish, #flush, #font_options, #get_mime_data, gl_supported?, gl_texture_supported?, image_supported?, #map_to_image, #mark_dirty, pdf_supported?, ps_supported?, quartz_image_supported?, quartz_supported?, recording_supported?, #reference_count, script_supported?, #set_device_offset, #set_device_scale, #set_fallback_resolution, #set_mime_data, #show_page, #sub_rectangle_surface, supported?, #supported_mime_type?, svg_supported?, tee_supported?, #unmap_image, win32_printing_supported?, win32_supported?, #write_to_png, xml_supported?
Constructor Details
#initialize ⇒ Object
Win32 surface functions
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 |
# File 'ext/cairo/rb_cairo_surface.c', line 1396
static VALUE
cr_win32_surface_initialize (int argc, VALUE *argv, VALUE self)
{
cairo_surface_t *surface = NULL;
VALUE arg1, arg2, arg3, arg4;
VALUE hdc, format, width, height;
rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4);
switch (argc)
{
case 1:
hdc = arg1;
surface = cairo_win32_surface_create (NUM2PTR (hdc));
break;
case 2:
# if CAIRO_CHECK_VERSION(1, 11, 4)
# define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB30
# else
# define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB16_565
# endif
if (CAIRO_FORMAT_ARGB32 <= NUM2INT (arg2) &&
NUM2INT (arg2) <= CAIRO_FORMAT_MAX)
{
# if CAIRO_CHECK_VERSION(1, 15, 2)
hdc = arg1;
format = arg2;
surface =
cairo_win32_surface_create_with_format (NUM2PTR (hdc),
RVAL2CRFORMAT (format));
# else
rb_raise (rb_eArgError,
"Cairo::Win32Surface.new(hdc, format) "
"is available since cairo >= 1.15.2");
# endif
}
else
{
width = arg1;
height = arg2;
surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32,
NUM2INT (width),
NUM2INT (height));
}
break;
case 3:
if (NIL_P (arg1) ||
(rb_cairo__is_kind_of (arg1, rb_cNumeric) &&
NUM2INT (arg1) != CAIRO_FORMAT_RGB24))
{
# if CAIRO_CHECK_VERSION(1, 4, 0)
HDC win32_hdc;
hdc = arg1;
width = arg2;
height = arg3;
win32_hdc = NIL_P (hdc) ? NULL : NUM2PTR (hdc);
surface = cairo_win32_surface_create_with_ddb (win32_hdc,
CAIRO_FORMAT_RGB24,
NUM2INT (width),
NUM2INT (height));
# else
rb_raise (rb_eArgError,
"Cairo::Win32Surface.new(hdc, width, height) "
"is available since cairo >= 1.4.0");
# endif
}
else
{
format = arg1;
width = arg2;
height = arg3;
surface = cairo_win32_surface_create_with_dib (RVAL2CRFORMAT (format),
NUM2INT (width),
NUM2INT (height));
}
break;
case 4:
{
# if CAIRO_CHECK_VERSION(1, 4, 0)
HDC win32_hdc;
hdc = arg1;
format = arg2;
width = arg3;
height = arg4;
win32_hdc = NIL_P (hdc) ? NULL : (HDC) (UINT_PTR) NUM2UINT (hdc);
surface = cairo_win32_surface_create_with_ddb (win32_hdc,
RVAL2CRFORMAT (format),
NUM2INT (width),
NUM2INT (height));
# else
rb_raise (rb_eArgError,
"Cairo::Win32Surface.new(hdc, format, width, height) "
"is available since cairo >= 1.4.0");
# endif
}
break;
}
if (!surface)
rb_cairo_check_status (CAIRO_STATUS_INVALID_FORMAT);
rb_cairo_surface_check_status (surface);
DATA_PTR (self) = surface;
if (rb_block_given_p ())
rb_cairo__surface_yield_and_finish (self);
return Qnil;
}
|
Instance Method Details
#hdc ⇒ Object
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 |
# File 'ext/cairo/rb_cairo_surface.c', line 1503
static VALUE
cr_win32_surface_get_hdc (VALUE self)
{
HDC hdc;
hdc = cairo_win32_surface_get_dc (_SELF);
if (!hdc)
return Qnil;
else
return PTR2NUM (hdc);
}
|
#image ⇒ Object
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 |
# File 'ext/cairo/rb_cairo_surface.c', line 1516
static VALUE
cr_win32_surface_get_image (VALUE self)
{
cairo_surface_t *surface;
surface = cairo_win32_surface_get_image (_SELF);
if (!surface)
return Qnil;
rb_cairo_surface_check_status (surface);
return CRSURFACE2RVAL (surface);
}
|