Skip to content

Commit

Permalink
[Frameit] apply rounded corners before framing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Tho虉ni committed Jan 16, 2024
1 parent e19e01b commit 43456a1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions frameit/lib/frameit/editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ def put_into_frame
end
end

maskData = MiniMagick::Tool::Convert.new do |img|
img.size("#{screenshot.size[0]}x#{screenshot.size[1]}")
img.canvas('none')
img.draw("roundrectangle 0,0,#{screenshot.size[0]},#{screenshot.size[1]},100,100")
img << 'png:-'
end

# Create a mask
mask = MiniMagick::Image.read(maskData)

if screenshot.device.id.include? "iphone-14"
image = @image.composite(mask, "png") do |c|
c.channel("A")
c.compose("DstIn")
c.alpha("on")
end
end

@image = frame.composite(image, "png") do |c|
c.compose("DstOver")
c.geometry(offset['offset'])
Expand Down

0 comments on commit 43456a1

Please sign in to comment.