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


On Mon, Dec 9, 2013 at 4:35 PM, DeVonte Applewhite <dapplewh nd edu> wrote:

First of all, do not send emails to only me please. You are lucky I
check my emails regularly and in particular answer them. Also I am not
the one who knows the code the best. If you really want answers, you
should send to the whole list. I added it in Cc.

I am trying to just test out the gimpmath portion of the libgimpmath
folder. It has the vectors, matrices and other math-related functions in it.
I want to just take the contents of this folder, put these contents in a
temporary folder that is inside this folder. I'll name that folder temp.
then, I want to change the implementation of one of the .c files and test it
with a driver program to see the individual functions get invoked. However,
I am having a hard time compiling this setup because at times I am not
including certain libraries and I do not know the exact location of the
gdouble and gint variables that these programs use. Here is my makefile so
far. mygimpvector.c is my implementation of the gimp vector.c program. Right
now, mygimpvector.c is identical to gimpvector.c except for its name being
different. Do you have any ideas?
test: mattest.c mygimpmatrix.c
gcc `pkg-config --cflags --libs glib-2.0` mattest.c mygimpmatrix.c -Wall

Thanks in advance and hope to hear from you soon.

I don't really understand what you are speaking about. Are you
modifying core GIMP code (which last time we talked was your project)
or just testing out existing libgimp in say a C plugin?

As for all the g* types (gint, gdouble...), they are glib types, so
you have to find the adequate glib header to include, but I'm not sure
either that is what you are asking me about.

As for your mygimp* files, are they simply reimplementation of the
gimp* files similarly named? If so, why do you even bother making a
separate file? Why don't you modify inline the existing file, so that
you don't have to bother for modifying Makefiles? (you can always keep
a copy of the current files if you need side-by-side comparison, but
the new implementation should go in the gimp* files)

Also are you trying to modify directly Makefile-s (instead of and using bare gcc command lines there? This is a very
non-portable and broken way. No wonder you have issues. Look the files and try to understand how these work (you can also
look for automake tutorials) if really you need to edit the
But as I said earlier, if the goal is only to provide a new
implementation of an existing API, you should not have anything to do
to modify the build.


On Sun, Nov 17, 2013 at 7:24 PM, DeVonte Applewhite <dapplewh nd edu> wrote:

Thanks!!! Ah, now I understand. Our initial understanding was that since
some parts were made in C++ there would be reason for doing more C++ coding
in place of a few C code files. Thank you for clarifying that this plan has
large problems and that it would not be merged to the main program
(upstream). I think that the brushes are definitely a good route to look
into . Thank you for the reference link. Yes, we do not have a large chunk
of time, but we definitely will try to spend it as effectively as we can. I
will try the IRC channel. It sounds like something I could definitely use
since GIMP is a large project that can be overwhelming to understand at
once. Glad people are happy and available to discuss questions, suggestions
and such. I think my group can make a plan based on this information for
sure. Thanks again.

On Sun, Nov 17, 2013 at 6:38 PM, Jehan Pagès <jehan marmottard gmail com>


On Mon, Nov 18, 2013 at 12:09 PM, DeVonte Applewhite <dapplewh nd edu>
Thank you for your response. We have used your input to clarify our
direction on this project. What do you think of this.
1. We will try to make a c++ implementation of gimpvector where we
operators and try to string the executable together so that it

As Sven also answered on the mailing list, GIMP is written in C, not
C++. And even though it may happen that some components may be written
in C++ if really it helped somehow (for instance when using some third
party library in C++ which is the best at what it does), I'm pretty
sure our maintainer won't accept any base class in C++, especially for
no reason.

Now if that's just for the fun of the experiment and the sake of your
class project, go ahead. :-) But don't have your expectations too
high, because such code may never make it upstream.

2. We will try to make a c++ implementation of gimpmatrix where we
operators and try to string the executable together so that it
compiles. We
will also see if we can generalize some of the code that implements

Same as above.

3. We will attempt to fix at least one bug. If we can handle that, we
try to do more bugs given enough time before the project's due date.


4. We are trying to add a new feature to Gimp. It will be something
but we still want to do something that will be interesting. We were
of looking into the filters or brush shapes to see what can come of

I understand that bug fixes are not sexy and you want something cooler.
Well there are so many wanted features that it is hard to give advice.
About brush, I know there are some plans on supporting more brush
engine (in particular by using libmypaint, if not mistaken). Maybe
that's a path to follow if you want to improve brushes?
You may have an idea of the biggest planned features there:
Though if you have other ideas, we are always happy to consider
interesting new concepts.

But the best would be to come on GIMP's IRC where most of the devs are
hanging around (respectively in their timezones): #gimp on
There you may ask questions if you have any, if you don't understand
something, or want to propose, etc.

We understand that this will not increase the speed of Gimp, but it may
something else entirely that may be helpful to someone by chance (as we
in our initial plan).

Thanks for this dialogue. It has been quite helpful to us moving

You are welcome. Don't hesitate to come hang around on IRC. There is
no reason to just stop the dialogue. :-)
In any case, for the sake of the class, I understand that you have to
work fast and just implement "something to show your teacher". In this
respect you may not care too much about discussing too much about the
best approach and waste time. If that is the case, I fully understand.
Just be aware that some things are doomed from the start though (like
rewriting base class in C++ as you propose) if the goal is also to
merge upstream. Since I find it sad to waste good work and would
definitely prefer to see new contributors with upstream patches, well
I want to make sure you got this part.
In any case, have fun GIMPing! And maybe see you on IRC. :-)


Have a great day.

On Tue, Nov 12, 2013 at 4:39 AM, Jehan Pagès
<jehan marmottard gmail com>


On Tue, Nov 12, 2013 at 5:30 PM, DeVonte Applewhite <dapplewh nd edu>
Hello all,

I am in a Data Structures class which has a final project. This
requires students to fix bugs, improve preexisting data structures,
extra features to an open source project that has an active
group chose GIMP.

Nice choice! :-)

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

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

Well I won't comment all the ideas in detail, and my guess is there
are few chances others will either, because that would take quite a
time! We don't know the whole code by heart, so to understand what you
speak about, we would have to read the code you speak about carefully;
and even so, when I see the kind of changes you propose, I'm not sure
we will just say that's good ideas out of our head by just reading
code. You seem to be proposing mostly API change or code optimization.
But as often in optimization, it starts with gut feeling (except when
dealing with obvious bad designs), and some algorithm cost
computation, but in the end only real testing will really tell.
So if you really feel that's the way to go, you can still implement
it, test it, and if it appears to be a lot better than previously,
then you won. Propose a patch with some benchmark results and someone
will have at look at this.

Now this said, I really wonder if API changes or algorithm
optimizations are the best way to start in OpenSource contribution. A
codebase like GIMP is huge and very complicated and you want to start
with base classes. First of all, classes which are used in a lot of
places may also break many different pieces of code if you change
things (API or algorithm) there. So that implies a lot of regression
testing, which means a lot of time.
Second, even though base classes are indeed used in a lot of places,
and optimizations are always good, well it is not that obvious that
the optimization will get that tremendous speed improvements compared
to all the other things done along the way.
Last, API change just for the sake of API change, I'm not sure that's
the best idea. We will usually do something because we actually want
to use it and see it will make actual code better. I'm not sure if API
change which "may" make some future code better is a good way to do

I would think an easier way to start contributing is to fix bugs. We
have quite a lot of bugs in our bug tracker waiting to be fixed. Just
pick some of them, and fix them. Then you are sure this will be wanted
code, and there is no "maybe" or incertitude. Also that's a lot
easier, though very visible.

But if you're sure your propositions are worth it, the best is to do
the changes and propose patches. :-) As I said, I haven't looked at
them in details. Maybe that's great ideas, no idea. I know some
contributors start with base consolidations, not fixes. It happens.
In any case, have fun with GIMP,


1. gimp/libgimpmath/gimpmathtypes.h (file in
This file declares math structures that gimp uses like vectors and
matrices. The GimpMatrix structure come in 2X2, 3X3 and even 4X4
Each matrix is a 2Dimensional gdouble array with the appropriate
elements to span the NXN matrix.I believe this data structure is
computation during image editing. There are functions handling
comparisons, identities, transformations, rotations, translations
various other
matrix operations. Possible changes: I believe the declaration of 3
kinds of gimp
matrices can be generalized to a struct (or class) that holds and
an NXN matrix. We
could make it as general as possible to save the amount of code
to complete the tasks. This also eliminates two extra structs in the
file. We could also change the structure that holds the matrix
One way could be by making a nested linked list to emulate an NXN
This way, we keep everything in memory and not on the stack. If
we could even overload the [] operator to make the functionality act
an array. We could also use the std::vector<T> data structures
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
about the
various objects in gimp. It works hand and hand with the GimpObject
class uses what I believe to be some form of tree or heap structure.
refers to add, remove, reorder, and getChild functions that are
across the
class. The gimp.h code uses the GimpContainer class pointers for
from fonts, to documents, to displays. As this data structure is
GimpObject (which controls a large amount of functionality in gimp)
referenced in the gimp.h file, optimizing this class could go a long
optimizing the code. If we decrease the amount of time to “reorder”
tree, then
we decrease the amount of time several other objects take to be
added to the tree.

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

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