### Home Classes Methods

### In Files

- lib/rabbit/renderer/engine/cairo.rb

### Methods

- ::available_with_gdk?
- ::available_with_gdk_pixbuf?
- ::available_with_pango?
- ::priority
- #alpha_available?
- #background_image=
- #create_pango_context
- #draw_arc
- #draw_arc_by_radius
- #draw_background
- #draw_layout
- #draw_line
- #draw_lines
- #draw_pixbuf
- #draw_polygon
- #draw_poppler_page
- #draw_rectangle
- #draw_rounded_rectangle
- #draw_rsvg_handle
- #finish_context
- #finish_renderer
- #init_context
- #init_renderer
- #make_layout
- #poppler_available?
- #prepare_renderer
- #reflect_context
- #restore_context
- #rotate_context
- #rsvg_available?
- #save_context
- #scale_context
- #set_font_resolution
- #set_source_pixbuf
- #shear_context
- #to_gdk_rgb
- #translate_context

### Included Modules

- Rabbit::Renderer::Kernel

### Class/Module Index

Quicksearch

- Rabbit
- Rabbit::AAFigureCanNotHandleError
- Rabbit::Action
- Rabbit::ApplyFinish
- Rabbit::AuthorConfiguration
- Rabbit::BlockDiagCanNotHandleError
- Rabbit::CantAllocateColorError
- Rabbit::CantFindHTMLTemplate
- Rabbit::CantFindThemeRDTemplate
- Rabbit::Canvas
- Rabbit::Command
- Rabbit::Command::Rabbit
- Rabbit::Command::RabbitSlide
- Rabbit::Command::RabbitTheme
- Rabbit::Config
- Rabbit::Console
- Rabbit::Converter
- Rabbit::CursorManager
- Rabbit::DependencyCanvas
- Rabbit::DiaCanNotHandleError
- Rabbit::DirtyCount
- Rabbit::EPSCanNotHandleError
- Rabbit::Element
- Rabbit::Element::Author
- Rabbit::Element::Base
- Rabbit::Element::Base::DrawHook
- Rabbit::Element::BlockElement
- Rabbit::Element::BlockHorizontalCentering
- Rabbit::Element::BlockQuote
- Rabbit::Element::Body
- Rabbit::Element::ClassName
- Rabbit::Element::Code
- Rabbit::Element::Comment
- Rabbit::Element::Container
- Rabbit::Element::ContainerElement
- Rabbit::Element::ContentSource
- Rabbit::Element::CustomTag
- Rabbit::Element::Date
- Rabbit::Element::DeletedText
- Rabbit::Element::DescriptionContent
- Rabbit::Element::DescriptionList
- Rabbit::Element::DescriptionListItem
- Rabbit::Element::DescriptionTerm
- Rabbit::Element::Emphasis
- Rabbit::Element::EnumList
- Rabbit::Element::EnumListItem
- Rabbit::Element::FootText
- Rabbit::Element::FootTextBlock
- Rabbit::Element::Footnote
- Rabbit::Element::HeadLine
- Rabbit::Element::Image
- Rabbit::Element::ImageTitleSlide
- Rabbit::Element::Index
- Rabbit::Element::IndexSlide
- Rabbit::Element::IndexThumbnail
- Rabbit::Element::IndexThumbnailRow
- Rabbit::Element::Institution
- Rabbit::Element::ItemList
- Rabbit::Element::ItemListItem
- Rabbit::Element::Keyboard
- Rabbit::Element::Keyword
- Rabbit::Element::MethodDescription
- Rabbit::Element::MethodKind
- Rabbit::Element::MethodList
- Rabbit::Element::MethodListItem
- Rabbit::Element::MethodName
- Rabbit::Element::MethodTerm
- Rabbit::Element::Note
- Rabbit::Element::Paragraph
- Rabbit::Element::Place
- Rabbit::Element::PopplerPage
- Rabbit::Element::PopplerSlide
- Rabbit::Element::PopplerTitleSlide
- Rabbit::Element::PreformattedBlock
- Rabbit::Element::PreformattedText
- Rabbit::Element::ReferText
- Rabbit::Element::Slide
- Rabbit::Element::SlideElement
- Rabbit::Element::Subscript
- Rabbit::Element::Subtitle
- Rabbit::Element::Superscript
- Rabbit::Element::SyntaxHighlightingBlock
- Rabbit::Element::SyntaxHighlightingText
- Rabbit::Element::Table
- Rabbit::Element::TableBody
- Rabbit::Element::TableCell
- Rabbit::Element::TableHead
- Rabbit::Element::TableHeader
- Rabbit::Element::TableRow
- Rabbit::Element::Text
- Rabbit::Element::TextBlock
- Rabbit::Element::TextBlockElement
- Rabbit::Element::TextContainer
- Rabbit::Element::TextContainerElement
- Rabbit::Element::TextElement
- Rabbit::Element::TextRenderer
- Rabbit::Element::Title
- Rabbit::Element::TitleSlide
- Rabbit::Element::Variable
- Rabbit::Element::Verbatim
- Rabbit::Element::Video
- Rabbit::Element::WaitBlock
- Rabbit::Element::WaitTag
- Rabbit::Element::When
- Rabbit::Element::Where
- Rabbit::EmbedFrame
- Rabbit::Error
- Rabbit::Format
- Rabbit::Format::ConvenienceTextFormatter
- Rabbit::Format::Foreground
- Rabbit::Format::Formatter
- Rabbit::Format::Size
- Rabbit::Format::SpanTextFormatter
- Rabbit::Format::ValueContainerFormatter
- Rabbit::Frame
- Rabbit::Front
- Rabbit::Front::PublicLevel
- Rabbit::GIMPCanNotHandleError
- Rabbit::GemBuilder
- Rabbit::GemFinder
- Rabbit::Gesture
- Rabbit::Gesture::Handler
- Rabbit::Gesture::Processor
- Rabbit::GetText
- Rabbit::Graffiti
- Rabbit::Graffiti::ConfigDialog
- Rabbit::Graffiti::Processor
- Rabbit::HTML
- Rabbit::HTML::Generator
- Rabbit::ImageFileDoesNotExistError
- Rabbit::ImageLoadError
- Rabbit::ImageLoadWithExternalCommandError
- Rabbit::ImageLoader
- Rabbit::ImageManipulable
- Rabbit::ImageManipulable::Base
- Rabbit::ImageManipulable::Default
- Rabbit::ImageManipulable::Dia
- Rabbit::ImageManipulable::EPS
- Rabbit::ImageManipulable::GIMP
- Rabbit::ImageManipulable::PDF
- Rabbit::ImageManipulable::SVG
- Rabbit::ImmutableSourceTypeError
- Rabbit::InfoWindow
- Rabbit::InvalidImageSizeError
- Rabbit::InvalidMotionError
- Rabbit::Keys
- Rabbit::Keys::Alt
- Rabbit::Keys::Control
- Rabbit::Keys::Shift
- Rabbit::Logger
- Rabbit::Logger::Base
- Rabbit::Logger::GUI
- Rabbit::Logger::STDERR
- Rabbit::Logger::Severity
- Rabbit::Menu
- Rabbit::ModuleLoader
- Rabbit::NoPrintSupportError
- Rabbit::NotAvailableInterfaceError
- Rabbit::NotExistError
- Rabbit::NotFileError
- Rabbit::NotReadableError
- Rabbit::NullFrame
- Rabbit::ParseError
- Rabbit::ParseFinish
- Rabbit::Parser
- Rabbit::Parser::Base
- Rabbit::Parser::Ext
- Rabbit::Parser::Ext::AAFigure
- Rabbit::Parser::Ext::BlockDiag
- Rabbit::Parser::Ext::CodeRay
- Rabbit::Parser::Ext::CodeRay::RabbitEncoder
- Rabbit::Parser::Ext::Emacs
- Rabbit::Parser::Ext::Enscript
- Rabbit::Parser::Ext::Entity
- Rabbit::Parser::Ext::Escape
- Rabbit::Parser::Ext::Image
- Rabbit::Parser::Ext::Image::Private
- Rabbit::Parser::Ext::Inline
- Rabbit::Parser::Ext::TeX
- Rabbit::Parser::Ext::Video
- Rabbit::Parser::Image
- Rabbit::Parser::Markdown
- Rabbit::Parser::Markdown::Converter
- Rabbit::Parser::NoteSetter
- Rabbit::Parser::PDF
- Rabbit::Parser::PauseSupport
- Rabbit::Parser::RD
- Rabbit::Parser::RD::Ext
- Rabbit::Parser::RD::Ext::Base
- Rabbit::Parser::RD::Ext::BlockVerbatim
- Rabbit::Parser::RD::Ext::CharacterReference
- Rabbit::Parser::RD::Ext::Image
- Rabbit::Parser::RD::Ext::InlineVerbatim
- Rabbit::Parser::RD::Ext::Refer
- Rabbit::Parser::RD::Ext::Video
- Rabbit::Parser::RD::RD2RabbitVisitor
- Rabbit::Parser::RD::Visitor
- Rabbit::Parser::SlidePropertySetter
- Rabbit::Parser::Wiki
- Rabbit::Parser::Wiki::RabbitOutput
- Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
- Rabbit::Parser::Wiki::RabbitOutput::InlinePlugin
- Rabbit::Parser::Wiki::RabbitOutput::InlinePlugin::Private
- Rabbit::PathManipulatable
- Rabbit::Progress
- Rabbit::READMEParser
- Rabbit::RT2RabbitVisitor
- Rabbit::Renderer
- Rabbit::Renderer::Base
- Rabbit::Renderer::Color
- Rabbit::Renderer::Display
- Rabbit::Renderer::Display::Base
- Rabbit::Renderer::Display::ButtonHandler
- Rabbit::Renderer::Display::ClutterEmbed
- Rabbit::Renderer::Display::Cursor
- Rabbit::Renderer::Display::DrawingArea
- Rabbit::Renderer::Display::DrawingAreaBase
- Rabbit::Renderer::Display::DrawingAreaPrimitive
- Rabbit::Renderer::Display::DrawingAreaViewOnly
- Rabbit::Renderer::Display::GL
- Rabbit::Renderer::Display::Gesture
- Rabbit::Renderer::Display::Graffiti
- Rabbit::Renderer::Display::HookHandler
- Rabbit::Renderer::Display::Info
- Rabbit::Renderer::Display::KeyHandler
- Rabbit::Renderer::Display::Magnifier
- Rabbit::Renderer::Display::Mask
- Rabbit::Renderer::Display::Menu
- Rabbit::Renderer::Display::Progress
- Rabbit::Renderer::Display::ScrollHandler
- Rabbit::Renderer::Display::Search
- Rabbit::Renderer::Display::Spotlight
- Rabbit::Renderer::Engine
- Rabbit::Renderer::Engine::Cairo
- Rabbit::Renderer::Engine::GDK
- Rabbit::Renderer::GL
- Rabbit::Renderer::Kernel
- Rabbit::Renderer::Pixmap
- Rabbit::Renderer::Pixmap::Base
- Rabbit::Renderer::Pixmap::Cairo
- Rabbit::Renderer::Pixmap::GDK
- Rabbit::Renderer::Pixmap::GL
- Rabbit::Renderer::Print
- Rabbit::Renderer::Print::Base
- Rabbit::Renderer::Print::Cairo
- Rabbit::Renderer::Print::Layout2
- Rabbit::Renderer::Print::LayoutBase
- Rabbit::Renderer::Print::LayoutMore
- Rabbit::Renderer::Print::Multiple
- Rabbit::SOAP
- Rabbit::SOAP::Driver
- Rabbit::SOAP::Server
- Rabbit::ScreenInfo
- Rabbit::SearchWindow
- Rabbit::Searcher
- Rabbit::SlideConfiguration
- Rabbit::Source
- Rabbit::Source::ARGF
- Rabbit::Source::Base
- Rabbit::Source::File
- Rabbit::Source::Hiki
- Rabbit::Source::LimitAccessInterval
- Rabbit::Source::Memory
- Rabbit::Source::SlideShare
- Rabbit::Source::URI
- Rabbit::SourceGenerator
- Rabbit::SourceGenerator::Hiki
- Rabbit::SourceGenerator::Markdown
- Rabbit::SourceGenerator::RD
- Rabbit::SourceUnreadableError
- Rabbit::Stock
- Rabbit::SystemRunner
- Rabbit::Task
- Rabbit::Task::Slide
- Rabbit::Task::SlideShare
- Rabbit::Task::SlideShare::Error
- Rabbit::Task::Theme
- Rabbit::TeXCanNotHandleError
- Rabbit::TemporaryFile
- Rabbit::Theme
- Rabbit::Theme::Applier
- Rabbit::Theme::DirectoryEntry
- Rabbit::Theme::ElementContainer
- Rabbit::Theme::Entry
- Rabbit::Theme::FileEntry
- Rabbit::Theme::GemEntry
- Rabbit::Theme::ImageDirectoryEntry
- Rabbit::Theme::ImageFileEntry
- Rabbit::Theme::ImageGemEntry
- Rabbit::Theme::Manager
- Rabbit::Theme::Searcher
- Rabbit::ThemeConfiguration
- Rabbit::ThemeExit
- Rabbit::TrackBall
- Rabbit::TrackBall::Vector
- Rabbit::UnknownCursorTypeError
- Rabbit::UnknownPropertyError
- Rabbit::UnsupportedFormatError
- Rabbit::Utils
- Rabbit::VideoWindow
- Rabbit::VideoWindow::VideoWidget
- Rabbit::XMLRPC
- Rabbit::XMLRPC::Client
- Rabbit::XMLRPC::Server
- Rabbit::XMLRPC::Servlet
- OptionParser
- OptionParser::Category
- OptionParser::List
- OptionParser::Switch
- Cairo
- Cairo::Context
- Gtk
- Gtk::Action
- Pango
- Pango::Context
- Object

No matching classes.

# Rabbit::Renderer::Engine::Cairo

### Attributes

background[W]
foreground[W]

### Public Class Methods

available_with_gdk?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 49
    def available_with_gdk?
      Gdk.respond_to?(:cairo_available?) and Gdk.cairo_available?
    end

available_with_gdk_pixbuf?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 53
    def available_with_gdk_pixbuf?
      Gdk::Pixbuf.respond_to?(:cairo_available?) and
        Gdk::Pixbuf.cairo_available?
    end

available_with_pango?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 58
    def available_with_pango?
      Pango.respond_to?(:cairo_available?) and Pango.cairo_available?
    end

priority() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 62
    def priority
      if available_with_gdk? and available_with_gdk_pixbuf? and
          available_with_pango?
        100
      else
        -100
      end
    end

### Public Instance Methods

alpha_available?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 74
    def alpha_available?
      true
    end

background_image=(pixbuf) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 78
    def background_image=(pixbuf)
      surface = ::Cairo::ImageSurface.new(::Cairo::FORMAT_A1, 1, 1)
      context = ::Cairo::Context.new(surface)
      context.set_source_pixbuf(pixbuf)
      @background_image = context.source
      @background_image.extend = ::Cairo::EXTEND_REPEAT
      pixbuf
    end

create_pango_context() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 352
    def create_pango_context
      context = Pango::CairoFontMap.default.create_context
      set_font_resolution(context)
      context
    end

draw_arc(filled, x, y, w, h, a1, a2, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 203
    def draw_arc(filled, x, y, w, h, a1, a2, color=nil, params={})
      r = w * 0.5
      draw_arc_by_radius(filled, x + w * 0.5, y + h * 0.5,
                         r, a1, a2, color, params)
    end

draw_arc_by_radius(filled, x, y, r, a1, a2, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 209
    def draw_arc_by_radius(filled, x, y, r, a1, a2, color=nil, params={})
      x, y = from_screen(x, y)
      a1, a2 = convert_angle(a1, a2)
      @context.save do
        set_source(color, params)
        set_line_options(params)
        args = [x, y, r, a1, a2]
        action, = cairo_action(filled, params)
        @context.move_to(x, y) unless action == :stroke
        @context.arc(*args)
        @context.close_path unless action == :stroke
        apply_cairo_action(filled, params)
      end
    end

draw_background(slide) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 155
    def draw_background(slide)
      super
      if @background_image
        @context.save do
          @context.set_source(@background_image)
          @context.paint
        end
      end
    end

draw_layout(layout, x, y, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 242
    def draw_layout(layout, x, y, color=nil, params={})
      x, y = from_screen(x, y)
      @context.save do
        set_source(color, params)
        set_line_options(params)
        @context.move_to(x, y)
        @context.show_pango_layout(layout)
      end
    end

draw_line(x1, y1, x2, y2, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 165
    def draw_line(x1, y1, x2, y2, color=nil, params={})
      x1, y1 = from_screen(x1, y1)
      x2, y2 = from_screen(x2, y2)
      @context.save do
        set_source(color, params)
        set_line_options(params)
        @context.new_path
        @context.move_to(x1, y1)
        @context.line_to(x2, y2)
        apply_cairo_action(false, params)
      end
    end

draw_lines(points, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 224
    def draw_lines(points, color=nil, params={})
      draw_polygon(false, points, color, params.merge({:opened => true}))
    end

draw_pixbuf(pixbuf, x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 252
    def draw_pixbuf(pixbuf, x, y, params={})
      x, y = from_screen(x, y)
      @context.save do
        @context.translate(x, y)
        set_source_pixbuf(pixbuf, params)
        @context.paint(params[:alpha])
      end

      _draw_reflected_pixbuf(pixbuf, x, y, params)
    end

draw_polygon(filled, points, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 228
    def draw_polygon(filled, points, color=nil, params={})
      return if points.empty?
      @context.save do
        set_source(color, params)
        set_line_options(params)
        @context.move_to(*from_screen(*points.first))
        points[1..-1].each do |x, y|
          @context.line_to(*from_screen(x, y))
        end
        @context.line_to(*from_screen(*points.first)) unless params[:opened]
        apply_cairo_action(filled, params)
      end
    end

draw_poppler_page(page, x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 330
    def draw_poppler_page(page, x, y, params={})
      x, y = from_screen(x, y)
      w, h = page.size
      width = (params[:width] || w).to_f
      height = (params[:height] || h).to_f
      @context.save do
        @context.translate(x, y)
        @context.scale(width / w, height / h)
        @context.render_poppler_page(page)
      end
    end

draw_rectangle(filled, x, y, w, h, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 178
    def draw_rectangle(filled, x, y, w, h, color=nil, params={})
      x, y = from_screen(x, y)
      @context.save do
        set_source(color, params)
        set_line_options(params)
        @context.rectangle(x, y, w, h)
        apply_cairo_action(filled, params)
      end
    end

draw_rounded_rectangle(filled, x, y, w, h, radius, color=nil, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 188
    def draw_rounded_rectangle(filled, x, y, w, h, radius,
                               color=nil, params={})
      x, y = from_screen(x, y)
      x_radius = params[:x_radius] || radius
      y_radius = params[:y_radius] || radius

      @context.save do
        set_source(color, params)
        set_line_options(params)
        @context.new_path
        @context.rounded_rectangle(x, y, w, h, x_radius, y_radius)
        apply_cairo_action(filled, params)
      end
    end

draw_rsvg_handle(handle, x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 308
    def draw_rsvg_handle(handle, x, y, params={})
      x, y = from_screen(x, y)
      dim = handle.dimensions
      width = (params[:width] || dim.width).to_f
      height = (params[:height] || dim.height).to_f
      @context.save do
        @context.translate(x, y)
        @context.scale(width / dim.width, height / dim.height)
        @context.render_rsvg_handle(handle)
      end

      _draw_reflected_rsvg_handle(handle, x, y, width, height,
                                  params)
    end

finish_context() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 107
    def finish_context
      @contexts.pop
      @context.destroy if @context.respond_to?(:destroy)
      @context = @contexts.last
    end

finish_renderer() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 94
    def finish_renderer
      finish_context
    end

init_context(context) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 98
    def init_context(context)
      @context = context
      @contexts ||= []
      @contexts.push(@context)
      set_line_width(1)
      @context.line_cap = ::Cairo::LINE_CAP_ROUND
      @context.line_join = ::Cairo::LINE_JOIN_ROUND
    end

init_renderer(drawable) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 90
    def init_renderer(drawable)
      init_context(drawable.create_cairo_context)
    end

make_layout(text) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 342
    def make_layout(text)
      attrs, text = Pango.parse_markup(text)
      layout = @context.create_pango_layout
      layout.text = text
      layout.set_attributes(attrs)
      set_font_resolution(layout.context)
      @context.update_pango_layout(layout)
      layout
    end

poppler_available?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 323
    def poppler_available?
      if @@poppler_available.nil?
        @@poppler_available = Poppler.cairo_available?
      end
      @@poppler_available
    end

prepare_renderer(drawable) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 87
    def prepare_renderer(drawable)
    end

reflect_context(base, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 129
    def reflect_context(base, params={})
      case base
      when :y
        matrix = make_matrix(-1, 0, 0,
                              0, 1, 0)
      else
        matrix = make_matrix(1,  0, 0,
                             0, -1, 0)
      end
      @context.transform(matrix)
    end

restore_context() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 151
    def restore_context
      @context.restore
    end

rotate_context(angle, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 121
    def rotate_context(angle, params={})
      @context.rotate(convert_angle(angle, 0)[0])
    end

rsvg_available?() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 301
    def rsvg_available?
      if @@rsvg_available.nil?
        @@rsvg_available = RSVG.cairo_available?
      end
      @@rsvg_available
    end

save_context() click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 146
    def save_context
      @context.save
      super
    end

scale_context(x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 125
    def scale_context(x, y, params={})
      @context.scale(x, y)
    end

set_font_resolution(context) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 358
    def set_font_resolution(context)
      context.resolution = @canvas.font_resolution
    end

set_source_pixbuf(pixbuf, params) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 263
    def set_source_pixbuf(pixbuf, params)
      draw_scaled_pixbuf = params[:draw_scaled_pixbuf]
      draw_scaled_pixbuf = @draw_scaled_image if draw_scaled_pixbuf.nil?
      width = (params[:width] || pixbuf.width).to_f
      height = (params[:height] || pixbuf.height).to_f

      if [width, height] == [pixbuf.width, pixbuf.height]
        @context.set_source_pixbuf(pixbuf, 0, 0)
        return
      end

      case draw_scaled_pixbuf
      when true
        scaled_pixbuf = pixbuf.scale(width, height)
        @context.set_source_pixbuf(scaled_pixbuf, 0, 0)
      when false
        @context.set_source_pixbuf(pixbuf, 0, 0)
        matrix = ::Cairo::Matrix.scale(pixbuf.width / width,
                                       pixbuf.height / height)
        @context.source.matrix = matrix
      else
        scales = [4, 3, 2]
        scales.each do |scale|
          if width * scale < pixbuf.width and height * scale < pixbuf.height
            scaled_pixbuf = pixbuf.scale(width * scale, height * scale)
            @context.set_source_pixbuf(scaled_pixbuf)
            matrix = ::Cairo::Matrix.scale(scale, scale)
            @context.source.matrix = matrix
            return
          end
        end
        @context.set_source_pixbuf(pixbuf, 0, 0)
        matrix = ::Cairo::Matrix.scale(pixbuf.width / width,
                                       pixbuf.height / height)
        @context.source.matrix = matrix
      end
    end

shear_context(x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 141
    def shear_context(x, y, params={})
      @context.transform(make_matrix(1, x, 0,
                                     y, 1, 0))
    end

to_gdk_rgb(color) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 113
    def to_gdk_rgb(color)
      make_color(color).to_gdk_rgb
    end

translate_context(x, y, params={}) click to toggle source

    # File lib/rabbit/renderer/engine/cairo.rb, line 117
    def translate_context(x, y, params={})
      @context.translate(x, y)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.