GIMP Script-fu

Hex Artifact Content
Login

Artifact 397ca841b38943d4b2c8e404e1f29e4f766d7d08:


0000: 3b 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69  ; This program i
0010: 73 20 66 72 65 65 20 73 6f 66 74 77 61 72 65 3b  s free software;
0020: 20 79 6f 75 20 63 61 6e 20 72 65 64 69 73 74 72   you can redistr
0030: 69 62 75 74 65 20 69 74 20 61 6e 64 2f 6f 72 20  ibute it and/or 
0040: 6d 6f 64 69 66 79 0a 3b 20 69 74 20 75 6e 64 65  modify.; it unde
0050: 72 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74  r the terms of t
0060: 68 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50  he GNU General P
0070: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 61 73  ublic License as
0080: 20 70 75 62 6c 69 73 68 65 64 20 62 79 0a 3b 20   published by.; 
0090: 74 68 65 20 46 72 65 65 20 53 6f 66 74 77 61 72  the Free Softwar
00a0: 65 20 46 6f 75 6e 64 61 74 69 6f 6e 3b 20 65 69  e Foundation; ei
00b0: 74 68 65 72 20 76 65 72 73 69 6f 6e 20 32 20 6f  ther version 2 o
00c0: 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2c 20 6f  f the License, o
00d0: 72 0a 3b 20 28 61 74 20 79 6f 75 72 20 6f 70 74  r.; (at your opt
00e0: 69 6f 6e 29 20 61 6e 79 20 6c 61 74 65 72 20 76  ion) any later v
00f0: 65 72 73 69 6f 6e 2e 0a 3b 0a 3b 20 54 68 69 73  ersion..;.; This
0100: 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 74   program is dist
0110: 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 68  ributed in the h
0120: 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c 6c  ope that it will
0130: 20 62 65 20 75 73 65 66 75 6c 2c 0a 3b 20 62 75   be useful,.; bu
0140: 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41  t WITHOUT ANY WA
0150: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20  RRANTY; without 
0160: 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 65 64  even the implied
0170: 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 3b 20 4d   warranty of.; M
0180: 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 20 6f  ERCHANTABILITY o
0190: 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 41 20  r FITNESS FOR A 
01a0: 50 41 52 54 49 43 55 4c 41 52 20 50 55 52 50 4f  PARTICULAR PURPO
01b0: 53 45 2e 20 20 53 65 65 20 74 68 65 0a 3b 20 47  SE.  See the.; G
01c0: 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69  NU General Publi
01d0: 63 20 4c 69 63 65 6e 73 65 20 66 6f 72 20 6d 6f  c License for mo
01e0: 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 0a 28 64  re details....(d
01f0: 65 66 69 6e 65 20 28 73 63 72 69 70 74 2d 66 75  efine (script-fu
0200: 2d 73 67 2d 66 6c 6f 61 74 2d 6c 61 79 65 72 20  -sg-float-layer 
0210: 69 6d 61 67 65 20 6c 61 79 65 72 29 0a 20 20 28  image layer).  (
0220: 67 69 6d 70 2d 69 6d 61 67 65 2d 75 6e 64 6f 2d  gimp-image-undo-
0230: 67 72 6f 75 70 2d 73 74 61 72 74 20 69 6d 61 67  group-start imag
0240: 65 29 0a 20 20 28 67 69 6d 70 2d 73 65 6c 65 63  e).  (gimp-selec
0250: 74 69 6f 6e 2d 6e 6f 6e 65 20 69 6d 61 67 65 29  tion-none image)
0260: 0a 20 20 28 77 68 65 6e 20 28 7a 65 72 6f 3f 20  .  (when (zero? 
0270: 28 63 61 72 20 28 67 69 6d 70 2d 64 72 61 77 61  (car (gimp-drawa
0280: 62 6c 65 2d 68 61 73 2d 61 6c 70 68 61 20 6c 61  ble-has-alpha la
0290: 79 65 72 29 29 29 0a 20 20 20 20 28 67 69 6d 70  yer))).    (gimp
02a0: 2d 6c 61 79 65 72 2d 61 64 64 2d 61 6c 70 68 61  -layer-add-alpha
02b0: 20 6c 61 79 65 72 29 20 29 0a 20 20 28 6c 65 74   layer) ).  (let
02c0: 20 28 28 62 75 66 66 65 72 20 28 63 61 72 20 28   ((buffer (car (
02d0: 67 69 6d 70 2d 65 64 69 74 2d 6e 61 6d 65 64 2d  gimp-edit-named-
02e0: 63 6f 70 79 20 6c 61 79 65 72 20 22 64 79 6e 61  copy layer "dyna
02f0: 6d 69 63 20 6c 61 79 65 72 22 29 29 29 29 0a 20  mic layer")))). 
0300: 20 20 20 28 67 69 6d 70 2d 65 64 69 74 2d 63 6c     (gimp-edit-cl
0310: 65 61 72 20 6c 61 79 65 72 29 0a 20 20 20 20 28  ear layer).    (
0320: 67 69 6d 70 2d 65 64 69 74 2d 6e 61 6d 65 64 2d  gimp-edit-named-
0330: 70 61 73 74 65 20 6c 61 79 65 72 20 62 75 66 66  paste layer buff
0340: 65 72 20 46 41 4c 53 45 29 0a 20 20 20 20 28 67  er FALSE).    (g
0350: 69 6d 70 2d 62 75 66 66 65 72 2d 64 65 6c 65 74  imp-buffer-delet
0360: 65 20 62 75 66 66 65 72 29 20 29 0a 20 20 28 67  e buffer) ).  (g
0370: 69 6d 70 2d 69 6d 61 67 65 2d 75 6e 64 6f 2d 67  imp-image-undo-g
0380: 72 6f 75 70 2d 65 6e 64 20 69 6d 61 67 65 29 20  roup-end image) 
0390: 29 0a 20 20 0a 20 20 0a 28 73 63 72 69 70 74 2d  ).  .  .(script-
03a0: 66 75 2d 72 65 67 69 73 74 65 72 20 22 73 63 72  fu-register "scr
03b0: 69 70 74 2d 66 75 2d 73 67 2d 66 6c 6f 61 74 2d  ipt-fu-sg-float-
03c0: 6c 61 79 65 72 22 0a 20 22 46 6c 6f 61 74 20 4c  layer". "Float L
03d0: 61 79 65 72 22 0a 20 22 46 6c 6f 61 74 20 65 6e  ayer". "Float en
03e0: 74 69 72 65 20 6c 61 79 65 72 20 69 67 6e 6f 72  tire layer ignor
03f0: 69 6e 67 20 73 65 6c 65 63 74 69 6f 6e 22 0a 20  ing selection". 
0400: 22 53 61 75 6c 20 47 6f 6f 64 65 22 0a 20 22 53  "Saul Goode". "S
0410: 61 75 6c 20 47 6f 6f 64 65 22 0a 20 22 44 65 63  aul Goode". "Dec
0420: 65 6d 62 65 72 20 32 30 31 34 22 0a 20 22 2a 22  ember 2014". "*"
0430: 0a 20 53 46 2d 49 4d 41 47 45 20 20 20 20 22 49  . SF-IMAGE    "I
0440: 6d 61 67 65 22 20 20 20 20 30 0a 20 53 46 2d 44  mage"    0. SF-D
0450: 52 41 57 41 42 4c 45 20 22 44 72 61 77 61 62 6c  RAWABLE "Drawabl
0460: 65 22 20 30 0a 20 29 0a 20 0a 28 73 63 72 69 70  e" 0. ). .(scrip
0470: 74 2d 66 75 2d 6d 65 6e 75 2d 72 65 67 69 73 74  t-fu-menu-regist
0480: 65 72 20 22 73 63 72 69 70 74 2d 66 75 2d 73 67  er "script-fu-sg
0490: 2d 66 6c 6f 61 74 6c 61 79 65 72 22 0a 20 22 3c  -floatlayer". "<
04a0: 49 6d 61 67 65 3e 2f 4c 61 79 65 72 22 0a 20 29  Image>/Layer". )
04b0: 0a 0a 28 73 63 72 69 70 74 2d 66 75 2d 6d 65 6e  ..(script-fu-men
04c0: 75 2d 72 65 67 69 73 74 65 72 20 22 73 63 72 69  u-register "scri
04d0: 70 74 2d 66 75 2d 73 67 2d 66 6c 6f 61 74 2d 6c  pt-fu-sg-float-l
04e0: 61 79 65 72 22 0a 20 22 3c 4c 61 79 65 72 73 3e  ayer". "<Layers>
04f0: 22 0a 20 29 0a                                   ". ).