Module: Cairo

Defined in:
lib/cairo.rb,
lib/cairo.rb,
lib/cairo.rb,
lib/cairo/path.rb,
lib/cairo/color.rb,
lib/cairo/paper.rb,
lib/cairo/point.rb,
lib/cairo/colors.rb,
lib/cairo/device.rb,
lib/cairo/papers.rb,
lib/cairo/context.rb,
lib/cairo/pattern.rb,
lib/cairo/surface.rb,
lib/cairo/constants.rb,
lib/cairo/context/blur.rb,
lib/cairo/context/path.rb,
lib/cairo/context/color.rb,
lib/cairo/context/circle.rb,
lib/cairo/context/triangle.rb,
lib/cairo/context/rectangle.rb,
ext/cairo/rb_cairo.c

Defined Under Namespace

Modules: Antialias, Color, Content, Extend, FillRule, Filter, FontSlant, FontWeight, Format, HintMetrics, HintStyle, LineCap, LineJoin, MimeType, Operator, PDFVersion, PSLevel, PathDataType, RegionOverlap, SVGVersion, ScriptMode, SubpixelOrder, TextClusterFlag Classes: ClipNotRepresentableError, CoglDevice, CoglSurface, Context, DRMDevice, DRMSurface, Device, DeviceError, DeviceFinished, DeviceTypeMismatch, Error, FileNotFound, FontExtents, FontFace, FontOptions, FontTypeMismatch, GLDevice, GLSurface, GLTextureSurface, Glyph, GradientPattern, ImageSurface, InvalidClusters, InvalidContentError, InvalidDashError, InvalidDscCommentError, InvalidFormatError, InvalidIndexError, InvalidMatrixError, InvalidMeshConstruction, InvalidPathDataError, InvalidPopGroupError, InvalidRestoreError, InvalidSize, InvalidSlant, InvalidStatusError, InvalidStrideError, InvalidStringError, InvalidVisualError, InvalidWeight, LinearPattern, Matrix, MeshPattern, NegativeCount, NoCurrentPointError, NullPointerError, PDFSurface, PSSurface, Paper, Path, PathClosePath, PathCurveTo, PathData, PathLineTo, PathMoveTo, Pattern, PatternTypeMismatchError, Point, QtSurface, QuartzImageSurface, QuartzSurface, RadialPattern, RasterSourcePattern, ReadError, RecordingSurface, Rectangle, Region, SVGSurface, ScaledFont, ScriptDevice, ScriptSurface, SkiaSurface, SolidPattern, SubSurface, Surface, SurfaceFinishedError, SurfacePattern, SurfaceTypeMismatchError, TeeSurface, TempFileError, TextCluster, TextExtents, ToyFontFace, UserFontError, UserFontFace, UserFontImmutable, UserFontNotImplemented, VGSurface, Win32Device, Win32PrintingSurface, Win32Surface, WriteError, XCBDevice, XCBSurface, XLibSurface, XMLDevice, XMLSurface, XlibDevice

Constant Summary collapse

WIN32Surface =

For backward compatibility

Win32Surface
BUILD_VERSION =
rb_ary_new3 (3,
INT2FIX (CAIRO_VERSION_MAJOR),
INT2FIX (CAIRO_VERSION_MINOR),
INT2FIX (CAIRO_VERSION_MICRO))
VERSION =
rb_ary_new3 (3,
INT2FIX (major),
INT2FIX (minor),
INT2FIX (micro))
MAJOR_VERSION =
INT2FIX (major)
MINOR_VERSION =
INT2FIX (minor)
MICRO_VERSION =
INT2FIX (micro)
BINDINGS_VERSION =
rb_ary_new3 (4,
INT2FIX (RB_CAIRO_VERSION_MAJOR),
INT2FIX (RB_CAIRO_VERSION_MINOR),
INT2FIX (RB_CAIRO_VERSION_MICRO),
Qnil)

Class Method Summary collapse

Class Method Details

.__add_one_arg_setter(klass) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/cairo.rb', line 22

def __add_one_arg_setter(klass)
  names = klass.instance_methods(false)
  names.each do |name|
    if /^set_(.*)/ =~ name and
        not names.include? "#{$1}=" and
        klass.instance_method(name).arity == 1
      klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end")
    end
  end
end

.bindings_versionObject



54
55
56
57
58
59
# File 'lib/cairo.rb', line 54

def bindings_version
  major, minor, micro, tag = BINDINGS_VERSION
  version = [major, minor, micro].join('.')
  version << "-#{tag}" if tag
  version
end

.exit_application(exception, status) ⇒ Object



61
62
63
64
65
# File 'lib/cairo.rb', line 61

def exit_application(exception, status)
  puts("#{exception.class}: #{exception}")
  puts(exception.backtrace)
  exit(status)
end

.normalize_const_name(name) ⇒ Object



33
34
35
# File 'lib/cairo.rb', line 33

def normalize_const_name(name)
  name.to_s.upcase.gsub(/[\s\-_.]+/, "_")
end

.satisfied_version?Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/cairo/rb_cairo.c', line 30

static VALUE
rb_cairo_satisfied_version (int argc, VALUE *argv, VALUE self)
{
  VALUE major, minor, micro;

  rb_scan_args (argc, argv, "21", &major, &minor, &micro);

  if (NIL_P (micro))
    micro = UINT2NUM (0);

  return CBOOL2RVAL (CAIRO_VERSION_MAJOR > NUM2UINT(major) ||
                     (CAIRO_VERSION_MAJOR == NUM2UINT(major) &&
                      CAIRO_VERSION_MINOR > NUM2UINT(minor)) ||
                     (CAIRO_VERSION_MAJOR == NUM2UINT(major) &&
                      CAIRO_VERSION_MINOR == NUM2UINT(minor) &&
                      CAIRO_VERSION_MICRO >= NUM2UINT(micro)));
}