Class: Imlib2::Context

# Imlib2::Context (Class)

In: | imlib2.c
Parent: | Object

## Methods

aa aa= angle angle= anti_alias anti_alias= best_visual blend blend= cliprect cliprect= cmap cmap= cmod cmod= color color= color_modifier color_modifier= colormap colormap= current dir dir= direction direction= display display= dither dither= dither_mask dither_mask= drawable drawable= encoding encoding= font font= get get_angle get_anti_alias get_best_visual get_blend get_cliprect get_cmap get_color get_color_modifier get_colormap get_direction get_display get_dither get_dither_mask get_drawable get_encoding get_font get_gradient get_image get_mask get_operation get_progress_granularity get_ttf_encoding get_visual get_visual gradient gradient= image image= mask mask= new new op op= operation operation= pop progress_granularity progress_granularity= push set_angle set_anti_alias set_blend set_cliprect set_cmap set_color set_color_modifier set_colormap set_direction set_display set_dither set_dither_mask set_drawable set_encoding set_font set_gradient set_image set_mask set_operation set_progress_granularity set_ttf_encoding set_visual visual visual visual=

## Public Class methods

current()

Return the current context.

Example:

      ctx = Imlib2::Context.get

get()

Return the current context.

Example:

      ctx = Imlib2::Context.get

new()

Imlib2::Context constructor.

Currently just a placeholder

new()

Return a new Imlib2::Context.

Example:

      ctx = Imlib2::Context.new

pop()

Pop the top context off the context stack.

Example:

      ctx = Imlib2::Context.pop

## Public Instance methods

aa()

Get the anti_alias flag.

Example:

      if ctx.anti_alias == true
        puts 'anti_alias enabled.'
      end

aa=(p1)

Set the anti_alias flag.

Example:

      ctx.anti_alias = true

angle()

Get the text drawing angle.

Example:

      if ctx.dir == Imlib2::Direction::ANGLE
        puts 'the current font angle is ' << ctx.angle
      end

angle=(p1)

Set the text drawing angle.

Example:

      ctx.angle = 76.8

anti_alias()

Get the anti_alias flag.

Example:

      if ctx.anti_alias == true
        puts 'anti_alias enabled.'
      end

anti_alias=(p1)

Set the anti_alias flag.

Example:

      ctx.anti_alias = true

best_visual(...)

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

blend()

Get the blend flag.

Example:

      if ctx.blend
        puts 'blend enabled.'
      end

blend=(p1)

Set the blend flag.

Example:

      ctx.blend = true

cliprect()

Get the cliprect.

Example:

      x, y, w, h = ctx.cliprect

cliprect=(p1)

Set the cliprect.

Example:

      ctx.cliprect = [10, 10, 100, 100]

cmap()
cmap=(p1)
cmod()

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

Example:

      cmod = ctx.cmod

cmod=(p1)

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

Example:

      ctx.cmod = cmod

color()

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

Example:

      color = ctx.color

color=(p1)

Set the current color (Imlib2::Color).

Example:

      ctx.color = Imlib2::Color::LIGHTGRAY

color_modifier()

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

Example:

      cmod = ctx.cmod

color_modifier=(p1)

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

Example:

      ctx.cmod = cmod

colormap()
colormap=(p1)
dir()

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

Example:

      if ctx.direction != Imlib2::Direction::RIGHT
        puts 'drawing funny text'
      end

dir=(p1)

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

Example:

      ctx.direction = Imlib2::Direction::LEFT

direction()

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

Example:

      if ctx.direction != Imlib2::Direction::RIGHT
        puts 'drawing funny text'
      end

direction=(p1)

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

Example:

      ctx.direction = Imlib2::Direction::LEFT

display()

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

display=(p1)

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

dither()

Get the dither flag.

Example:

      if ctx.dither
        puts 'dither enabled.'
      end

dither=(p1)

Set the dither flag.

Example:

      ctx.dither = true

dither_mask()

Get the dither_mask flag.

Example:

      if ctx.dither_mask == true
        puts 'dither_mask enabled'
      end

dither_mask=(p1)

Set the dither_mask flag.

Example:

      ctx.dither_mask = true

drawable()

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

drawable=(p1)

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

encoding()

Get the current TrueType Font Encoding.

Example:

      if ctx.encoding == Imlib2::Encoding::ISO_8859_1
        puts 'using ISO-8859-1 encoding'
      end

encoding=(p1)

Set the current TrueType Font Encoding.

Example:

      ctx.encoding = Imlib2::Encoding::ISO_8859_5

font()

Get the current font (Imlib2::Font).

Example:

      font = ctx.font

font=(p1)

Set the current font (Imlib2::Font).

Example:

      ctx.font = Imlib2::Font.new 'helvetica/12'

get_angle()

Get the text drawing angle.

Example:

      if ctx.dir == Imlib2::Direction::ANGLE
        puts 'the current font angle is ' << ctx.angle
      end

get_anti_alias()

Get the anti_alias flag.

Example:

      if ctx.anti_alias == true
        puts 'anti_alias enabled.'
      end

get_best_visual(...)

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

get_blend()

Get the blend flag.

Example:

      if ctx.blend
        puts 'blend enabled.'
      end

get_cliprect()

Get the cliprect.

Example:

      x, y, w, h = ctx.cliprect

get_cmap()
get_color()

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

Example:

      color = ctx.color

get_color_modifier()

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

Example:

      cmod = ctx.cmod

get_colormap()
get_direction()

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

Example:

      if ctx.direction != Imlib2::Direction::RIGHT
        puts 'drawing funny text'
      end

get_display()

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

get_dither()

Get the dither flag.

Example:

      if ctx.dither
        puts 'dither enabled.'
      end

get_dither_mask()

Get the dither_mask flag.

Example:

      if ctx.dither_mask == true
        puts 'dither_mask enabled'
      end

get_drawable()

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

get_encoding()

Get the current TrueType Font Encoding.

Example:

      if ctx.encoding == Imlib2::Encoding::ISO_8859_1
        puts 'using ISO-8859-1 encoding'
      end

get_font()

Get the current font (Imlib2::Font).

Example:

      font = ctx.font

get_gradient()

Get the current gradient (Imlib2::Gradient).

Example:

      grad = ctx.gradient

get_image()

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

get_mask()

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

get_operation()

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

Example:

      if ctx.op == Imlib2::Op::COPY
        puts 'copy operation'
      end

get_progress_granularity()

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

get_ttf_encoding()

Get the current TrueType Font Encoding.

Example:

      if ctx.encoding == Imlib2::Encoding::ISO_8859_1
        puts 'using ISO-8859-1 encoding'
      end

get_visual(...)

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

get_visual()

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

gradient()

Get the current gradient (Imlib2::Gradient).

Example:

      grad = ctx.gradient

gradient=(p1)

Set the current gradient (Imlib2::Gradient).

Example:

      ctx.gradient = grad

image()

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

image=(p1)

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

mask()

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

mask=(p1)

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

op()

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

Example:

      if ctx.op == Imlib2::Op::COPY
        puts 'copy operation'
      end

op=(p1)

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

Example:

      ctx.operation = Imlib2::Op::COPY

operation()

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

Example:

      if ctx.op == Imlib2::Op::COPY
        puts 'copy operation'
      end

operation=(p1)

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

Example:

      ctx.operation = Imlib2::Op::COPY

progress_granularity()

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

progress_granularity=(p1)

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

push()

Push this context onto the context stack.

Example:

      ctx.push

set_angle(p1)

Set the text drawing angle.

Example:

      ctx.angle = 76.8

set_anti_alias(p1)

Set the anti_alias flag.

Example:

      ctx.anti_alias = true

set_blend(p1)

Set the blend flag.

Example:

      ctx.blend = true

set_cliprect(p1)

Set the cliprect.

Example:

      ctx.cliprect = [10, 10, 100, 100]

set_cmap(p1)
set_color(p1)

Set the current color (Imlib2::Color).

Example:

      ctx.color = Imlib2::Color::LIGHTGRAY

set_color_modifier(p1)

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

Example:

      ctx.cmod = cmod

set_colormap(p1)
set_direction(p1)

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

Example:

      ctx.direction = Imlib2::Direction::LEFT

set_display(p1)

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

set_dither(p1)

Set the dither flag.

Example:

      ctx.dither = true

set_dither_mask(p1)

Set the dither_mask flag.

Example:

      ctx.dither_mask = true

set_drawable(p1)

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

set_encoding(p1)

Set the current TrueType Font Encoding.

Example:

      ctx.encoding = Imlib2::Encoding::ISO_8859_5

set_font(p1)

Set the current font (Imlib2::Font).

Example:

      ctx.font = Imlib2::Font.new 'helvetica/12'

set_gradient(p1)

Set the current gradient (Imlib2::Gradient).

Example:

      ctx.gradient = grad

set_image(p1)

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

set_mask(p1)

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

set_operation(p1)

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

Example:

      ctx.operation = Imlib2::Op::COPY

set_progress_granularity(p1)

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

set_ttf_encoding(p1)

Set the current TrueType Font Encoding.

Example:

      ctx.encoding = Imlib2::Encoding::ISO_8859_5

set_visual(p1)

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

visual()

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

visual(...)

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

visual=(p1)

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

[Validate]