| From: | |
| Date: | 20 Feb 2001 at 20:38:02 |
| Subject: | Re: Again clipping graphics output |
Hello Sensei
On 19-Feb-01, you wrote:
S>> Could you describe this more precisely? The most interesting is
S>> the fact that, according to my user bug reports, this began to
S>> happen as soon as I began to use layers library.
S> And that is why I asked you for working part of source... ;) Without it I
S> cannot check if you implemented layers correctly...
Here are some parts. This is the init procedure.
=== Cut ===
static struct Layer * PrepareLayer(struct Layer_Info * LI,
ULONG XSize,ULONG YSize)
{ struct Layer * Result=NULL;
struct BitMap * RPBitMap;
if(!(RPBitMap=AllocBitMap(XSize,YSize,8UL,0,NULL)))
return(NULL);
if(LI=NewLayerInfo())
if(Result=CreateUpfrontLayer(LI,RPBitMap,0,0,
XSize-1,YSize-1,LAYERSMART,NNULL))
{ SetDrMd(Result->rp,JAM1);
return(Result);
}
return(NULL);
}
=== Cut ===
Then I use the returned result in rendering calls. Something like:
Move(Layer->rp,x1,y1); And then dispose it.
S>> AO>>>> The problem in this case is, that I do not know, and can't
S>> AO>>>> calculate the size of future graphics.
S>> AO> hmm... I'm quite sceptical here ;-)
S>> The user draws vector graphics, and can move it on his will. Any
S>> scepticism left?
S> Partially... ;) You can "remove" all lines, curves, rectangles, ellipses,
S> text which are fully invisible and then you'll have a lot less graphics
S> to render... Things like lines etc. could be easily clipped... For
S> example, if you must render line from x0,y0 to x1,y1 you could do:
S> if( ( ( x0 < 0 ) && ( x1 < 0 ) ) || ( ( y0 < 0 ) && ( y1 < 0 ) ) || ( (
S>> = width ) && ( x1 >= width ) ) || ( ( y0 >= height ) && ( y1 >=
S> height ) ) )
S> // line is invisible. don't render. else if( ( x0 >= 0 ) && ( y0 >= 0
S> ) && ( x0 < width ) && ( y0 < height ) && ( x1 >= 0 ) && ( y1 >= 0 ) && (
S> x1 < width ) && ( y1 < height ) )
S> // line is visible. render without clipping.
S> else
S> // line is partially visible. we clip it by hand (it's always faster
S> then layers.library but it'll become a problem if you would like doing
S> things which you can do using InstallClipRegion()).
S> Do you know how to clip graphics by hand?
I have a good book, concerning this topic, but I don't want to do
it by hand.
Regards
------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://click.egroups.com/1/11231/0/_/451227/_/982704761/
---------------------------------------------------------------------_->