Re: Proposal for a texture selector

2001-02-04 Thread Sven Neumann

Hi,

"David A. Bartold" [EMAIL PROTECTED] writes:

 There needs to be a way to select a texture before advanced tools can
 be added to The GIMP.  I propose to create a new dialog box similar
 to the pattern selector.  Instead of containing tilable RGB pixmaps, it
 will contain tileable greyscale heightfield pixmaps.  These textures will
 be used by some tools to simulate, for example, paper grain.
 
 The user can see the current texture in the main window and in the
 Device status window.  It will be near the current brush selection,
 pattern, and gradient.
 
 A mock-up "screenshot" is available here:
 http://uts.cc.utexas.edu/~foxx/texture_sel.png
 
 I'm not too happy about making the gradient a square rather than a
 rectangle.  The brush, pattern, and texture could be horizontally
 adjacent and the gradient placed underneath all three.  I.e.:
  ___   ___   ___
 |   | |   | |   |
 |___| |___| |___|
  ___
 |   |
 |___|
 
 Anybody else have a suggestion?
 
 There will need to be a new file format for the textures, however
 the code can easily be borrowed from the .pat or .gbr plug-ins.  The
 extension could be .gtx for GIMP Texture (assuming that extention isn't
 used). 

Sounds like a reasonable idea if and only if we make almost all paint tools
use this texture. Are there any algorithms which have proven to fit into
the Gimp paint_core?

Before you think about writing code, we are are designing an abstract 
GimpData object at the moment which will be the parent of all those brush,
pattern, gradient, ... stuff. Those data objects will go into a GimpContainer
(which has just appeared in CVS) which will handle the problems of keeping
names unique, etc. We will also provide views on these objects so all data
previews and all sort of brush, pattern, gradient, ... -dialogs can reuse
the same code. 

This is work in progress, but I'd suggest you don't just copy a lot of 
code around and create a new data type. This is the way it has been done 
several times before and it has led to the awful mess they call gimp-1.2.
In a few weeks, when the basic object infrastructure is in place, it will
be very easy to introduce a new data type.


Salut, Sven





Re: Proposal for a texture selector

2001-02-04 Thread David A. Bartold

See below-

On 4 Feb 2001, Sven Neumann wrote:

  There needs to be a way to select a texture before advanced tools can
  be added to The GIMP.  I propose to create a new dialog box similar
  to the pattern selector.  Instead of containing tilable RGB pixmaps, it
  will contain tileable greyscale heightfield pixmaps.  These textures will
  be used by some tools to simulate, for example, paper grain.



 Sounds like a reasonable idea if and only if we make almost all paint tools
 use this texture. Are there any algorithms which have proven to fit into
 the Gimp paint_core?

I haven't poked into the paint_core too deeply, however here's an
algorithm that should be easy to integrate:  Subtract the texture
from the already subpixel and pressure adjusted brush mask, clipping below
at zero.  Use the results as the new mask.  Basically the arithmetic looks
like this, assuming a mask value of zero means no composition and a
texture value of 0 represents the highest peak:

new_mask[x][y] = MAX (mask[x][y] - texture[x + offset_x][y + offset_y], 0)

If you set wax = 0% and opacity = 100% in DigiPencil, you will see
the effect described by the above algorithm.

 Before you think about writing code, we are are designing an abstract 
 GimpData object at the moment which will be the parent of all those brush,
 pattern, gradient, ... stuff. Those data objects will go into a GimpContainer
 (which has just appeared in CVS) which will handle the problems of keeping
 names unique, etc. We will also provide views on these objects so all data
 previews and all sort of brush, pattern, gradient, ... -dialogs can reuse
 the same code. 

Very cool, that should simplify the process of creating a texture selector
greatly.  In addition to providing UI elements for the user, there also
needs to be an API for scripts and the plug-ins to change the texture.

Thanks for the input,
David