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/region.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, PDFMetadata, PDFOutline, PDFOutlineFlags, PDFVersion, PSLevel, PathDataType, RegionOverlap, SVGVersion, ScriptMode, SubpixelOrder, Tag, TextClusterFlag Classes: ClipNotRepresentableError, CoglDevice, CoglSurface, Context, DRMDevice, DRMSurface, Device, DeviceError, DeviceFinished, DeviceTypeMismatch, Error, FileNotFound, FontExtents, FontFace, FontOptions, FontTypeMismatch, FreeTypeError, FreeTypeFontFace, GLDevice, GLSurface, GLTextureSurface, Glyph, GradientPattern, ImageSurface, InvalidClusters, InvalidContentError, InvalidDashError, InvalidDscCommentError, InvalidFormatError, InvalidIndexError, InvalidMatrixError, InvalidMeshConstruction, InvalidPathDataError, InvalidPopGroupError, InvalidRestoreError, InvalidSize, InvalidSlant, InvalidStatusError, InvalidStrideError, InvalidStringError, InvalidVisualError, InvalidWeight, JBIG2GlobalMissing, LinearPattern, Matrix, MeshPattern, NegativeCount, NoCurrentPointError, NullPointerError, PDFSurface, PNGError, 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, TagError, TeeSurface, TempFileError, TextCluster, TextExtents, ToyFontFace, UserFontError, UserFontFace, UserFontImmutable, UserFontNotImplemented, VGSurface, Win32Device, Win32GDIError, 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



30
31
32
33
34
35
36
37
38
39
# File 'lib/cairo.rb', line 30

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



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

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



69
70
71
72
73
# File 'lib/cairo.rb', line 69

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

.normalize_const_name(name) ⇒ Object



41
42
43
# File 'lib/cairo.rb', line 41

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)));
}