9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dhog@plan9.cs.su.oz.au dhog@plan9.cs.su.oz.au
Subject: Do bitblt function codes work?
Date: Sun, 31 Dec 1995 09:58:01 -0500	[thread overview]
Message-ID: <19951231145801.H9MQClurukN2PRaH5CJY92Dw6bttsLkhpQbkn2sJk2Q@z> (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).






             reply	other threads:[~1995-12-31 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-31 14:58 dhog [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-01-02 10:38 Amos
1995-12-31 10:29 Amos
1995-12-21 18:53 Rob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19951231145801.H9MQClurukN2PRaH5CJY92Dw6bttsLkhpQbkn2sJk2Q@z \
    --to=dhog@plan9.cs.su.oz.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).