[interfacekit] Re: BRegion (was Re: Clipping - ...)

> Mh, dunno. Though I don't know if I have time to have a look soon... I'm 
> going to marry my
> girlfriend the 24 of april (this week :P). So now you all know. This is a 
> sort of an official
> announcement :P

Congratulations! What else can I say? Marriage... sc->IntersectWith(gf), 
exclusivity...

ah, that reminds me of the bug...

> Can you show a screenshot with the different outputs with my implementation 
> and BeOS one ?

That's like seeing through the matrix...

The code:

{
        BRect A(0, 0, 399, 49);
        BRect B(0, 50, 47, 100);
        BRect C(0, 101, 399, 299);
        
        //X and Y are different
        BRect X(99,  50, 399, 100);
        BRect Y(100, 50, 399, 100);
        
        BRegion r1;
        BRegion r2;
        
        r1.Include(A);
        r1.Include(X);  //different
        r1.Include(B);
        r1.Include(C);
        
        r2.Include(A);
        r2.Include(Y);  //different
        r2.Include(B);
        r2.Include(C);
        
        fprintf(stderr, "r1: verify that X doesn't overlap A, B, or C.\n");
        r1.PrintToStream();
        fprintf(stderr, "\n\n\n");

        fprintf(stderr, "r2: verify that Y doesn't overlap A, B, or C.\n");
        r2.PrintToStream();
        fprintf(stderr, "\n\n\n");

        fprintf(stderr, "r1 - r2: the output should be same as X - Y.\n");
        BRegion exclusion_test;
        exclusion_test = r1;
        exclusion_test.Exclude(&r2);
        exclusion_test.PrintToStream();
        fprintf(stderr, "\n\n\n");

        fprintf(stderr, "X - Y: is not the empty set.\n");
        BRegion foo;
        foo.Include(X);
        foo.Exclude(Y);
        foo.PrintToStream();
}


The output:

r1: verify that X doesn't overlap A, B, or C.
BRect(l:0.0, t:0.0, r:399.0, b:299.0)
data = BRect(l:0.0, t:0.0, r:399.0, b:49.0)
data = BRect(l:0.0, t:50.0, r:47.0, b:100.0)
data = BRect(l:99.0, t:50.0, r:399.0, b:100.0)
data = BRect(l:0.0, t:101.0, r:399.0, b:299.0)



r2: verify that Y doesn't overlap A, B, or C.
BRect(l:0.0, t:0.0, r:399.0, b:299.0)
data = BRect(l:0.0, t:0.0, r:399.0, b:49.0)
data = BRect(l:0.0, t:50.0, r:47.0, b:100.0)
data = BRect(l:100.0, t:50.0, r:399.0, b:100.0)
data = BRect(l:0.0, t:101.0, r:399.0, b:299.0)



r1 - r2: the output should be same as X - Y.
BRect(l:2147483648.0, t:2147483648.0, r:-2147483648.0, b:-2147483648.0)



X - Y: is not the empty set.
BRect(l:99.0, t:50.0, r:99.0, b:100.0)
data = BRect(l:99.0, t:50.0, r:99.0, b:100.0)


What? Still reading??!! Isn't there something a little more important?

Cheers,
Paul.



        
                
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

Other related posts: