From e00899d292233b3fb886129ce01d042fdf0dd40b Mon Sep 17 00:00:00 2001 From: Alan Kessler Date: Wed, 28 Jan 2015 15:30:26 -0800 Subject: Make alpha option accessible for pictures 0 = transparent ... 100000 = opaque --- lib/axlsx/drawing/pic.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 571e9047..3e21fee9 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -23,6 +23,7 @@ module Axlsx start_at(*options[:start_at]) if options[:start_at] yield self if block_given? @picture_locking = PictureLocking.new(options) + @alpha = options[:alpha] if options[:alpha] end # allowed file extenstions @@ -171,7 +172,11 @@ module Axlsx picture_locking.to_xml_string(str) str << '' str << '' - str << ('') + str << ('') + if @alpha + str << "" + end + str << '' str << '' str << '' str << '' -- cgit v1.2.3 From f0962f91757ff90a7b614dc7f9d625dde32cbb96 Mon Sep 17 00:00:00 2001 From: Alan Kessler Date: Sat, 14 Mar 2015 14:31:26 -0700 Subject: Change option name to 'opacity' and allow value between 0 and 1. --- lib/axlsx/drawing/pic.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 3e21fee9..385229e7 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -23,7 +23,7 @@ module Axlsx start_at(*options[:start_at]) if options[:start_at] yield self if block_given? @picture_locking = PictureLocking.new(options) - @alpha = options[:alpha] if options[:alpha] + @opacity = options[:opacity] * 100000 if options[:opacity] #accepts value beween 0..1 end # allowed file extenstions @@ -173,8 +173,8 @@ module Axlsx str << '' str << '' str << ('') - if @alpha - str << "" + if @opacity + str << "" end str << '' str << '' -- cgit v1.2.3 From fba67564a9ae713dbb122b469ef9d66e9d496075 Mon Sep 17 00:00:00 2001 From: Alan Kessler Date: Sat, 14 Mar 2015 14:41:34 -0700 Subject: opacity needs to be an integer --- lib/axlsx/drawing/pic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb index 385229e7..a8a09493 100644 --- a/lib/axlsx/drawing/pic.rb +++ b/lib/axlsx/drawing/pic.rb @@ -23,7 +23,7 @@ module Axlsx start_at(*options[:start_at]) if options[:start_at] yield self if block_given? @picture_locking = PictureLocking.new(options) - @opacity = options[:opacity] * 100000 if options[:opacity] #accepts value beween 0..1 + @opacity = (options[:opacity] * 100000).round if options[:opacity] #accepts value beween 0..1 end # allowed file extenstions -- cgit v1.2.3