Вход/Регистрация
Программирование на языке Ruby
вернуться

Фултон Хэл

Шрифт:

 end

 40.step(1, -3) do |xw|

tone = 1.0 - (xw / 40.0) * 0.2

pdf.stroke_style(PDF::Writer::StrokeStyle.new(xw))

pdf.stroke_color(Color::RGB.from_fraction(1, tone, tone))

pdf.circle_at(pdf.left_margin + 10, pdf.margin_height - 15,

r1).stroke

r1 += xw

 end

 pdf.stroke_color(Color::RGB::Black)

 x = pdf.absolute_left_margin

 y = pdf.absolute_bottom_margin

 w = pdf.margin_width

 h = pdf.margin_height

 pdf.rectangle(x, y, w, h).stroke

 text = "The Ruby Way"

 y = pdf.absolute_top_margin

 50.step(5, -5) do |size|

height = pdf.font_height(size)

y -= height

pdf.add_text(pdf.left_margin + 10, y, text, size)

 end

 (0...360).step(20) do |angle|

pdf.fill_color(Color::RGB.from_fraction(rand, rand, rand))

pdf.add_text(300 + Math.cos(PDF::Math.deg2rad(angle)) * 40,

300 + Math.sin(PDF::Math.deg2rad(angle)) * 40,

text, 20, angle)

 end

end

pdf.fill_color Color::RGB::Black

# Правый верхний: Grampian Highlands (UR).

quadrant(pdf, :ur) do

 pdf.image("grampian-highlands.jpg",

:height => pdf.margin_height,

:resize => :width)

 pdf.text("The Grampian Highlands, Scotland",

justification => :center,

:font_size => 36)

 pdf.text("\001August 2001\001", :justification => :center,

:font_size => 24)

 pdf.move_pointer(24)

 info = <<-'EOS'.split($/).join(" ").squeeze(" ")

This picture was taken during a driving vacation through the

Scottish highlands in August 2001 by Austin Ziegler.

 EOS

 pdf.text(info, :justification => :full, :font_size => 16,

:left => 100, :right => 100)

end

pdf.fill_color Color::RGB::Black

# Левый нижний: Individual-I (LL).

quadrant(pdf, :ll) do

 require 'color/palette/monocontrast'

 class IndividualI

def initialize(size = 100)

@size = size

end

# Размер буквы "i" в пунктах.

attr_accessor :size

def half_i(pdf)

pdf.move_to(0, 82)

pdf.line_to(0, 78)

pdf.line_to(9, 78)

pdf.line_to(9, 28)

pdf.line_to(0, 28)

pdf.line_to(0, 23)

pdf.line_to(18, 23)

pdf.line_to(18, 82)

pdf.fill

end

private :half_i

def draw(pdf, x, y)

pdf.save_state

pdf.translate_axis(x, y)

pdf.scale_axis(1 * (@size / 100.0), -1 * (@size / 100.0))

pdf.circle_at(20, 10, 7.5)

pdf.fill

half_i(pdf)

pdf.translate_axis(40, 0)

  • Читать дальше
  • 1
  • ...
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • ...

Ебукер (ebooker) – онлайн-библиотека на русском языке. Книги доступны онлайн, без утомительной регистрации. Огромный выбор и удобный дизайн, позволяющий читать без проблем. Добавляйте сайт в закладки! Все произведения загружаются пользователями: если считаете, что ваши авторские права нарушены – используйте форму обратной связи.

Полезные ссылки

  • Моя полка

Контакты

  • chitat.ebooker@gmail.com

Подпишитесь на рассылку: