Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typos #173

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion BENCHMARKING.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ make sure that the chunky_png is installed for all your interpreters.

What is a speed improvement on one interpreter doesn't necessarily mean the
performance will be better on other interpreters as well. Please make sure to
benchamrk different RUby interpreters. When it comes to different Ruby
benchmark different RUby interpreters. When it comes to different Ruby
interpreters, the priority is the performance on recent MRI versions.

Some very old benchmark result (using <tt>N=50</tt>) on my 2007 iMac can be
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The file documents the changes to this library over the different versions.
- Improve performance of <tt>Palette.from_canvas</tt>.
- Add <tt>Color.euclidean_distance_rgba</tt> to compare colors.
- Bugix in <tt>Canvas.from_bgr_stream</tt>.
- Documentation and code readibility improvements.
- Documentation and code readability improvements.
- README updates, include mention of screencast.

=== 1.3.0 - 2014-02-10
Expand All @@ -105,7 +105,7 @@ The file documents the changes to this library over the different versions.

=== 1.2.7 - 2013-01-07

- Small PNG decoding performnace improvements by using bitwise math.
- Small PNG decoding performance improvements by using bitwise math.

=== 1.2.6 - 2012-08-07

Expand Down
6 changes: 3 additions & 3 deletions lib/chunky_png/canvas/drawing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ def circle(x0, y0, radius, stroke_color = ChunkyPNG::Color::BLACK, fill_color =

# Calculates the binomial coefficient for n over k.
#
# @param [Integer] n first parameter in coeffient (the number on top when
# @param [Integer] n first parameter in coefficient (the number on top when
# looking at the mathematic formula)
# @param [Integer] k k-element, second parameter in coeffient (the number
# @param [Integer] k k-element, second parameter in coefficient (the number
# on the bottom when looking at the mathematic formula)
# @return [Integer] The binomial coeffcient of (n,k)
# @return [Integer] The binomial coefficient of (n,k)
def binomial_coefficient(n, k)
return 1 if n == k || k == 0
return n if k == 1
Expand Down
2 changes: 1 addition & 1 deletion lib/chunky_png/canvas/operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def grayscale!

# Converts the canvas to grayscale, returning a new canvas.
#
# This method will not modify the canvas. To modift the current canvas,
# This method will not modify the canvas. To modify the current canvas,
# use {#grayscale!} instead.
#
# @return [ChunkyPNG::Canvas] A copy of the canvas, converted to
Expand Down
22 changes: 11 additions & 11 deletions lib/chunky_png/canvas/resampling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class Canvas
module Resampling
# Integer Interpolation between two values
#
# Used for generating indicies for interpolation (eg, nearest
# Used for generating indices for interpolation (eg, nearest
# neighbour).
#
# @param [Integer] width The width of the source
# @param [Integer] new_width The width of the destination
# @return [Array<Integer>] An Array of Integer indicies
# @return [Array<Integer>] An Array of Integer indices
def steps(width, new_width)
indicies, residues = steps_residues(width, new_width)
indices, residues = steps_residues(width, new_width)

for i in 1..new_width
indicies[i - 1] = (indicies[i - 1] + (residues[i - 1] + 127) / 255)
indices[i - 1] = (indices[i - 1] + (residues[i - 1] + 127) / 255)
end
indicies
indices
end

# Fractional Interpolation between two values
Expand All @@ -34,9 +34,9 @@ def steps(width, new_width)
#
# @param [Integer] width The width of the source
# @param [Integer] new_width The width of the destination
# @return [Array<Integer>, Array<Integer>] Two arrays of indicies and residues
# @return [Array<Integer>, Array<Integer>] Two arrays of indices and residues
def steps_residues(width, new_width)
indicies = Array.new(new_width, nil)
indices = Array.new(new_width, nil)
residues = Array.new(new_width, nil)

# This works by accumulating the fractional error and
Expand All @@ -53,7 +53,7 @@ def steps_residues(width, new_width)
err = (width - new_width) % denominator

for i in 1..new_width
indicies[i - 1] = index
indices[i - 1] = index
residues[i - 1] = (255.0 * err.to_f / denominator.to_f).round

index += base_step
Expand All @@ -64,7 +64,7 @@ def steps_residues(width, new_width)
end
end

[indicies, residues]
[indices, residues]
end

# Resamples the canvas using nearest neighbor interpolation.
Expand Down Expand Up @@ -102,13 +102,13 @@ def resample_bilinear!(new_width, new_height)
pixels = Array.new(new_width * new_height)
i = 0
for y in 1..new_height
# Clamp the indicies to the edges of the image
# Clamp the indices to the edges of the image
y1 = [index_y[y - 1], 0].max
y2 = [index_y[y - 1] + 1, height - 1].min
y_residue = interp_y[y - 1]

for x in 1..new_width
# Clamp the indicies to the edges of the image
# Clamp the indices to the edges of the image
x1 = [index_x[x - 1], 0].max
x2 = [index_x[x - 1] + 1, width - 1].min
x_residue = interp_x[x - 1]
Expand Down
2 changes: 1 addition & 1 deletion lib/chunky_png/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def grayscale_teint(color)
# channel.
#
# This method will return a full color value, with the R, G, and B value
# set to the grayscale teint calcuated from the input color's R, G and B
# set to the grayscale teint calculated from the input color's R, G and B
# values.
#
# @param [Integer] color The color to convert.
Expand Down
2 changes: 1 addition & 1 deletion lib/chunky_png/palette.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initialize(enum, decoding_map = nil)
# Builds a palette instance from a PLTE chunk and optionally a tRNS chunk
# from a PNG datastream.
#
# This method will cerate a palette that is suitable for decoding an image.
# This method will create a palette that is suitable for decoding an image.
#
# @param palette_chunk [ChunkyPNG::Chunk::Palette] The palette chunk to
# load from
Expand Down
2 changes: 1 addition & 1 deletion spec/chunky_png/canvas/operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
expect { subject.crop(10, 5, 4, 8) }.to_not change { subject.pixels }
end

it "should raise an exception when the cropped image falls outside the oiginal image" do
it "should raise an exception when the cropped image falls outside the original image" do
expect { subject.crop(16, 16, 2, 2) }.to raise_error(ChunkyPNG::OutOfBounds)
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/chunky_png/color_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
expect(html_color("Spring green @ 0.0")).to eql 0x00ff7f00
end

it "should raise for an unkown color name" do
it "should raise for an unknown color name" do
expect { html_color(:nonsense) }.to raise_error(ArgumentError)
end
end
Expand Down Expand Up @@ -252,15 +252,15 @@
end

describe "#to_hex" do
it "should represent colors correcly using hex notation" do
it "should represent colors correctly using hex notation" do
expect(to_hex(@white)).to eql "#ffffffff"
expect(to_hex(@black)).to eql "#000000ff"
expect(to_hex(@opaque)).to eql "#0a6496ff"
expect(to_hex(@non_opaque)).to eql "#0a649664"
expect(to_hex(@fully_transparent)).to eql "#0a649600"
end

it "should represent colors correcly using hex notation without alpha channel" do
it "should represent colors correctly using hex notation without alpha channel" do
expect(to_hex(@white, false)).to eql "#ffffff"
expect(to_hex(@black, false)).to eql "#000000"
expect(to_hex(@opaque, false)).to eql "#0a6496"
Expand Down
4 changes: 2 additions & 2 deletions spec/chunky_png/vector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it { should respond_to(:points) }

describe "#length" do
it "shopuld have 3 items" do
it "should have 3 items" do
expect(subject.length).to eql(3)
end
end
Expand Down Expand Up @@ -52,7 +52,7 @@
expect(subject.offset).to be_kind_of(ChunkyPNG::Point)
end

it "should use the mininum x and y coordinates as values for the point" do
it "should use the minimum x and y coordinates as values for the point" do
expect(subject.offset.x).to eql subject.min_x
expect(subject.offset.y).to eql subject.min_y
end
Expand Down