Sha256: 726761161f4719b6dac206235bc06facb21d7bbe573819874239403765cd8cbc
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
# -*- coding: utf-8 -*- require 'reflex/image' require 'reflex/bitmap' require 'reflex/view' module Reflex module Visuals class String < View attr_reader :data def data= (data) if data != @data @data = data @image = nil end @data end def draw (painter, bounds) return unless @image ||= create_image(painter) painter.fill = 0 painter.image @image end private def create_image (painter) dat = self.data return nil unless dat str = dat.to_s font = painter.font size = font.width(str), font.height * 10 resize_to *size bmp = Bitmap.new *size, :GRAY bmp.draw_string str Image.new bmp, true end end# String end# Visuals end# Reflex
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexion-0.1.6 | lib/reflex/visuals/string.rb |
reflexion-0.1.5 | lib/reflex/visuals/string.rb |
reflexion-0.1.4 | lib/reflex/visuals/string.rb |