Class: String
- Defined in:
- lib/Miyako/API/shape.rb,
lib/Miyako/API/basic_data.rb
Instance Method Summary collapse
-
#to_miyako_color ⇒ Object
:nodoc:.
-
#to_sprite(data) {|sprite| ... } ⇒ Object
- data
-
描画するフォント(Fontクラスのインスタンス).
Instance Method Details
#to_miyako_color ⇒ Object
:nodoc:
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 |
# File 'lib/Miyako/API/basic_data.rb', line 762 def to_miyako_color #:nodoc: case self when /\A\[\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\,\s*(\d+)\s*\]\z/ #4要素の配列形式 return [$1.to_i, $2.to_i, $3.to_i, $4.to_i] when /\A\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\z/ #4個の数列形式 return [$1.to_i, $2.to_i, $3.to_i, $4.to_i] when /\A\#([\da-fA-F]{8})\z/ #HTML形式(#RRGGBBAA) return [$1[0,2].hex, $1[2,2].hex, $1[4,2].hex, $1[6,2].hex] when /\A\[\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\]\z/ #3要素の配列形式 return [$1.to_i, $2.to_i, $3.to_i, 255] when /\A\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\z/ #3個の数列方式 [$1.to_i, $2.to_i, $3.to_i, 255] when /\A\#([\da-fA-F]{6})\z/ #HTML形式(#RRGGBB) return [$1[0,2].hex, $1[2,2].hex, $1[4,2].hex, 255] else return self.to_sym.to_miyako_color end end |