Skip to content

Commit

Permalink
change function names to snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
dwastberg authored and radarhere committed Feb 19, 2020
1 parent 7d5ab9f commit 2e02500
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Tests/test_imagechops.py
Expand Up @@ -38,8 +38,8 @@ def test_sanity():
ImageChops.blend(im, im, 0.5)
ImageChops.composite(im, im, im)

ImageChops.softlight(im, im)
ImageChops.hardlight(im, im)
ImageChops.soft_light(im, im)
ImageChops.hard_light(im, im)
ImageChops.overlay(im, im)

ImageChops.offset(im, 10)
Expand Down Expand Up @@ -366,26 +366,26 @@ def test_subtract_modulo_no_clip():
self.assertEqual(new.getpixel((50, 50)), (241, 167, 127))


def test_softlight(self):
def test_soft_light(self):
# Arrange
im1 = Image.open("Tests/images/hopper.png")
im2 = Image.open("Tests/images/hopper-XYZ.png")

# Act
new = ImageChops.softlight(im1, im2)
new = ImageChops.soft_light(im1, im2)

# Assert
self.assertEqual(new.getpixel((64, 64)), (163, 54, 32))
self.assertEqual(new.getpixel((15, 100)), (1, 1, 3))


def test_hardlight(self):
def test_hard_light(self):
# Arrange
im1 = Image.open("Tests/images/hopper.png")
im2 = Image.open("Tests/images/hopper-XYZ.png")

# Act
new = ImageChops.hardlight(im1, im2)
new = ImageChops.hard_light(im1, im2)

# Assert
self.assertEqual(new.getpixel((64, 64)), (144, 50, 27))
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/ImageChops.rst
Expand Up @@ -36,8 +36,8 @@ operations in this module).
.. autofunction:: PIL.ImageChops.logical_or
.. autofunction:: PIL.ImageChops.logical_xor
.. autofunction:: PIL.ImageChops.multiply
.. autofunction:: PIL.ImageChops.softlight
.. autofunction:: PIL.ImageChops.hardlight
.. autofunction:: PIL.ImageChops.soft_light
.. autofunction:: PIL.ImageChops.hard_light
.. autofunction:: PIL.ImageChops.overlay
.. py:method:: PIL.ImageChops.offset(image, xoffset, yoffset=None)
Expand Down
8 changes: 4 additions & 4 deletions src/PIL/ImageChops.py
Expand Up @@ -139,7 +139,7 @@ def screen(image1, image2):
return image1._new(image1.im.chop_screen(image2.im))


def softlight(image1, image2):
def soft_light(image1, image2):
"""
Superimposes two images on top of each other using the Soft Light algorithm
Expand All @@ -148,10 +148,10 @@ def softlight(image1, image2):

image1.load()
image2.load()
return image1._new(image1.im.chop_softlight(image2.im))
return image1._new(image1.im.chop_soft_light(image2.im))


def hardlight(image1, image2):
def hard_light(image1, image2):
"""
Superimposes two images on top of each other using the Hard Light algorithm
Expand All @@ -160,7 +160,7 @@ def hardlight(image1, image2):

image1.load()
image2.load()
return image1._new(image1.im.chop_hardlight(image2.im))
return image1._new(image1.im.chop_hard_light(image2.im))


def overlay(image1, image2):
Expand Down
8 changes: 4 additions & 4 deletions src/_imaging.c
Expand Up @@ -2407,7 +2407,7 @@ _chop_subtract_modulo(ImagingObject* self, PyObject* args)
}

static PyObject*
_chop_softlight(ImagingObject* self, PyObject* args)
_chop_soft_light(ImagingObject* self, PyObject* args)
{
ImagingObject* imagep;

Expand All @@ -2418,7 +2418,7 @@ _chop_softlight(ImagingObject* self, PyObject* args)
}

static PyObject*
_chop_hardlight(ImagingObject* self, PyObject* args)
_chop_hard_light(ImagingObject* self, PyObject* args)
{
ImagingObject* imagep;

Expand Down Expand Up @@ -3357,8 +3357,8 @@ static struct PyMethodDef methods[] = {
{"chop_and", (PyCFunction)_chop_and, 1},
{"chop_or", (PyCFunction)_chop_or, 1},
{"chop_xor", (PyCFunction)_chop_xor, 1},
{"chop_softlight", (PyCFunction)_chop_softlight, 1},
{"chop_hardlight", (PyCFunction)_chop_hardlight, 1},
{"chop_soft_light", (PyCFunction)_chop_soft_light, 1},
{"chop_hard_light", (PyCFunction)_chop_hard_light, 1},
{"chop_overlay", (PyCFunction)_chop_overlay, 1},

#endif
Expand Down

0 comments on commit 2e02500

Please sign in to comment.