Substrate implementation proposal

Boudewijn Rempt boud at valdyas.org
Tue Apr 4 14:51:01 CEST 2006


On Tue, 4 Apr 2006, Bart Coppens wrote:

> On Tuesday 04 April 2006 14:12, Boudewijn Rempt wrote:
> > > getPixel()
> > > {
> > >   switch(datatype)
> > >      case tiled
> > >         tilemanager->getpixel(x,y)
> > >      case pattern
> > >         pattern->getPixel(x%size, y%size)
> > >     case function
> > >        function->getPixel(x,y)
> > > }
> Good idea!

Of course, the oo-way of doing this would be to define an interface and then implement
the various strategies as subclasses, which means we're almost back where we were :-).


> > Hmm... That would be possible, and we could add a writePixel as well.
> Cool idea too! And it wouldn't be so hard to get it working even with function 
> and pattern, I think.
> 
> One small thing, with me being the one who likes to break down good ideas ;-): 
> Don't forget that I'm still planning to change the getPixel basics a bit in 
> the tilemanager, because of the swapping and mmapping. That might need to see 
> a few small changes to your plan (like let getPixel not return a pointer, but 
> let it also write to a user-preallocated piece of memory). Nothing serious, 
> though.
> 

Sure -- and one pixel is small enough to do by value, I think.

Boudewijn


More information about the kimageshop mailing list