### Home Classes Methods

### In Files

- lib/rabbit/theme/ruby-gnome2-item-mark/ruby-gnome2-item-mark.rb
- lib/rabbit/theme/lightning-talk-toolkit/lightning-talk-toolkit.rb
- lib/rabbit/theme/rotate-zoom-effect/rotate-zoom-effect.rb
- lib/rabbit/theme/mirror-effect/mirror-effect.rb
- lib/rabbit/theme/emphasize-keyword/emphasize-keyword.rb
- lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb
- lib/rabbit/theme/color-circle-common/color-circle-common.rb
- lib/rabbit/theme/title-on-image-toolkit/title-on-image-toolkit.rb
- lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb
- lib/rabbit/theme/scroll-effect/scroll-effect.rb
- lib/rabbit/theme/nari/nari.rb

### Parent

BasicObject

### Methods

- #apply_background_image_property
- #color_circle_slide
- #color_circle_title
- #emphasize_keyword
- #mirror_effect
- #scroll_effect
- #setup_default_enum_item_mark
- #setup_default_enum_item_mark_type
- #setup_default_item_mark
- #setup_default_item_mark_get_option_value
- #setup_default_item_mark_type
- #setup_lightning_talk_headline
- #setup_lightning_talk_slide
- #setup_rotate_zoom_effect_slide
- #setup_ruby_gnome2_item_paragraph
- #setup_title_on_image_headline
- #setup_title_on_image_slide
- #slide_params

### 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.

# Object

### Public Instance Methods

apply_background_image_property(element, options={}) click to toggle source

    # File lib/rabbit/theme/background-image-toolkit/background-image-toolkit.rb, line 1
    def apply_background_image_property(element, options={})
      proc_name = options[:proc_name] || "background-image"
      compute_initial_geometry = options[:compute_initial_geometry]

      element.delete_pre_draw_proc_by_name(proc_name)

      if options.has_key?(:file_name)
        background_image = options[:file_name]
      else
        background_image = element["background-image"]
      end
      return if background_image.nil?

      properties = options[:properties] || {}
      element.user_property.each do |name, value|
        if /\Abackground-image-/ =~ name
          properties[$POSTMATCH.gsub(/-/, '_')] = value
        end
      end

      image = image_element(background_image, properties)
      align = properties["align"] || "center"
      vertical_align = properties["vertical_align"] || "middle"
      assign_box = properties["assign_box"]
      element_margin_right = 0
      case align
      when "center"
        image.horizontal_centering = true
      end
      case vertical_align
      when "middle"
        image.vertical_centering = true
      end

      element.add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
        if simulation
          if compute_initial_geometry
            _x, _y, _w, _h = compute_initial_geometry.call(canvas, x, y, w, h)
          else
            _x, _y, _w, _h = x, y, w, h
          end

          old_geometry = [_x, _y, _w, _h]
          image.compile(canvas, _x, _y, _w, _h)
          if image.do_vertical_centering?
            adjust_height = ((_h - image.height - image.padding_bottom) / 2.0).ceil
            if _y + adjust_height > 0
              _y += adjust_height
              _h -= adjust_height
            end
          end

          case align
          when "right"
            if assign_box
              element_margin_right = image.width +
                image.margin_left + image.margin_right +
                element.margin_right + element.padding_right
              element_margin_right += element.parent.margin_right if element.parent
            end
            _x = _w - image.width - image.margin_right
          when "center"
          end

          if old_geometry != [_x, _y, _w, _h]
            image.compile(canvas, _x, _y, _w, _h)
          end

          if image.do_horizontal_centering?
            image.do_horizontal_centering(canvas, _x, _y, _w, _h)
          end
        end
        image.draw(simulation)
        [x, y, w - element_margin_right, h]
      end

      element.add_post_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
        [x, y, w + element_margin_right, h]
      end
    end

color_circle_slide(slides, name="color-circle-slide") click to toggle source

    # File lib/rabbit/theme/color-circle-common/color-circle-common.rb, line 1
    def color_circle_slide(slides, name="color-circle-slide")
      slides.delete_pre_draw_proc_by_name(name)

      slides.add_pre_draw_proc(name) do |slide, canvas, x, y, w, h, simulation|
        unless simulation
          cx = w * 0.22
          cy = h * 0.72
          r = w * 0.35
          canvas.draw_circle_by_radius(true, cx, cy, r, @color_circle_light_color)
          r = w * 0.34
          canvas.draw_circle_by_radius(true, cx, cy, r, @color_circle_bright_color)
          r = w * 0.28
          canvas.draw_circle_by_radius(true, cx, cy, r, @color_circle_light_color)
        end
        [x, y, w, h]
      end
    end

color_circle_title(titles, name="color-circle-title") click to toggle source

    # File lib/rabbit/theme/color-circle-common/color-circle-common.rb, line 19
    def color_circle_title(titles, name="color-circle-title")
      titles.delete_pre_draw_proc_by_name(name)
      titles.delete_post_draw_proc_by_name(name)

      margin = canvas.width * 0.2
      line_width = {:line_width => screen_size(0.1)}
      titles.margin_top = screen_y(1)
      titles.margin_left = margin
      titles.margin_bottom = canvas.height * 0.1
      titles.add_pre_draw_proc(name) do |title, canvas, x, y, w, h, simulation|
        unless simulation
          ly = y + title.first_line_height
          canvas.draw_line(x, ly, x + w, ly, "black", line_width)

          base_h = title.first_line_height * 0.8
          cx = margin * 0.25
          cy = y + base_h * 0.8
          r = base_h * 0.3
          rest = margin - cx
          ratio = rest / (r * 2.5)
          canvas.draw_circle_by_radius(false, cx, cy, r, @color_circle_color,
                                       line_width)
          cx += r * ratio
          canvas.draw_circle_by_radius(true, cx, cy, r, @color_circle_color)
          cx += r * ratio
          canvas.draw_circle_by_radius(true, cx, cy, r, @color_circle_color)
        end
        [x, y, w, h]
      end
    end

emphasize_keyword(target, keyword) click to toggle source

    # File lib/rabbit/theme/emphasize-keyword/emphasize-keyword.rb, line 1
    def emphasize_keyword(target, keyword)
      to_container(target).substitute_text do |_, text|
        if /#{keyword}/ =~ text
          result = text.split(/(#{keyword})/).collect do |sub_text|
            if sub_text == keyword
              Emphasis.new(Text.new(sub_text))
            else
              sub_text
            end
          end
          result
        else
          text
        end
      end
    end

mirror_effect(target, options={}) click to toggle source

    # File lib/rabbit/theme/mirror-effect/mirror-effect.rb, line 1
    def mirror_effect(target, options={})
      proc_name = options[:proc_name] || "mirror-effect"

      target.delete_post_draw_proc_by_name(proc_name)

      return if options[:uninstall]

      scale_y = 0.4
      shear_x = 0.5
      target.add_around_draw_proc(proc_name) do |canvas, x, y, w, h, simulation,
                                                 next_proc|
        rx, ry, rw, rh = next_proc.call(canvas, x, y, w, h, simulation)
        unless simulation
          canvas.save_context do
            height = ry - y
            base = ry + target.margin_bottom
            canvas.translate_context(0, base)
            canvas.reflect_context(:x)
            canvas.shear_context(shear_x, 0)
            canvas.scale_context(1, scale_y)
            canvas.translate_context(0, -base)
            next_proc.call(canvas, x, y, w, height, simulation)
          end
        end
        [rx, ry, rw, rh]
      end
    end

scroll_effect(target, options={}) click to toggle source

    # File lib/rabbit/theme/scroll-effect/scroll-effect.rb, line 1
    def scroll_effect(target, options={})
      proc_name = options[:proc_name] || "scroll-effect"

      target.delete_post_draw_proc_by_name(proc_name)

      return if options[:uninstall]

      idle_id = nil
      effected = false
      slided_x = nil
      target.add_around_draw_proc(proc_name) do |canvas, x, y, w, h, simulation,
                                                 next_proc|
        canvas.save_context do
          if !simulation and !effected
            slided_x ||= w
            slided_x = [slided_x - (w / 10), 0].max
            canvas.translate_context(slided_x, 0)
            idle_id ||= Gtk.idle_add do
              continue = !slided_x.zero?
              unless continue
                idle_id = nil
                slided_x = nil
                effected = true
              end
              canvas.activate("Redraw")
              continue
            end
          end
          next_proc.call(canvas, x, y, w, h, simulation)
        end
      end
    end

setup_default_enum_item_mark(items, name, indent, space_ratio, props, options={}) click to toggle source

    # File lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb, line 87
    def setup_default_enum_item_mark(items, name, indent, space_ratio, props,
                                     options={})
      option_value = Proc.new do |option_name, *args|
        setup_default_item_mark_get_option_value(options, option_name, *args)
      end

      indent_width = screen_x(indent)
      indent_width = option_value.call("indent_width", indent_width) || indent_width
      default_props = {
        "font-family" => @font_family,
      }.merge(props)

      delete_pre_draw_proc_by_name(name)
      delete_post_draw_proc_by_name(name)

      draw_order(items, indent_width, name) do |item|
        props = default_props
        props = props.merge(item.first.text_props) unless item.empty?
        if block_given?
          enum_mark = yield(item)
        else
          type = option_value.call("type", item)
          enum_mark = setup_default_enum_item_mark_type(type, item)
        end
        span(props, enum_mark)
      end

      space = @space * space_ratio
      margin_with(:bottom => space)
    end

setup_default_enum_item_mark_type(type, item) click to toggle source

    # File lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb, line 68
    def setup_default_enum_item_mark_type(type, item)
      type ||= "numeric"
      normalized_type = type.to_s.downcase.gsub(/_/, '-')
      case normalized_type
      when "numeric"
        "#{item.order}. "
      when "lower-case", "upper-case"
        mark = normalized_type == "lower-case" ? "a" : "A"
        (item.order - 1).times do
          mark = mark.succ
        end
        "#{mark}. "
      else
        format = _("unknown enumeration item mark type: %s\n"                 "Numeric type is used as fallback")
        setup_default_enum_item_mark_type("numeric", item)
      end
    end

setup_default_item_mark(items, name, width, height, space_ratio, color, options={}) click to toggle source

    # File lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb, line 38
    def setup_default_item_mark(items, name, width, height, space_ratio, color,
                                options={})
      option_value = Proc.new do |option_name, *args|
        setup_default_item_mark_get_option_value(options, option_name, *args)
      end

      mark_width = screen_x(width)
      mark_height = screen_y(height)
      mark_space = option_value.call("mark_space", mark_width) || mark_width
      indent_width = option_value.call("indent_width", mark_width, mark_space)
      indent_width ||= mark_width * 3

      delete_pre_draw_proc_by_name(name)
      delete_post_draw_proc_by_name(name)

      args = [items, indent_width, mark_width, mark_height, name]
      draw_mark(*args) do |item, canvas, x, y, w, h|
        x -= mark_space
        if block_given?
          yield(item, canvas, x, y, w, h, color, options)
        else
          type = options["type"]
          setup_default_item_mark_type(type, item, canvas, x, y, w, h, color)
        end
      end

      space = @space * space_ratio
      margin_with(:bottom => space)
    end

setup_default_item_mark_get_option_value(options, name, *args) click to toggle source

    # File lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb, line 1
    def setup_default_item_mark_get_option_value(options, name, *args)
      value = options[name]
      if value and value.respond_to?(:call)
        value.call(*args)
      else
        value
      end
    end

setup_default_item_mark_type(type, item, canvas, x, y, w, h, color) click to toggle source

    # File lib/rabbit/theme/default-item-mark-setup/default-item-mark-setup.rb, line 10
    def setup_default_item_mark_type(type, item, canvas, x, y, w, h, color)
      type ||= "rectangle"
      normalized_type = type.to_s.downcase
      case normalized_type
      when "rectangle"
        canvas.draw_rectangle(true, x, y, w, h, color)
      when "circle"
        canvas.draw_circle(true, x, y, w, h, color)
      when "check", "dash"
        props = {
          "font-family" => @font_family,
          "weight" => "bold",
          "foreground" => canvas.make_color(color).to_gdk_format,
        }.merge(item.first.text_props)

        layout = make_layout(span(props, entity(normalized_type)))
        text_width, text_height = layout.pixel_size
        canvas.draw_layout(layout,
                           x - text_width / 2.0,
                           y - text_height / 3.0)
      else
        format = _("unknown item mark type: %s\n"                 "Rectangle type is used as fallback")
        canvas.logger.warn(format % type.inspect)
        setup_default_item_mark_type("rectangle")
      end
    end

setup_lightning_talk_headline(head) click to toggle source

    # File lib/rabbit/theme/lightning-talk-toolkit/lightning-talk-toolkit.rb, line 117
    def setup_lightning_talk_headline(head)
      class << head
        def takahashi(params)
          proc_name = params[:proc_name]

          clear_pre_draw_procs
          clear_post_draw_procs

          font_params = {
            :size => params[:size],
            :color => params[:color],
            :family => params[:family],
          }
          font(font_params)
          self.wrap_mode = params[:wrap_mode]
          self.horizontal_centering = params[:horizontal_centering]
          self.justify = params[:justify]

          substitute_newline

          orig_x = orig_y = orig_w = orig_h = nil
          add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            orig_x, orig_y, orig_w, orig_h = x, y, w, h
            [x, y, w, h]
          end

          add_post_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            if empty?
              [orig_x, orig_y, orig_w, orig_h]
            else
              [x, y, w, h]
            end
          end

          as_large_as_possible = slide["as-large-as-possible"]
          if as_large_as_possible.nil?
            as_large_as_possible = params[:as_large_as_possible]
          else
            as_large_as_possible = as_large_as_possible == "true"
          end
          if as_large_as_possible
            lightning_talk_as_large_as_possible(params)
          end
        end
        alias lightning_talk takahashi

        private
        def lightning_talk_as_large_as_possible(params)
          proc_name = params[:proc_name]
          as_large_as_possible(proc_name)
        end
      end
    end

setup_lightning_talk_slide(slide) click to toggle source

    # File lib/rabbit/theme/lightning-talk-toolkit/lightning-talk-toolkit.rb, line 33
    def setup_lightning_talk_slide(slide)
      class << slide
        attr_writer :lightning_talk_default_params
        def lightning_talk_default_params
          @lightning_talk_default_params ||= {}
        end

        def takahashi(params={}, &block)
          return unless lightning_talk?

          params = lightning_talk_default_params.merge(params)

          clear_pre_draw_procs
          clear_post_draw_procs

          self.vertical_centering = true
          self.horizontal_centering = true

          lightning_talk_setup_background(params)
          lightning_talk_setup_contact_information(params)

          headline.lightning_talk(params)
          block.call(self, headline) if block
        end
        alias lightning_talk takahashi

        def lightning_talk?
          body.empty? or
            ((headline.empty? or !headline.visible?) and
             body.elements.all? {|elem| elem.is_a?(Element::Image)})
        end
        alias takahashi? lightning_talk?

        private
        def lightning_talk_setup_background(params)
          proc_name = params[:proc_name]
          background_color = params[:background_color]
          add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            unless simulation
              args = [
                true,
                x - margin_left,
                y - margin_top,
                w + margin_left + margin_right,
                h + margin_top + margin_bottom,
                background_color,
              ]
              canvas.draw_rectangle(*args)
            end
            [x, y, w, h]
          end
        end

        def lightning_talk_setup_contact_information(params)
          proc_name = params[:proc_name]
          contact_information = params[:contact_information]
          contact_information_size = params[:contact_information_size]
          contact_information_family = params[:contact_information_family]
          contact_information_color = params[:contact_information_color]

          if contact_information and /\A\s*\z/ !~ contact_information
            add_post_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
              unless simulation
                text = Element::Text.new(contact_information)
                params = {
                  :size => contact_information_size,
                  :family => contact_information_family,
                }
                text.font(params)
                text.align = Pango::Layout::ALIGN_RIGHT
                text.compile(canvas, x, y, w, h)
                text.layout.set_width(width * Pango::SCALE)
                text_x = margin_left
                text_y = canvas.height - margin_bottom - text.height
                canvas.draw_layout(text.layout, text_x, text_y,
                                   contact_information_color)
              end
              [x, y, w, h]
            end
          end
        end
      end
    end

setup_rotate_zoom_effect_slide(slide) click to toggle source

    # File lib/rabbit/theme/rotate-zoom-effect/rotate-zoom-effect.rb, line 1
    def setup_rotate_zoom_effect_slide(slide)
      class << slide
        def rotate_zoom_effect
          angle = 0
          last_angle = 360
          last_scale_x = 1
          last_scale_y = 1
          idle_id = nil
          effected = false
          add_around_draw_proc do |canvas, x, y, w, h, simulation, next_proc|
            canvas.save_context do
              if !simulation and !effected
                angle = [angle + last_angle * 0.05, last_angle].min
                ratio = angle / last_angle
                scale_x = last_scale_x * ratio
                scale_y = last_scale_y * ratio
                translate(canvas, angle, scale_x, scale_y)
                idle_id ||= Gtk.idle_add do
                  continue = (angle != last_angle and
                              canvas.current_slide == self)
                  unless continue
                    idle_id = nil
                    effected = true
                  end
                  canvas.activate("Redraw")
                  continue
                end
              end
              next_proc.call(canvas, x, y, w, h, simulation)
            end
          end
        end

        private
        def translate(canvas, angle, scale_x, scale_y)
          center_x = canvas.width / 2
          center_y = canvas.height / 2
          canvas.translate_context(center_x, center_y)
          canvas.rotate_context(angle)
          canvas.translate_context(-center_x, -center_y)
          canvas.scale_context(scale_x, scale_y)
        end
      end
    end

setup_ruby_gnome2_item_paragraph(paragraphs, name, color, line_color, space_ratio) click to toggle source

    # File lib/rabbit/theme/ruby-gnome2-item-mark/ruby-gnome2-item-mark.rb, line 3
    def setup_ruby_gnome2_item_paragraph(paragraphs, name, color, line_color,
                                         space_ratio)
      paragraphs.delete_pre_draw_proc_by_name(name)
      paragraphs.delete_post_draw_proc_by_name(name)

      paragraphs.prop_set("foreground", color)
      space = @space * space_ratio

      post_draw_proc = Proc.new do |paragraph, canvas, x, y, w, h, simulation|
        unless simulation
          canvas.draw_line(x, y + space, x + w, y + space, line_color)
        end
        [x, y, w, h]
      end
      paragraphs.add_post_draw_proc(name, &post_draw_proc)
    end

setup_title_on_image_headline(head) click to toggle source

    # File lib/rabbit/theme/title-on-image-toolkit/title-on-image-toolkit.rb, line 100
    def setup_title_on_image_headline(head)
      class << head
        def title_on_image(params)
          proc_name = params[:proc_name]
          color = params[:color]

          margin_set(0)

          clear_pre_draw_procs
          clear_post_draw_procs

          prop_set("foreground", color)
          hide

          orig_x = orig_y = orig_w = orig_h = nil
          add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            orig_x, orig_y, orig_w, orig_h = x, y, w, h
            [x, y, w, h]
          end

          add_post_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            [orig_x, orig_y, orig_w, orig_h]
          end
        end
      end
    end

setup_title_on_image_slide(slide) click to toggle source

    # File lib/rabbit/theme/title-on-image-toolkit/title-on-image-toolkit.rb, line 14
    def setup_title_on_image_slide(slide)
      class << slide
        attr_accessor :applier

        attr_writer :title_on_image_default_params
        def title_on_image_default_params
          @title_on_image_default_params ||= {}
        end

        def title_on_image(params={}, &block)
          params = title_on_image_default_params.merge(params)

          clear_pre_draw_procs
          clear_post_draw_procs

          margin_set(0)

          self.vertical_centering = true
          self.horizontal_centering = true

          proc_name = params[:proc_name]
          shadow_color = params[:shadow_color]
          background_color = params[:background_color]
          title_background_color = params[:title_background_color]

          orig_x = orig_y = orig_w = orig_h = nil
          add_pre_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            orig_x, orig_y, orig_w, orig_h = x, y, w, h
            unless simulation
              args = [
                true,
                x - margin_left,
                y - margin_top,
                w + margin_left + margin_right,
                h + margin_top + margin_bottom,
                background_color,
              ]
              canvas.draw_rectangle(*args)
            end
            [x, y, w, h]
          end

          add_post_draw_proc(proc_name) do |canvas, x, y, w, h, simulation|
            base_h = orig_h / 2 - headline.height / 2
            base_y = orig_y + base_h
            headline.show do
              unless simulation
                background_y = base_y - headline.padding_top
                background_h = headline.height
                canvas.draw_rectangle(true,
                                      0,            background_y,
                                      canvas.width, background_h,
                                      title_background_color)

                shadow_headline = headline.clone
                shadow_headline.font(:color => nil)
                shadow_layout = canvas.make_layout(shadow_headline.markuped_text)
                shadow_layout.set_width(w * Pango::SCALE)
                shadow_layout.set_alignment(Pango::Layout::ALIGN_CENTER)

                font_size = headline.pixel_font_size
                move_x = @applier.screen_x(font_size.to_f / @applier.screen_size(10))
                move_y = @applier.screen_y(font_size.to_f / @applier.screen_size(20))
                canvas.draw_layout(shadow_layout, orig_x + move_x, base_y + move_y,
                                   shadow_color)
              end
              headline.draw_element(canvas,
                                    orig_x, base_y, orig_w, base_h,
                                    simulation)
            end
            [x, y, w, h]
          end

          headline.title_on_image(params)

          body.elements[0]["caption-color"] = params[:color]
        end

        def title_on_image?
          !headline.empty? and
            body.elements.size == 1 and
            body.elements[0].is_a?(Element::Image)
        end
      end
    end

slide_params(slide) click to toggle source

    # File lib/rabbit/theme/nari/nari.rb, line 111
    def slide_params(slide)
      res = {}
      if !slide["size"].nil? && !slide["size"].empty?
        res[:size] = screen_size(slide["size"].to_i * Pango::SCALE)
      end
      %(color family backgroundcolor).each do |key|
        unless slide[key].nil? || slide[key].empty?
          slide_key = key == "backgroundcolor" ? "background_color" : key
          res[slide_key.to_sym] = slide[key]
        end
      end
      res[:as_large_as_possible] = false unless res.empty?
      res
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.