9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Do bitblt function codes work?
@ 1996-01-02 10:38 Amos
  0 siblings, 0 replies; 4+ messages in thread
From: Amos @ 1996-01-02 10:38 UTC (permalink / raw)


It works!  It seems that from documentation point of view, at least,
it would have been better if bitblt() were the only function which had
an Fcode parameter.

Thanks much anyway,

-- 
	Amos Shapir		Net: amos@nsof.co.il
Paper: nSOF Parallel Software, Ltd.
       Givat-Hashlosha 48800, Israel
Tel: +972 3 9388551   Fax: +972 3 9388552        GEO: 34 55 15 E / 32 05 52 N






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Do bitblt function codes work?
@ 1995-12-31 14:58 dhog
  0 siblings, 0 replies; 4+ messages in thread
From: dhog @ 1995-12-31 14:58 UTC (permalink / raw)


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).






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Do bitblt function codes work?
@ 1995-12-31 10:29 Amos
  0 siblings, 0 replies; 4+ messages in thread
From: Amos @ 1995-12-31 10:29 UTC (permalink / raw)


In your message of Thu, 21 Dec 1995 08:53:56 GMT you wrote:

> > From: nsof.co.IL!amos (Amos Shapir)

> > On a PC with vga and "out of the box" drivers, the following program
> > generates only 4 distinct images, not 16.  It seems somewhere along
> > the line to/from the bitblt server, the lower two bits of the function
> > codes get hardwired to (binary)10.

> 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).

> For related information, see the comment in /sys/src/libgnot/gsegment.c.

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?

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.

Happy new year, anyway
	Amos Shapir		Net: amos@nsof.co.il
Paper: nSOF Parallel Software, Ltd.
       Givat-Hashlosha 48800, Israel
Tel: +972 3 9388551   Fax: +972 3 9388552        GEO: 34 55 15 E / 32 05 52 N






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Do bitblt function codes work?
@ 1995-12-21 18:53 Rob
  0 siblings, 0 replies; 4+ messages in thread
From: Rob @ 1995-12-21 18:53 UTC (permalink / raw)


> From: nsof.co.IL!amos (Amos Shapir)

> On a PC with vga and "out of the box" drivers, the following program
> generates only 4 distinct images, not 16.  It seems somewhere along
> the line to/from the bitblt server, the lower two bits of the function
> codes get hardwired to (binary)10.

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).

For related information, see the comment in /sys/src/libgnot/gsegment.c.

-rob






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-01-02 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-01-02 10:38 Do bitblt function codes work? Amos
  -- strict thread matches above, loose matches on Subject: below --
1995-12-31 14:58 dhog
1995-12-31 10:29 Amos
1995-12-21 18:53 Rob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).