In Files

Parent

Imlib2::Context

Public Class Methods

current() click to toggle source

Return the current context.

Example:

ctx = Imlib2::Context.get
VALUE ctx_get(VALUE klass) {
  Imlib_Context *ctx;

  ctx = (Imlib_Context *) malloc(sizeof(Imlib_Context));
  *ctx = imlib_context_get();

  return Data_Wrap_Struct(klass, 0, ctx_free, ctx);
}
get() click to toggle source

Return the current context.

Example:

ctx = Imlib2::Context.get
VALUE ctx_get(VALUE klass) {
  Imlib_Context *ctx;

  ctx = (Imlib_Context *) malloc(sizeof(Imlib_Context));
  *ctx = imlib_context_get();

  return Data_Wrap_Struct(klass, 0, ctx_free, ctx);
}
new() click to toggle source

Return a new Imlib2::Context.

Example:

ctx = Imlib2::Context.new
VALUE ctx_new(VALUE klass) {
  VALUE self;
  Imlib_Context *ctx;

  ctx = malloc(sizeof(Imlib_Context));
  *ctx = imlib_context_new();

  self = Data_Wrap_Struct(klass, 0, ctx_free, ctx);
  rb_obj_call_init(self, 0, NULL);
  
  return self;
}
pop() click to toggle source

Pop the top context off the context stack.

Example:

ctx = Imlib2::Context.pop
VALUE ctx_pop(VALUE klass) {
  Imlib_Context *ctx;

  ctx = (Imlib_Context *) malloc(sizeof(Imlib_Context));
  imlib_context_pop();
  *ctx = imlib_context_get();

  return Data_Wrap_Struct(klass, 0, ctx_free, ctx);
}

Public Instance Methods

aa() click to toggle source

Get the anti_alias flag.

Example:

if ctx.anti_alias == true
  puts 'anti_alias enabled.'
end
static VALUE ctx_aa(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_anti_alias() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
aa=(p1) click to toggle source

Set the anti_alias flag.

Example:

ctx.anti_alias = true
static VALUE ctx_set_aa(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_anti_alias(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
angle() click to toggle source

Get the text drawing angle.

Example:

if ctx.dir == Imlib2::Direction::ANGLE
  puts 'the current font angle is ' << ctx.angle
end
static VALUE ctx_angle(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = rb_float_new(imlib_context_get_angle());
  imlib_context_pop();

  return r;
}
angle=(p1) click to toggle source

Set the text drawing angle.

Example:

ctx.angle = 76.8
static VALUE ctx_set_angle(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_angle(NUM2DBL(val));
  imlib_context_pop();

  return self;
}
anti_alias() click to toggle source

Get the anti_alias flag.

Example:

if ctx.anti_alias == true
  puts 'anti_alias enabled.'
end
static VALUE ctx_aa(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_anti_alias() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
anti_alias=(p1) click to toggle source

Set the anti_alias flag.

Example:

ctx.anti_alias = true
static VALUE ctx_set_aa(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_anti_alias(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
best_visual(*args) click to toggle source

Get the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

visual = context.get_visual
visual = context.visual
static VALUE ctx_visual(VALUE self) {
  Imlib_Context *ctx;
  VALUE vis;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  vis = Data_Wrap_Struct(cVisual, NULL, XFree, imlib_context_get_visual());
  imlib_context_pop();

  return vis;
}
blend() click to toggle source

Get the blend flag.

Example:

if ctx.blend
  puts 'blend enabled.'
end
static VALUE ctx_blend(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_blend() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
blend=(p1) click to toggle source

Set the blend flag.

Example:

ctx.blend = true
static VALUE ctx_set_blend(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_blend(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
cliprect() click to toggle source

Get the cliprect.

Example:

x, y, w, h = ctx.cliprect
static VALUE ctx_cliprect(VALUE self) {
  Imlib_Context *ctx;
  int i, r[4];
  VALUE ary;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_get_cliprect(&(r[0]), &(r[1]), &(r[2]), &(r[3]));
  imlib_context_pop();

  ary = rb_ary_new();
  for (i = 0; i < 4; i++);
    rb_ary_push(ary, NUM2INT(r[i]));

  return ary;
}
cliprect=(p1) click to toggle source

Set the cliprect.

Example:

ctx.cliprect = [10, 10, 100, 100]
static VALUE ctx_set_cliprect(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_cliprect(
    NUM2INT(rb_ary_entry(val, 0)), 
    NUM2INT(rb_ary_entry(val, 1)), 
    NUM2INT(rb_ary_entry(val, 2)), 
    NUM2INT(rb_ary_entry(val, 3))
  );
  imlib_context_pop();

  return self;
}
cmod() click to toggle source

Get the current color modifier (Imlib2::ColorModifier).

Example:

cmod = ctx.cmod
static VALUE ctx_cmod(VALUE self) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  cmod = malloc(sizeof(Imlib_Color_Modifier));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  *cmod = imlib_context_get_color_modifier();
  imlib_context_pop();

  return Data_Wrap_Struct(cColorMod, 0, cmod_free, cmod);
}
cmod=(p1) click to toggle source

Set the current color modifier (Imlib2::ColorModifier).

Example:

ctx.cmod = cmod
static VALUE ctx_set_cmod(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Color_Modifier, cmod);
  imlib_context_set_color_modifier(*cmod);
  imlib_context_pop();

  return self;
}
color() click to toggle source

Get the current color (Imlib2::Color::RgbaColor).

Example:

color = ctx.color
static VALUE ctx_color(VALUE self) {
  Imlib_Context *ctx;
  VALUE argv[4];
  int i, r[4];

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_get_color(&(r[0]), &(r[1]), &(r[2]), &(r[3]));
  imlib_context_pop();

  for (i = 0; i < 4; i++) 
    argv[i] = INT2NUM(r[i]);

  return rgba_color_new(4, argv, cRgbaColor);
}
color=(p1) click to toggle source

Set the current color (Imlib2::Color).

Example:

ctx.color = Imlib2::Color::LIGHTGRAY
static VALUE ctx_set_color(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  set_context_color(val);
  imlib_context_pop();

  return self;
}
color_modifier() click to toggle source

Get the current color modifier (Imlib2::ColorModifier).

Example:

cmod = ctx.cmod
static VALUE ctx_cmod(VALUE self) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  cmod = malloc(sizeof(Imlib_Color_Modifier));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  *cmod = imlib_context_get_color_modifier();
  imlib_context_pop();

  return Data_Wrap_Struct(cColorMod, 0, cmod_free, cmod);
}
color_modifier=(p1) click to toggle source

Set the current color modifier (Imlib2::ColorModifier).

Example:

ctx.cmod = cmod
static VALUE ctx_set_cmod(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Color_Modifier, cmod);
  imlib_context_set_color_modifier(*cmod);
  imlib_context_pop();

  return self;
}
dir() click to toggle source

Get the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

if ctx.direction != Imlib2::Direction::RIGHT
  puts 'drawing funny text'
end
static VALUE ctx_dir(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_direction());
  imlib_context_pop();

  return r;
}
dir=(p1) click to toggle source

Set the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

ctx.direction = Imlib2::Direction::LEFT
static VALUE ctx_set_dir(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_direction(NUM2INT(val));
  imlib_context_pop();

  return self;
}
direction() click to toggle source

Get the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

if ctx.direction != Imlib2::Direction::RIGHT
  puts 'drawing funny text'
end
static VALUE ctx_dir(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_direction());
  imlib_context_pop();

  return r;
}
direction=(p1) click to toggle source

Set the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

ctx.direction = Imlib2::Direction::LEFT
static VALUE ctx_set_dir(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_direction(NUM2INT(val));
  imlib_context_pop();

  return self;
}
display() click to toggle source

Get the current X11 Display.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

display = context.get_display
display = context.display
static VALUE ctx_display(VALUE self) {
  Imlib_Context *ctx;
  VALUE disp;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  disp = Data_Wrap_Struct(cDisplay, NULL, XFree, imlib_context_get_display());
  imlib_context_pop();

  return disp;
}
display=(p1) click to toggle source

Set the current X11 Display.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_display display
context.display = display
static VALUE ctx_set_display(VALUE self, VALUE display) {
  Display *disp;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(display, Display, disp);

  imlib_context_push(*ctx);
  imlib_context_set_display(disp);
  imlib_context_pop();

  return display;
}
dither() click to toggle source

Get the dither flag.

Example:

if ctx.dither
  puts 'dither enabled.'
end
static VALUE ctx_dither(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_dither() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
dither=(p1) click to toggle source

Set the dither flag.

Example:

ctx.dither = true
static VALUE ctx_set_dither(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_dither(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
dither_mask() click to toggle source

Get the dither_mask flag.

Example:

if ctx.dither_mask == true
  puts 'dither_mask enabled'
end
static VALUE ctx_dither_mask(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_dither_mask() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
dither_mask=(p1) click to toggle source

Set the dither_mask flag.

Example:

ctx.dither_mask = true
static VALUE ctx_set_dither_mask(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_dither_mask(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
drawable() click to toggle source

Get the current X11 Drawable.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

drawable = context.get_drawable
drawable = context.drawable
static VALUE ctx_drawable(VALUE self) {
  Imlib_Context *ctx;
  Drawable *draw;
  VALUE drawable;

  Data_Get_Struct(self, Imlib_Context, ctx);
  draw = malloc(sizeof(Drawable));

  imlib_context_push(*ctx);
  *draw = imlib_context_get_drawable();
  drawable = Data_Wrap_Struct(cDrawable, NULL, dont_free, draw);
  imlib_context_pop();

  return drawable;
}
drawable=(p1) click to toggle source

Set the current X11 Drawable.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_drawable drawable
context.drawable = drawable
static VALUE ctx_set_drawable(VALUE self, VALUE drawable) {
  Drawable *draw;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(drawable, Drawable, draw);

  imlib_context_push(*ctx);
  imlib_context_set_drawable(*draw);
  imlib_context_pop();

  return drawable;
}
encoding() click to toggle source

Get the current TrueType Font Encoding.

Example:

if ctx.encoding == Imlib2::Encoding::ISO_8859_1
  puts 'using ISO-8859-1 encoding'
end
static VALUE ctx_encoding(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_TTF_encoding());
  imlib_context_pop();

  return r;
}
encoding=(p1) click to toggle source

Set the current TrueType Font Encoding.

Example:

ctx.encoding = Imlib2::Encoding::ISO_8859_5
static VALUE ctx_set_encoding(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_TTF_encoding(NUM2INT(val));
  imlib_context_pop();

  return self;
}
font() click to toggle source

Get the current font (Imlib2::Font).

Example:

font = ctx.font
static VALUE ctx_font(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = Data_Wrap_Struct(cFont, 0, font_free, imlib_context_get_font());
  imlib_context_pop();

  return r;
}
font=(p1) click to toggle source

Set the current font (Imlib2::Font).

Example:

ctx.font = Imlib2::Font.new 'helvetica/12'
static VALUE ctx_set_font(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Font *font;

  font = malloc(sizeof(Imlib_Font));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Font, font);
  imlib_context_set_font(*font);
  imlib_context_pop();

  return self;
}
get_angle() click to toggle source

Get the text drawing angle.

Example:

if ctx.dir == Imlib2::Direction::ANGLE
  puts 'the current font angle is ' << ctx.angle
end
static VALUE ctx_angle(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = rb_float_new(imlib_context_get_angle());
  imlib_context_pop();

  return r;
}
get_anti_alias() click to toggle source

Get the anti_alias flag.

Example:

if ctx.anti_alias == true
  puts 'anti_alias enabled.'
end
static VALUE ctx_aa(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_anti_alias() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
get_best_visual(*args) click to toggle source

Get the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

visual = context.get_visual
visual = context.visual
static VALUE ctx_visual(VALUE self) {
  Imlib_Context *ctx;
  VALUE vis;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  vis = Data_Wrap_Struct(cVisual, NULL, XFree, imlib_context_get_visual());
  imlib_context_pop();

  return vis;
}
get_blend() click to toggle source

Get the blend flag.

Example:

if ctx.blend
  puts 'blend enabled.'
end
static VALUE ctx_blend(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_blend() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
get_cliprect() click to toggle source

Get the cliprect.

Example:

x, y, w, h = ctx.cliprect
static VALUE ctx_cliprect(VALUE self) {
  Imlib_Context *ctx;
  int i, r[4];
  VALUE ary;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_get_cliprect(&(r[0]), &(r[1]), &(r[2]), &(r[3]));
  imlib_context_pop();

  ary = rb_ary_new();
  for (i = 0; i < 4; i++);
    rb_ary_push(ary, NUM2INT(r[i]));

  return ary;
}
get_color() click to toggle source

Get the current color (Imlib2::Color::RgbaColor).

Example:

color = ctx.color
static VALUE ctx_color(VALUE self) {
  Imlib_Context *ctx;
  VALUE argv[4];
  int i, r[4];

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_get_color(&(r[0]), &(r[1]), &(r[2]), &(r[3]));
  imlib_context_pop();

  for (i = 0; i < 4; i++) 
    argv[i] = INT2NUM(r[i]);

  return rgba_color_new(4, argv, cRgbaColor);
}
get_color_modifier() click to toggle source

Get the current color modifier (Imlib2::ColorModifier).

Example:

cmod = ctx.cmod
static VALUE ctx_cmod(VALUE self) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  cmod = malloc(sizeof(Imlib_Color_Modifier));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  *cmod = imlib_context_get_color_modifier();
  imlib_context_pop();

  return Data_Wrap_Struct(cColorMod, 0, cmod_free, cmod);
}
get_direction() click to toggle source

Get the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

if ctx.direction != Imlib2::Direction::RIGHT
  puts 'drawing funny text'
end
static VALUE ctx_dir(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_direction());
  imlib_context_pop();

  return r;
}
get_display() click to toggle source

Get the current X11 Display.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

display = context.get_display
display = context.display
static VALUE ctx_display(VALUE self) {
  Imlib_Context *ctx;
  VALUE disp;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  disp = Data_Wrap_Struct(cDisplay, NULL, XFree, imlib_context_get_display());
  imlib_context_pop();

  return disp;
}
get_dither() click to toggle source

Get the dither flag.

Example:

if ctx.dither
  puts 'dither enabled.'
end
static VALUE ctx_dither(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_dither() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
get_dither_mask() click to toggle source

Get the dither_mask flag.

Example:

if ctx.dither_mask == true
  puts 'dither_mask enabled'
end
static VALUE ctx_dither_mask(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qfalse;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = imlib_context_get_dither_mask() ? Qtrue : Qfalse;
  imlib_context_pop();

  return r;
}
get_drawable() click to toggle source

Get the current X11 Drawable.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

drawable = context.get_drawable
drawable = context.drawable
static VALUE ctx_drawable(VALUE self) {
  Imlib_Context *ctx;
  Drawable *draw;
  VALUE drawable;

  Data_Get_Struct(self, Imlib_Context, ctx);
  draw = malloc(sizeof(Drawable));

  imlib_context_push(*ctx);
  *draw = imlib_context_get_drawable();
  drawable = Data_Wrap_Struct(cDrawable, NULL, dont_free, draw);
  imlib_context_pop();

  return drawable;
}
get_encoding() click to toggle source

Get the current TrueType Font Encoding.

Example:

if ctx.encoding == Imlib2::Encoding::ISO_8859_1
  puts 'using ISO-8859-1 encoding'
end
static VALUE ctx_encoding(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_TTF_encoding());
  imlib_context_pop();

  return r;
}
get_font() click to toggle source

Get the current font (Imlib2::Font).

Example:

font = ctx.font
static VALUE ctx_font(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = Data_Wrap_Struct(cFont, 0, font_free, imlib_context_get_font());
  imlib_context_pop();

  return r;
}
get_gradient() click to toggle source

Get the current gradient (Imlib2::Gradient).

Example:

grad = ctx.gradient
static VALUE ctx_gradient(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = Data_Wrap_Struct(cGradient, 0, gradient_free, imlib_context_get_color_range());
  imlib_context_pop();

  return r;
}
get_image() click to toggle source

Get the current image (Imlib2::Image).

Note that this function is not useful at the moment since all image instance methods blindly blow away the image and color context. So you cannot safely mix image context and image instance methods.

Example:

im = ctx.image
static VALUE ctx_image(VALUE self) {
  Imlib_Context *ctx;
  ImStruct *im;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  im = malloc(sizeof(ImStruct));
  im->im = imlib_context_get_image();
  r = Data_Wrap_Struct(cImage, 0, im_struct_free, im);
  imlib_context_pop();

  return r;
}
get_mask() click to toggle source

Get the current X11 Mask.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

mask = context.get_mask
mask = context.mask
static VALUE ctx_mask(VALUE self) {
  Imlib_Context *ctx;
  Pixmap *pmap;
  VALUE mask;

  Data_Get_Struct(self, Imlib_Context, ctx);
  pmap = malloc(sizeof(Pixmap));

  imlib_context_push(*ctx);
  *pmap = imlib_context_get_mask();
  mask = Data_Wrap_Struct(cPixmap, NULL, pmap_free, pmap);
  imlib_context_pop();

  return mask;
}
get_operation() click to toggle source

Get the current operation (Imlib2::Op or Imlib2::Operation).

Example:

if ctx.op == Imlib2::Op::COPY
  puts 'copy operation'
end
static VALUE ctx_op(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_operation());
  imlib_context_pop();

  return r;
}
get_progress_granularity() click to toggle source

Get the progress callback granularity.

This function is not useful at the moment since you cannot specify progress callbacks from within Ruby (this is a TODO item).

Example:

granularity = ctx.progress_granularity
static VALUE ctx_progress_granularity(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_progress_granularity());
  imlib_context_pop();

  return r;
}
get_ttf_encoding() click to toggle source

Get the current TrueType Font Encoding.

Example:

if ctx.encoding == Imlib2::Encoding::ISO_8859_1
  puts 'using ISO-8859-1 encoding'
end
static VALUE ctx_encoding(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_TTF_encoding());
  imlib_context_pop();

  return r;
}
get_visual() click to toggle source

Get the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

visual = context.get_visual
visual = context.visual
static VALUE ctx_visual(VALUE self) {
  Imlib_Context *ctx;
  VALUE vis;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  vis = Data_Wrap_Struct(cVisual, NULL, XFree, imlib_context_get_visual());
  imlib_context_pop();

  return vis;
}
gradient() click to toggle source

Get the current gradient (Imlib2::Gradient).

Example:

grad = ctx.gradient
static VALUE ctx_gradient(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = Data_Wrap_Struct(cGradient, 0, gradient_free, imlib_context_get_color_range());
  imlib_context_pop();

  return r;
}
gradient=(p1) click to toggle source

Set the current gradient (Imlib2::Gradient).

Example:

ctx.gradient = grad
static VALUE ctx_set_gradient(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Color_Range *gradient;

  gradient = malloc(sizeof(Imlib_Color_Range));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Color_Range, gradient);
  imlib_context_set_color_range(*gradient);
  imlib_context_pop();

  return self;
}
image() click to toggle source

Get the current image (Imlib2::Image).

Note that this function is not useful at the moment since all image instance methods blindly blow away the image and color context. So you cannot safely mix image context and image instance methods.

Example:

im = ctx.image
static VALUE ctx_image(VALUE self) {
  Imlib_Context *ctx;
  ImStruct *im;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  im = malloc(sizeof(ImStruct));
  im->im = imlib_context_get_image();
  r = Data_Wrap_Struct(cImage, 0, im_struct_free, im);
  imlib_context_pop();

  return r;
}
image=(p1) click to toggle source

Set the current image (Imlib2::Image).

Note that this function is not useful at the moment since all image instance methods blindly blow away the image and color context. So you cannot safely mix image context and image instance methods.

Example:

ctx.image = image
static VALUE ctx_set_image(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  ImStruct *im;

  im = malloc(sizeof(ImStruct));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  GET_AND_CHECK_IMAGE(val, im);
  imlib_context_set_image(im->im);
  imlib_context_pop();

  return self;
}
mask() click to toggle source

Get the current X11 Mask.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

mask = context.get_mask
mask = context.mask
static VALUE ctx_mask(VALUE self) {
  Imlib_Context *ctx;
  Pixmap *pmap;
  VALUE mask;

  Data_Get_Struct(self, Imlib_Context, ctx);
  pmap = malloc(sizeof(Pixmap));

  imlib_context_push(*ctx);
  *pmap = imlib_context_get_mask();
  mask = Data_Wrap_Struct(cPixmap, NULL, pmap_free, pmap);
  imlib_context_pop();

  return mask;
}
mask=(p1) click to toggle source

Set the current X11 Mask.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_mask mask
context.mask = mask
static VALUE ctx_set_mask(VALUE self, VALUE mask_o) {
  Pixmap *mask;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(mask_o, Pixmap, mask);

  imlib_context_push(*ctx);
  imlib_context_set_mask(*mask);
  imlib_context_pop();

  return mask_o;
}
op() click to toggle source

Get the current operation (Imlib2::Op or Imlib2::Operation).

Example:

if ctx.op == Imlib2::Op::COPY
  puts 'copy operation'
end
static VALUE ctx_op(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_operation());
  imlib_context_pop();

  return r;
}
op=(p1) click to toggle source

Set the current operation (Imlib2::Op or Imlib2::Operation).

Example:

ctx.operation = Imlib2::Op::COPY
static VALUE ctx_set_op(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_operation(NUM2INT(val));
  imlib_context_pop();

  return self;
}
operation() click to toggle source

Get the current operation (Imlib2::Op or Imlib2::Operation).

Example:

if ctx.op == Imlib2::Op::COPY
  puts 'copy operation'
end
static VALUE ctx_op(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_operation());
  imlib_context_pop();

  return r;
}
operation=(p1) click to toggle source

Set the current operation (Imlib2::Op or Imlib2::Operation).

Example:

ctx.operation = Imlib2::Op::COPY
static VALUE ctx_set_op(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_operation(NUM2INT(val));
  imlib_context_pop();

  return self;
}
progress_granularity() click to toggle source

Get the progress callback granularity.

This function is not useful at the moment since you cannot specify progress callbacks from within Ruby (this is a TODO item).

Example:

granularity = ctx.progress_granularity
static VALUE ctx_progress_granularity(VALUE self) {
  Imlib_Context *ctx;
  VALUE r = Qnil;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  r = INT2FIX(imlib_context_get_progress_granularity());
  imlib_context_pop();

  return r;
}
progress_granularity=(p1) click to toggle source

Set the progress callback granularity.

This function is not useful at the moment since you cannot specify progress callbacks from within ruby (this is a TODO item).

Example:

ctx.progress_granularity = 10
static VALUE ctx_set_progress_granularity(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_progress_granularity(NUM2INT(val));
  imlib_context_pop();

  return self;
}
push() click to toggle source

Push this context onto the context stack.

Example:

ctx.push
static VALUE ctx_push(VALUE self) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);

  return self;
}
set_angle(p1) click to toggle source

Set the text drawing angle.

Example:

ctx.angle = 76.8
static VALUE ctx_set_angle(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_angle(NUM2DBL(val));
  imlib_context_pop();

  return self;
}
set_anti_alias(p1) click to toggle source

Set the anti_alias flag.

Example:

ctx.anti_alias = true
static VALUE ctx_set_aa(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_anti_alias(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
set_blend(p1) click to toggle source

Set the blend flag.

Example:

ctx.blend = true
static VALUE ctx_set_blend(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_blend(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
set_cliprect(p1) click to toggle source

Set the cliprect.

Example:

ctx.cliprect = [10, 10, 100, 100]
static VALUE ctx_set_cliprect(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_cliprect(
    NUM2INT(rb_ary_entry(val, 0)), 
    NUM2INT(rb_ary_entry(val, 1)), 
    NUM2INT(rb_ary_entry(val, 2)), 
    NUM2INT(rb_ary_entry(val, 3))
  );
  imlib_context_pop();

  return self;
}
set_color(p1) click to toggle source

Set the current color (Imlib2::Color).

Example:

ctx.color = Imlib2::Color::LIGHTGRAY
static VALUE ctx_set_color(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  set_context_color(val);
  imlib_context_pop();

  return self;
}
set_color_modifier(p1) click to toggle source

Set the current color modifier (Imlib2::ColorModifier).

Example:

ctx.cmod = cmod
static VALUE ctx_set_cmod(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Color_Modifier *cmod;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Color_Modifier, cmod);
  imlib_context_set_color_modifier(*cmod);
  imlib_context_pop();

  return self;
}
set_direction(p1) click to toggle source

Set the current font direction (Imlib2::Dir or Imlib2::Direction).

Example:

ctx.direction = Imlib2::Direction::LEFT
static VALUE ctx_set_dir(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_direction(NUM2INT(val));
  imlib_context_pop();

  return self;
}
set_display(p1) click to toggle source

Set the current X11 Display.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_display display
context.display = display
static VALUE ctx_set_display(VALUE self, VALUE display) {
  Display *disp;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(display, Display, disp);

  imlib_context_push(*ctx);
  imlib_context_set_display(disp);
  imlib_context_pop();

  return display;
}
set_dither(p1) click to toggle source

Set the dither flag.

Example:

ctx.dither = true
static VALUE ctx_set_dither(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_dither(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
set_dither_mask(p1) click to toggle source

Set the dither_mask flag.

Example:

ctx.dither_mask = true
static VALUE ctx_set_dither_mask(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_dither_mask(val != Qnil && val != Qfalse);
  imlib_context_pop();

  return self;
}
set_drawable(p1) click to toggle source

Set the current X11 Drawable.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_drawable drawable
context.drawable = drawable
static VALUE ctx_set_drawable(VALUE self, VALUE drawable) {
  Drawable *draw;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(drawable, Drawable, draw);

  imlib_context_push(*ctx);
  imlib_context_set_drawable(*draw);
  imlib_context_pop();

  return drawable;
}
set_encoding(p1) click to toggle source

Set the current TrueType Font Encoding.

Example:

ctx.encoding = Imlib2::Encoding::ISO_8859_5
static VALUE ctx_set_encoding(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_TTF_encoding(NUM2INT(val));
  imlib_context_pop();

  return self;
}
set_font(p1) click to toggle source

Set the current font (Imlib2::Font).

Example:

ctx.font = Imlib2::Font.new 'helvetica/12'
static VALUE ctx_set_font(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Font *font;

  font = malloc(sizeof(Imlib_Font));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Font, font);
  imlib_context_set_font(*font);
  imlib_context_pop();

  return self;
}
set_gradient(p1) click to toggle source

Set the current gradient (Imlib2::Gradient).

Example:

ctx.gradient = grad
static VALUE ctx_set_gradient(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  Imlib_Color_Range *gradient;

  gradient = malloc(sizeof(Imlib_Color_Range));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  Data_Get_Struct(val, Imlib_Color_Range, gradient);
  imlib_context_set_color_range(*gradient);
  imlib_context_pop();

  return self;
}
set_image(p1) click to toggle source

Set the current image (Imlib2::Image).

Note that this function is not useful at the moment since all image instance methods blindly blow away the image and color context. So you cannot safely mix image context and image instance methods.

Example:

ctx.image = image
static VALUE ctx_set_image(VALUE self, VALUE val) {
  Imlib_Context *ctx;
  ImStruct *im;

  im = malloc(sizeof(ImStruct));
  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  GET_AND_CHECK_IMAGE(val, im);
  imlib_context_set_image(im->im);
  imlib_context_pop();

  return self;
}
set_mask(p1) click to toggle source

Set the current X11 Mask.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_mask mask
context.mask = mask
static VALUE ctx_set_mask(VALUE self, VALUE mask_o) {
  Pixmap *mask;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(mask_o, Pixmap, mask);

  imlib_context_push(*ctx);
  imlib_context_set_mask(*mask);
  imlib_context_pop();

  return mask_o;
}
set_operation(p1) click to toggle source

Set the current operation (Imlib2::Op or Imlib2::Operation).

Example:

ctx.operation = Imlib2::Op::COPY
static VALUE ctx_set_op(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_operation(NUM2INT(val));
  imlib_context_pop();

  return self;
}
set_progress_granularity(p1) click to toggle source

Set the progress callback granularity.

This function is not useful at the moment since you cannot specify progress callbacks from within ruby (this is a TODO item).

Example:

ctx.progress_granularity = 10
static VALUE ctx_set_progress_granularity(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_progress_granularity(NUM2INT(val));
  imlib_context_pop();

  return self;
}
set_ttf_encoding(p1) click to toggle source

Set the current TrueType Font Encoding.

Example:

ctx.encoding = Imlib2::Encoding::ISO_8859_5
static VALUE ctx_set_encoding(VALUE self, VALUE val) {
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  imlib_context_push(*ctx);
  imlib_context_set_TTF_encoding(NUM2INT(val));
  imlib_context_pop();

  return self;
}
set_visual(p1) click to toggle source

Set the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_visual visual
context.visual = visual
static VALUE ctx_set_visual(VALUE self, VALUE visual) {
  Visual *vis;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(visual, Visual, vis);

  imlib_context_push(*ctx);
  imlib_context_set_visual(vis);
  imlib_context_pop();

  return visual;
}
visual() click to toggle source

Get the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

visual = context.get_visual
visual = context.visual
static VALUE ctx_visual(VALUE self) {
  Imlib_Context *ctx;
  VALUE vis;

  Data_Get_Struct(self, Imlib_Context, ctx);

  imlib_context_push(*ctx);
  vis = Data_Wrap_Struct(cVisual, NULL, XFree, imlib_context_get_visual());
  imlib_context_pop();

  return vis;
}
visual=(p1) click to toggle source

Set the current X11 Visual.

Note: This method is not available unless Imlib2-Ruby was compiled with X11 support. You can check the constant Imlib2::X11_SUPPORT to see if X11 support is available.

Examples:

context.set_visual visual
context.visual = visual
static VALUE ctx_set_visual(VALUE self, VALUE visual) {
  Visual *vis;
  Imlib_Context *ctx;

  Data_Get_Struct(self, Imlib_Context, ctx);
  Data_Get_Struct(visual, Visual, vis);

  imlib_context_push(*ctx);
  imlib_context_set_visual(vis);
  imlib_context_pop();

  return visual;
}

[Validate]

Generated with the Darkfish Rdoc Generator 2.