Skip to content

Commit

Permalink
Removed prefixes from operation function names
Browse files Browse the repository at this point in the history
  • Loading branch information
kaedroho committed Feb 18, 2015
1 parent 9f04b4e commit 5b6bac9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion willow/backends/opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def check(cls):


@OpenCVBackend.register_operation('detect_features')
def opencv_detect_features(backend):
def detect_features(backend):
cv = backend.get_opencv()

image = backend.opencv_grey_image()
Expand Down
16 changes: 8 additions & 8 deletions willow/backends/pillow.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ def check(cls):


@PillowBackend.register_operation('get_size')
def pillow_get_size(backend):
def get_size(backend):
return backend.image.size


@PillowBackend.register_operation('resize')
def pillow_resize(backend, width, height):
def resize(backend, width, height):
if backend.image.mode in ['1', 'P']:
backend.image = backend.image.convert('RGB')

Expand All @@ -56,35 +56,35 @@ def pillow_resize(backend, width, height):


@PillowBackend.register_operation('crop')
def pillow_crop(backend, left, top, right, bottom):
def crop(backend, left, top, right, bottom):
backend.image = backend.image.crop((left, top, right, bottom))


@PillowBackend.register_operation('save_as_jpeg')
def pillow_save_as_jpeg(backend, f, quality=85):
def save_as_jpeg(backend, f, quality=85):
if backend.image.mode in ['1', 'P']:
backend.image = backend.image.convert('RGB')

backend.image.save(f, 'JPEG', quality=quality)


@PillowBackend.register_operation('save_as_png')
def pillow_save_as_png(backend, f):
def save_as_png(backend, f):
backend.image.save(f, 'PNG')


@PillowBackend.register_operation('has_alpha')
def pillow_has_alpha(backend):
def has_alpha(backend):
img = backend.image
return img.mode in ('RGBA', 'LA') or (img.mode == 'P' and 'transparency' in img.info)


@PillowBackend.register_operation('has_animation')
def pillow_has_animation(backend):
def has_animation(backend):
# Animation not supported by PIL
return False


@PillowBackend.register_operation('get_pillow_image')
def pillow_get_pillow_image(backend):
def get_pillow_image(backend):
return backend.image.copy()
12 changes: 6 additions & 6 deletions willow/backends/wand.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ def check(cls):


@WandBackend.register_operation('get_size')
def wand_get_size(backend):
def get_size(backend):
return backend.image.size


@WandBackend.register_operation('resize')
def wand_resize(backend, width, height):
def resize(backend, width, height):
backend.image.resize(width, height)


@WandBackend.register_operation('crop')
def wand_crop(backend, left, top, right, bottom):
def crop(backend, left, top, right, bottom):
backend.image.crop(left=left, top=top, right=right, bottom=bottom)


@WandBackend.register_operation('has_alpha')
def wand_has_alpha(backend):
def has_alpha(backend):
return backend.image.alpha_channel


@WandBackend.register_operation('has_animation')
def wand_has_animation(backend):
def has_animation(backend):
return backend.image.animation


@WandBackend.register_operation('get_wand_image')
def wand_get_wand_image(backend):
def get_wand_image(backend):
return backend.image.clone()

0 comments on commit 5b6bac9

Please sign in to comment.