lib/psd/renderer/compose.rb in psd-3.2.2 vs lib/psd/renderer/compose.rb in psd-3.2.3
- old
+ new
@@ -3,10 +3,11 @@
# in various ways based on Photoshop blend modes.
#
# Mostly based on similar code from libpsd.
module Compose
extend self
+ extend ChunkyPNG::Color
#
# Normal blend modes
#
@@ -316,14 +317,10 @@
new_b = blend_channel(b(bg), b(bg) + b(fg) - (b(bg) * b(fg) >> 7), mix_alpha)
rgba(new_r, new_g, new_b, dst_alpha)
end
- [:r, :g, :b, :a, :rgba, :fully_transparent?].each do |meth|
- define_method(meth) { |*args| ChunkyPNG::Color.send(meth, *args) }
- end
-
# If the blend mode is missing, we fall back to normal composition.
def method_missing(method, *args, &block)
normal(*args)
end
@@ -349,6 +346,6 @@
def blend_alpha(bg, fg)
bg + ((255 - bg) * fg >> 8)
end
end
-end
\ No newline at end of file
+end