Kismet

Patrick Julien freak at codepimps.org
Mon Mar 8 12:29:43 CET 2004


On March 8, 2004 06:18 am, Boudewijn Rempt wrote:
> On Monday 08 March 2004 12:14, Patrick Julien wrote:
> > This is interesting.  If I may, a few suggestions.
> >
> > I believe the intent here is to set this information so that it is
> > constant. Consider removing every setter and data from KisImageType.
>
> Yes, I was considering that. The main intention was to get rid of all the
> enums in kis_global, especially the enums have corresponding methods, like
> imgTypeBlaFunction()...

I don't think your goal should be to remove the enumeration, but peaceful 
coexistence.  For widgets, you probably want a mediator to fill in a 
list/icon/whatever item the send it off.  The key for the result can be this 
simple enumeration that you match back to the originating object.

Also, now that I see more clearly what you are doing, you should make your 
image types flyweights.  Now that I think about it even more, you should 
probably add these members to the color space strategies.

Your KisImageType class now becomes a small class adapter for a colorspace 
strategy.  From what I understand from KisAbstractCapability, you want to use 
these from the GUI.  If that is the case, you may want to stay away from 
actually putting data and restrictions on constructor parameters and have 
this be a pure interface.

You don't need to explicitly define the assignment operator either.

>
> > Then create a new type that inherits from KisImageType that is basically
> > exactly what KisImageType is today.
>
> The start of that is KisImageTypeRGBA -- I was hesitating beween having
> very specialized types (RGBA _and_ RGB), or slightly less specialized
> types.
>

There is slight difference here, the common implementation also happens to be 
the class you are returning from the mediator.  Here, this is no longer true.  
The common implementation is now a hidden middle class.

> > The difference is that you are still returning KisImageType from the
> > mediator, however, you no longer have any setters nor do you have any
> > data, you are returning a narrow interface.


More information about the kimageshop mailing list