[Mono-devel-list] Re: S.D.gdiplus implementation

Miguel de Icaza miguel at ximian.com
Wed Jan 28 02:37:44 EST 2004


Hello,

> Recently, there was a discussion among us on IRC. Thanks to Peter for
> providing us lots of useful information. We had a common opinion that
> current gdiplus implementation in S.D is not clean and it might become
> difficult to maintain as it will grow. So, we all thought that it would
> be better to use Object-oriented C approach instead, where we can have
> class like structure. We can do something similar to inheritance, e.g.,
> struct typedef {int Brushtype;} GpBrush;
> struct typedef {GpBrush* brush; int color;} GpSolidBrush;
> It would result in code changes but existing code is not too big to
> modify. So, that should not be an issue.
> Now, there might be other issues like implementing virtual functions or
> something else. I don't know, if this approach could lead to any severe
> problems. 
> 
> Any thoughts?

The idea in general seems pretty sensible.

I do not believe that we need a very complex OO implementation, so
something like:

struct BrushClass {
	void (*init) ();
	void (*paint) ();
}

struct Brush {
	BrushClass *vtable;
	
}

struct MyBrush {
	Brush base;
	int v;
}

Brush *miggy_brush_init ()
{
	MyBrush *m = g_new0 (MyBrush, 1);
	m->base.vtable.init = miggy_init;
	m->base.vtable.paint = miggy_paint.
	m->v = 1;

	return m;
}

Would do it, without going into the more elaborate and complete set
that Gtk+ has.

Miguel.



More information about the Mono-devel-list mailing list