Re: [Gimp-developer] GSoc - Brush Selector Widget

2010-05-05 Thread peter sikking
Zhenfeng Zhao wrote:

 Thank you for the quick feedback...

now for the not so quick feedback...

 I think we want to have the 'from scratch' mode mutual exclusive with
 the
 'from collection' mode. this separates nicely the 2 modes users are.
 this must be done by switching the mode at the top of the brush
 selection
 dialog (a copy of which also pops up in the tool options). of course a
 'from scratch' brush can be saved into the collection. then it has
 become clear
 that the 'from scratch' mode is equal to the brush editor (which can
 definitely use improvements).

 OK, it sounds like a good solution. There can be two modes: choose  
 from the brush selection/collection, and create a brush using brush  
 editor.

I call it subtly different: 'choose from collection' mode and configure
using brush editor (there is no obligation to save it in the  
collection).
just to be clear.

 ah, and when you implement a pattern like that, you will be required
 (I bet)
 to make the changes in such a way that they get applied to all  
 resources
 (patterns, gradients, etc).


 How does the modification apply to patterns and gradients? Do you  
 mean when using a brush shape and a pattern for the stroke? In Clone  
 tool, pattern and brush can be selected separately to use together.  
 If so, I can see there is some work to use a customized brush. Wait,  
 if I make a vector brush using brush editor, and use a pattern  
 source in Clone tool, it works and puts pattern in the shape that I  
 just created. So, if I adjust the UI to have two modes, a newly  
 created vector brush should work with patterns right away, right?


what I meant is the interaction pattern of having a 'from collection'
and a 'from scratch' mode in both the dockable dialog and the tool
options pop-up for patterns and gradients too.

 --ps

 founder + principal interaction architect
 man + machine interface works

 http://mmiworks.net/blog : on interaction architecture



___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] [PATCH] x2: OpenRaster visibility attribute, OpenRaster layer position bugfix

2010-05-05 Thread Jon Nordby
Attached and inlined.

From 9fc67096c7da7722b38c5f7bf1741795a635d7cd Mon Sep 17 00:00:00 2001
From: Jon Nordby jono...@gmail.com
Date: Thu, 6 May 2010 03:44:01 +0200
Subject: [PATCH 1/2] plug-ins: OpenRaster, fix wrong layer positions

Don't store layer offsets in the PNG, or honor them on loading. The layer
position is given by the OpenRaster layer attributes alone. This caused a bug
where the offsets were applied twice, positioning the layer wrong.
---
plug-ins/pygimp/plug-ins/file-openraster.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plug-ins/pygimp/plug-ins/file-openraster.py
b/plug-ins/pygimp/plug-ins/file-openraster.py
index f4bf6e2..b41fc09 100755
--- a/plug-ins/pygimp/plug-ins/file-openraster.py
+++ b/plug-ins/pygimp/plug-ins/file-openraster.py
@@ -86,7 +86,7 @@ def save_ora(img, drawable, filename, raw_filename):
def store_layer(img, drawable, path):
tmp = os.path.join(tempdir, 'tmp.png')
interlace, compression = 0, 2
- png_chunks = (1, 1, 1, 1, 1) # write all PNG chunks
+ png_chunks = (1, 1, 0, 1, 1) # write all PNG chunks except oFFs(ets)
pdb['file-png-save'](img, drawable, tmp, 'tmp.png',
interlace, compression, *png_chunks)
orafile.write(tmp, path)
@@ -172,7 +172,7 @@ def load_ora(filename, raw_filename):
# import layer, set attributes and add to image
gimp_layer = pdb['gimp-file-load-layer'](img, tmp)
gimp_layer.name = name
- gimp_layer.translate(x, y) # move to correct position
+ gimp_layer.set_offsets(x, y) # move to correct position
gimp_layer.opacity = opac * 100 # a float between 0 and 100
img.add_layer(gimp_layer, layer_no)

--
1.7.0.5

From fd3be813070a27d1409edabe570ca7a43cf94e93 Mon Sep 17 00:00:00 2001
From: Jon Nordby jono...@gmail.com
Date: Tue, 4 May 2010 12:42:53 +0200
Subject: [PATCH 2/2] plug-ins: OpenRaster visibility layer attribute

---
 plug-ins/pygimp/plug-ins/file-openraster.py |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/plug-ins/pygimp/plug-ins/file-openraster.py
b/plug-ins/pygimp/plug-ins/file-openraster.py
index b41fc09..4c4ae67 100755
--- a/plug-ins/pygimp/plug-ins/file-openraster.py
+++ b/plug-ins/pygimp/plug-ins/file-openraster.py
@@ -35,8 +35,9 @@ def get_layer_attributes(layer):
 x = int(a.get('x', '0'))
 y = int(a.get('y', '0'))
 opac = float(a.get('opacity', '1.0'))
+visible = a.get('visibility', 'visible') != 'hidden'

-return path, name, x, y, opac
+return path, name, x, y, opac, visible


 def thumbnail_ora(filename, thumb_size):
@@ -92,7 +93,7 @@ def save_ora(img, drawable, filename, raw_filename):
 orafile.write(tmp, path)
 os.remove(tmp)

-def add_layer(x, y, opac, gimp_layer, path):
+def add_layer(x, y, opac, gimp_layer, path, visible=True):
 store_layer(img, gimp_layer, path)
 # create layer attributes
 layer = ET.Element('layer')
@@ -103,13 +104,14 @@ def save_ora(img, drawable, filename, raw_filename):
 a['x'] = str(x)
 a['y'] = str(y)
 a['opacity'] = str(opac)
+a['visibility'] = 'visible' if visible else 'hidden'
 return layer

 # save layers
 for lay in img.layers:
 x, y = lay.offsets
 opac = lay.opacity / 100.0 # needs to be between 0.0 and 1.0
-add_layer(x, y, opac, lay, 'data/%s.png' % lay.name)
+add_layer(x, y, opac, lay, 'data/%s.png' % lay.name, lay.visible)

 # save thumbnail
 w, h = img.width, img.height
@@ -154,7 +156,7 @@ def load_ora(filename, raw_filename):
 return res

 for layer_no, layer in enumerate(get_layers(stack)):
-path, name, x, y, opac = get_layer_attributes(layer)
+path, name, x, y, opac, visible = get_layer_attributes(layer)

 if not path.lower().endswith('.png'):
 continue
@@ -174,6 +176,7 @@ def load_ora(filename, raw_filename):
 gimp_layer.name = name
 gimp_layer.set_offsets(x, y)  # move to correct position
 gimp_layer.opacity = opac * 100  # a float between 0 and 100
+gimp_layer.visible = visible
 img.add_layer(gimp_layer, layer_no)

 os.remove(tmp)
-- 
1.7.0.5


--
Regards Jon Nordby - www.jonnor.com


0001-plug-ins-OpenRaster-fix-wrong-layer-positions.patch
Description: Binary data


0002-plug-ins-OpenRaster-visibility-layer-attribute.patch
Description: Binary data
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer