#!/usr/bin/env python # next-mode.py: set the current layer to the next layer mode. # Copyright (C) 2008 Akkana Peck. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from gimpfu import * mode_list = [ NORMAL_MODE, DISSOLVE_MODE, MULTIPLY_MODE, DIVIDE_MODE, SCREEN_MODE, OVERLAY_MODE, DODGE_MODE, BURN_MODE, HARDLIGHT_MODE, SOFTLIGHT_MODE, GRAIN_EXTRACT_MODE, GRAIN_MERGE_MODE, DIFFERENCE_MODE, ADDITION_MODE, SUBTRACT_MODE, DARKEN_ONLY_MODE, LIGHTEN_ONLY_MODE, HUE_MODE, SATURATION_MODE, COLOR_MODE, VALUE_MODE ] def next_mode(img, drawable) : # disable undo for the image img.undo_group_start() i = mode_list.index(drawable.mode) drawable.mode = mode_list[(i+1) % len(mode_list)] # enable undo again img.undo_group_end() register( "python-fu-next-mode", N_("Change the current layer to the next layer mode"), "Change the current layer to the next layer mode", "Akkana Peck", "Akkana Peck", "2008", N_("/Layer/Next mode"), "*", [ ], [], next_mode ) main()