Ignore guides at or beyond image bounds, since those aren't valid slicing

2005-02-19  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/plug-ins/py-slice.py: Ignore guides at or beyond
        image bounds, since those aren't valid slicing bounds. Fixes bug
        #167843.
This commit is contained in:
Manish Singh 2005-02-20 06:17:09 +00:00 committed by Manish Singh
parent 17e7e13e58
commit caaf65cc7c
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-02-19 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/plug-ins/py-slice.py: Ignore guides at or beyond
image bounds, since those aren't valid slicing bounds. Fixes bug
#167843.
2005-02-20 Sven Neumann <sven@gimp.org>
* app/dialogs/user-install-dialog.c: migrate gimp-2.2 settings if

View File

@ -89,6 +89,8 @@ def slice(image, image_path, image_basename, image_extension,
filename = os.path.join(image_path, src)
temp_image = image.duplicate()
temp_image.disable_undo()
temp_image.crop(right - left, bottom - top, left, top)
pdb.gimp_file_save(temp_image, temp_image.active_layer, filename, filename)
@ -116,10 +118,15 @@ def get_guides(image):
for guide in GuideIter(image):
orientation = image.get_guide_orientation(guide)
if orientation == ORIENTATION_VERTICAL:
vguides.append((image.get_guide_position(guide), guide))
elif orientation == ORIENTATION_HORIZONTAL:
hguides.append((image.get_guide_position(guide), guide))
guide_position = image.get_guide_position(guide)
if guide_position > 0:
if orientation == ORIENTATION_VERTICAL:
if guide_position < image.width:
vguides.append((guide_position, guide))
elif orientation == ORIENTATION_HORIZONTAL:
if guide_position < image.height:
hguides.append((guide_position, guide))
def position_sort(x, y):
return cmp(x[0], y[0])