[Gimp-developer] I am hoping to contribute to GIMP. I have some ideas, but I want input if possible.



Hello all,

I am in a Data Structures class which has a final project. This project
requires students to fix bugs, improve preexisting data structures, or add
extra features to an open source project that has an active community. My
group chose GIMP. I have some ideas about changing data structures in hopes
of generalizing some implementations, improving execution speed and
reducing the amount of code needed to complete implementation of the .h
files.

Here are 3 of our ideas. If you could give input (feasibility, faults in
our plan of action, predicted improvements upon success of these ideas,
suggestions) on any or all of our ideas, that would be greatly appreciated.

1. gimp/libgimpmath/gimpmathtypes.h (file in
question:gimp/libgimpmath/gimpmatrix.h(c))
This file declares math structures that gimp uses like vectors and
matrices. The GimpMatrix structure come in 2X2, 3X3 and even 4X4 versions.
Each matrix is a 2Dimensional gdouble array with the appropriate amount of
elements to span the NXN matrix.I believe this data structure is used for
computation during image editing. There are functions handling
comparisons, identities, transformations, rotations, translations and
various other
matrix operations. Possible changes: I believe the declaration of 3 special
kinds of gimp
matrices can be generalized to a struct (or class) that holds and defines
an NXN matrix. We
could make it as general as possible to save the amount of code necessary
to complete the tasks. This also eliminates two extra structs in the .h
file. We could also change the structure that holds the matrix elements.
One way could be by making a nested linked list to emulate an NXN matrix.
This way, we keep everything in memory and not on the stack. If necessary,
we could even overload the [] operator to make the functionality act like
an array. We could also use the std::vector<T> data structures included in
the <vector> library to allow for pushing and popping of matrix data
structures to make them dynamic and or more fail-safe.

2. gimp/app/core/gimpcontainer.h
This class contains a data structure that is used to store different things
about the
various objects in gimp. It works hand and hand with the GimpObject class.
This
class uses what I believe to be some form of tree or heap structure. The
class
refers to add, remove, reorder, and getChild functions that are defined
across the
class. The gimp.h code uses the GimpContainer class pointers for everything
from fonts, to documents, to displays. As this data structure is used with
GimpObject (which controls a large amount of functionality in gimp) and is
heavily
referenced in the gimp.h file, optimizing this class could go a long way in
optimizing the code. If we decrease the amount of time to “reorder” the
tree, then
we decrease the amount of time several other objects take to be initialized
and
added to the tree.

3. gimp/libgimpmath/gimpvector.h(c)
The GimpVector data structure keeps track of axis orientations and lengths.
I believe this is used in the various drawing tools. I also believe the
automated shapes functions may use it for drawing polygons. The vector data
structure is a structure that holds four gdouble variables that are
separately declared (gdouble x, y, z, w for the 4axis vector for example).
There are three
versions of the gimp vector: 2axis, 3axis, and 4axis. A potential change to
GimpVector could be altering the way that it is stored like we plan to
change the GimpMatrix. This means making a
streamlined generalized vector that can be of dimension N. Storing the axes
in an std::vector<T> or a linked list of size N could generalize the vector
to be declared of any arbitrary number of axes. Another thing we could do
is overload the operators between vectors such as addition, subtraction and
multiplication. Currently they are of the form, GimpVector add(GimpVector
&gv1,GimpVector &gv2). We could make it as easy as adding two vectors with
the + operator to make the code more readable. We can also overload various
other operators to make the GimpVector data structure more flexible and
powerful. This hopefully will increase the functionality and potency of the
GimpVector data structures and make them more accessible to new Gimp
developers in the future.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]