Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rohde

OO Design of an application.

This topic is 5573 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I''m in the middle of implementing an image processing application in C#. I''m almost done with all the boring GUI stuff and ready to get started with the real nifty processing stuff I''ve been thinking about how to design the stuff and come up with: 1. Make some classes e.g. an Filter class whith some static functions. Pros: Easy to implement. Cons: Not vey felxible if user want to make his own filters; further it''s hardly very OO. 2. Make some classes e.g. a Filter class which user instantiates and initialize to either some predefined filters or some filters of own invention. Pros: Way more flexible. Cons: Way more complex to implement. Anyway, some ideas/comments for this? And no, it''s not an assignment or some such...this is just for fun!!! -+-+-+-+-+-+-+-+-+-+-+-+-+-+- Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.

Share this post


Link to post
Share on other sites
Advertisement
How about creating a Filter base class with some basic functionality that other filters could derive from? I''m not sure what kind of image processing you''re talking about, but I''ll assume you mean some kind of Photoshop filter FX. I''m just making this up as I go, but something like:


class Filter
{
public:
Filter(void *mem); // pointer to image data
~Filter();

// the actual processing of image data (pure virtual)
virtual bool Process()=0;
protected:
...
};


Then you could have maybe a swirl filter.


class swirlFilter : public Filter
{
public:
swirlFilter(void *mem);
~swirlFilter();

virtual bool Process();

DWORD CalcDataPoint(int x, int y) // ???

protected:
...
};


Then you can build a set of derived filters, like ones that deal with color manipulation, others that distort, whatever. Then you could derive from those again if you wanted. Just some ideas.

Share this post


Link to post
Share on other sites
How about scanning a filters subdirectory for dlls at runtime, then reflecting on those searching for classes implementing an IFilter interface? You could even throw in some attributes so the filters can describe themselves...:


[FilterAuthor("Arild"),
FilterName("Really cool filter"),
FilterDescription("This filter bovinizes pictures")
]
public class Filter : IFilter
{
//..

}




AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!