From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sun, 31 Dec 1995 09:58:01 -0500 From: dhog@plan9.cs.su.oz.au dhog@plan9.cs.su.oz.au Subject: Do bitblt function codes work? Topicbox-Message-UUID: 39b86488-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19951231145801.H9MQClurukN2PRaH5CJY92Dw6bttsLkhpQbkn2sJk2Q@z> amos@nsof.co.il (Amos Shapir) writes: >> This is correct behavior. Since you're drawing the line with code >> segment(d, Pt(mid.x, r.min.y), Pt(mid.x, r.max.y), ~0, t); >> using drawing function 0<=t<=15, you might expect 16 different >> results. But since the source function is the constant ~0, not a general >> value, symmetries fold up and the number of results is reduced. >> The possible answers are 0->0, 0->1, 1->0, and 1->1. It is not >> the full matrix of possibilities because the source is a single value (1). > >I have read this comment, and gather that this behavior is a feature; >but I still can't see the rationale behind it. How can the "value" >parameter be anything but a constant? It can be any constant you like. >I tried all values, and I still can't find any combination that ANDs >the pixel values of two bitmaps; e.g. in the given example, draw just >the part of the segment which falls within the disc. That's because segment() just draws a line. It doesn't ``draw a bitmap''. What you should be doing is drawing the line and the disc into separate bitmaps (the screen can be one of them) and using bitblt() to combine them. Try changing your code thus: 25,26c25,27 < segment(d, Pt(mid.x, r.min.y), Pt(mid.x, r.max.y), ~0, t); < bitblt(&screen, r.min, d, r, S); --- > bitblt(&screen, r.min, &screen, r, Zero); /* clear screen */ > segment(&screen, Pt(mid.x, r.min.y), Pt(mid.x, r.max.y), ~0, S); > bitblt(&screen, r.min, d, r, t); You should now see 16 distinct images, including the one you're after (at t == D&S).