# -*- coding: utf-8 -*- require 'xot/blockutil' require 'rays/ext' module Rays class Painter alias end end_paint def begin (&block) if block begin_paint Xot::BlockUtil.instance_eval_or_block_call self, &block end_paint else begin_paint end end def background (*args) send :background=, *args unless args.empty? get_background end def background= (*args) send_set :set_background, :no_background, 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 def font (*args) send :font=, *args unless args.empty? get_font end def font= (*args) send_set :set_font, nil, args end def push (&block) push_matrix push_attrs if block block.call pop end end def pop () pop_attrs pop_matrix end private def send_set (set, no, args) args = args[0] if Array === args[0] if args.size == 1 && [nil, :no, :none].include?(args[0]) no ? send(no) : send(set, nil) else send set, *args end end end# Painter end# Rays