This repository has been archived by the owner on Feb 20, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Background configurarion for images with alpha channels
- Loading branch information
Showing
19 changed files
with
114 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,9 +1,13 @@ | |||
# -*- encoding: utf-8 -*- | # -*- encoding: utf-8 -*- | ||
$:.unshift(::File.expand_path(::File.join(::File.dirname(__FILE__), 'lib'))) | $:.unshift(::File.expand_path(::File.join(::File.dirname(__FILE__), "lib"))) | ||
require 'mugshot' | require "mugshot" | ||
|
|
||
system "mkdir -p /tmp/mugshot && cp -f spec/files/test.jpg /tmp/mugshot/test" | system "mkdir -p /tmp/mugshot" | ||
%w[test.jpg with_alpha_channel.png].each do |filename| | |||
system "cp -f features/support/files/#{filename} /tmp/mugshot/#{filename.split('.').first}" | |||
end | |||
|
|
||
run Mugshot::Application.new( | run Mugshot::Application.new( | ||
:storage => Mugshot::ProxyStorage.new{|id| "http://foo.com/#{id}.jpg"} | :storage => Mugshot::FSStorage.new("/tmp/mugshot") | ||
) | ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1 @@ | |||
default: -r features/support/env.rb -r features/step_definitions | default: --guess -r features/support/env.rb -r features/step_definitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
Feature: Set Background | |||
|
|||
Scenario: Set background for a png image with alpha channel | |||
Given a png image with alpha channel | |||
When I ask for it with a red background | |||
Then I should get it with a red background | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
# -*- encoding: utf-8 -*- | |||
require 'RMagick' | |||
|
|||
class Mugshot::MagickFactory | |||
class << self | |||
|
|||
def create_canvas(columns, rows, color) | |||
Magick::Image.new(columns, rows){ self.background_color = color } | |||
end | |||
|
|||
end | |||
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
# -*- encoding: utf-8 -*- | |||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |||
|
|||
describe Mugshot::MagickFactory do | |||
|
|||
it "should create a canvas given columns, rows and background color" do | |||
canvas = Mugshot::MagickFactory.create_canvas(100, 200, 'red') | |||
canvas.columns.should == 100 | |||
canvas.rows.should == 200 | |||
canvas.background_color == 'red' | |||
end | |||
|
|||
end |