Permalink
Browse files

changes opacity in composite images: coded images white rectangle fro…

…m .7 to .85, uncoded images white rectangle 0.4, opacity of colors from .5 to .6
  • Loading branch information...
numeroteca committed Jun 20, 2013
1 parent a55f50b commit ed2e9c843e2d87d1cec1c4933befbd68296fb62a
Showing with 14 additions and 5 deletions.
  1. +14 −5 app/models/threadx.rb
View
@@ -200,13 +200,22 @@ def generate_composite_images width=DEFAULT_COMPOSITE_IMAGE_WIDTH, force=false
front_page_composite_img.composite!(thumb,offset[:x],offset[:y], Magick::OverCompositeOp)
img_map[:images][img.image_name] = { :x1=>offset[:x].round, :y1=>offset[:y].round,
:x2=>offset[:x].round+thumb.columns, :y2=>offset[:y].round+thumb.rows }
# if the front page is coded, fade it a bit so the uncoded ones stand out
# if the front page is not coded, fade it a bit so the color codes stand out
if uncoded_image_ids.include? img.id
white_gc = Magick::Draw.new
white_gc.fill 'white' #draws white rectangle on top of the image
white_gc.fill_opacity 0.4
white_gc.rectangle offset[:x].round, offset[:y].round,
offset[:x].round+thumb.columns, offset[:y].round+thumb.rows
white_gc.draw front_page_composite_img
end
# if the front page is coded, fade it more so the uncoded ones stand out
if coded_image_ids.include? img.id
white_gc = Magick::Draw.new
white_gc.fill 'white'
white_gc.fill_opacity 0.7
white_gc.fill 'white' #draws white rectangle on top of the image
white_gc.fill_opacity 0.85
white_gc.rectangle offset[:x].round, offset[:y].round,
offset[:x].round+thumb.columns, offset[:y].round+thumb.rows
offset[:x].round+thumb.columns, offset[:y].round+thumb.rows
white_gc.draw front_page_composite_img
end
end
@@ -222,7 +231,7 @@ def generate_composite_images width=DEFAULT_COMPOSITE_IMAGE_WIDTH, force=false
gc = ha_composite_gcs[code.id]
color = (code.color.nil?) ? '#ff0000' : code.color #safety check in case a color is missing
gc.fill color
gc.fill_opacity 0.5
gc.fill_opacity 0.6
img_ha_list = full_ha_list.select { |ha| ha.code_id==code.id and ha.image_id==img.id}
scaled_areas = img_ha_list.collect { |ha| ha.scaled_areas scale }
scaled_areas.flatten.each do |area|

0 comments on commit ed2e9c8

Please sign in to comment.