www.delorie.com/gnu/docs/xaos/xaos_26.html   search  
 
Buy GNU books!


An fast realtime interactive fractal zoomer

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3.4 Conversion

Convertup and convertdown functions are used for converting screen coordinates to possition in fractal and back. Convertup is function that receives coordinates in chield's image and is expected to convert them into coordinates in parents image and call parent's convertup function.

Convertdown is reversed(from parent to child).

In case coordinates respond 1:1 you should use convertupgeneric and convertdowngeneric. In other case implementation should look like:

 
static void convertup(struct filter *f,int *x,int *y)
{
    *y*=2;
    *x*=2;
    if(f->next!=NULL) f->next->action->convertup(f->next,x,y);
}
static void convertdown(struct filter *f,int *x,int *y)
{
    *y/=2;
    *x/=2;
    if(f->previous!=NULL) f->previous->action->convertdown(f->previous,x,y);
}


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003