;############################################################################## ;# ;# Mericet Script-Fu Library - MakeWeb20 ;# ;# This script takes a simple layer, adds a mirror effect and a applys ;# a perspective transformation. ;# ;# Author : Andreas Habel ;# Date : 2009/01/09 ;# Filename : mericet-makeweb20.scm ;# Version : 1.0.0 ;# ;# Support : http://mericet.de ;# Copyright : 2009, Andreas Habel (http://mericet.de) ;# ;#----------------------------------------------------------------------------- ;# ;# 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 3 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, see . ;# ;############################################################################## (define (mericet-makeweb20 image layer mirror) (gimp-image-undo-group-start image) (let* ( (spiegel-layer 0) (spiegel-maske 0) (icon-height 0) (icon-half-height 0) ) (set! spiegel-layer (car (gimp-layer-copy layer TRUE))) (gimp-image-add-layer image spiegel-layer -1) (set! icon-height (car (gimp-drawable-height layer))) (set! icon-half-height (/ icon-height 2)) (gimp-drawable-transform-flip-simple spiegel-layer ORIENTATION-VERTICAL FALSE (+ 1 (+ (cadr (gimp-drawable-offsets layer)) icon-height)) FALSE ) (set! spiegel-maske (car (gimp-layer-create-mask spiegel-layer ADD-WHITE-MASK))) (gimp-layer-add-mask spiegel-layer spiegel-maske) (gimp-context-set-foreground '(0 0 0 )) (gimp-context-set-background '(255 255 255)) (gimp-edit-blend spiegel-maske FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE TRUE ;reverse FALSE ;supersamle 1 ; supersample quality 0 ; supersample threshold TRUE; dither 1 (- 0 icon-half-height) ; mitte des logos 1 icon-half-height ; mitte des logos ) (gimp-layer-remove-mask spiegel-layer 0) (set! layer (car (gimp-image-merge-down image spiegel-layer EXPAND-AS-NECESSARY))) (let* ( (x1 (car (gimp-drawable-offsets layer))) (y1 (cadr (gimp-drawable-offsets layer))) (x2 (+ x1 (car (gimp-drawable-width layer)))) (y2 y1) (x3 x1) (y3 (+ y1 (car (gimp-drawable-height layer)))) (x4 x2) (y4 y3) ) ; errechnet die neuen koordinaten zur perspektivischen verschiebung (if (= mirror TRUE) (begin (set! y2 (- y2 (/ icon-half-height 2))) (set! y4 (+ y4 icon-half-height)) ) (begin (set! y1 (- y1 (/ icon-half-height 2))) (set! y3 (+ y3 icon-half-height)) ) ) ; perspektive (gimp-drawable-transform-perspective-default layer x1 ; new x oben links y1 ; new y oben links x2 ; new x oben rechts y2 ; new y oben rechts x3 ; new x unten links y3 ; new y unten links x4 ; new x unten rechts y4 ; new y unten rechts TRUE TRANSFORM-RESIZE-ADJUST ) ) (plug-in-autocrop-layer 0 image layer) (gimp-image-resize-to-layers image) (gimp-image-undo-group-end image) (gimp-displays-flush) ) ) ; Im GIMP und im Menü registrieren (script-fu-register "mericet-makeweb20" _"_Web2.0 effect" "Mirrors and transforms a layer looking like a common web2.0 effect." "Andreas Habel " "Andreas Habel, " "Jan 09, 2009" "This script takes a simple layer, adds a mirror effect and a applys a perspective transformation." SF-IMAGE "The image" 0 SF-DRAWABLE "The layer" 0 SF-TOGGLE _"Flip perspective?" FALSE ) (script-fu-menu-register "mericet-makeweb20" "/Filters/Mericet")