# -*- coding: utf-8 -*- require 'rays/native' module Rays class Painter attr_accessor :font def initialize () @font = Rays::Font.new end def line (*args) args = args[0] if !args.empty? && args[0] === Array draw_rect *args end def rect (*args) args = args[0] if !args.empty? && args[0] === Array draw_rect *args end def ellipse (*args) args = args[0] if !args.empty? && args[0] === Array draw_ellipse *args end def arc (*args) args = args[0] if !args.empty? && args[0] === Array draw_arc *args end alias image draw_image def text (*args) case args.size when 1 then args << 0 << 0 << @font when 2 then args << 0 << @font when 3 then args << @font end draw_text *args end def clear (*args) send :clear=, *args unless args.empty? get_clear end def clear= (*args) send_set :set_clear, :no_clear, args end def fill (*args) send :fill=, *args unless args.empty? get_fill end def fill= (*args) send_set :set_fill, :no_fill, args end def stroke (*args) send :stroke=, *args unless args.empty? get_stroke end def stroke= (*args) send_set :set_stroke, :no_stroke, args end def clip (*args) send :clip=, *args unless args.empty? get_clip end def clip= (*args) send_set :set_clip, :no_clip, args end private def send_set (set, no, args) args = args[0] if args[0].kind_of?(Array) if args.size == 1 && [nil, :no, :none].include?(args[0]) send no else send set, *args end end end# Painter end# Rays