9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Anant Narayanan <anant@kix.in>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: [9fans] Some libdraw help
Date: Fri,  8 Jun 2007 20:49:16 +0530	[thread overview]
Message-ID: <46697374.1020507@kix.in> (raw)

Hi All,

I'm a little new to libdraw and need some advice on drawing bitmap data
 onto a window.

I have with me some bitmap data on memory, the address of the first byte
is known. I also know the width of the bitmap data and the total number
of scanlines in it. The number of pixels in each scanline is rounded up
so that each scanline is word-aligned.

I also know the depth, i.e. the number of bits in a pixel. The color
arrangement per pixel depends on the depth. In the case of a 32-bit
depth, the 8 most significant bits are to be ignored, the next 8 bits
represent the red, the next 8 green and the next 8 blue. For a 16 bit
depth, the most significant bit is ignored and the next 15 bits are for
red, green and blue respectively. So on for 8, 4, 2 and 1-bit depths.

The byte order of the data is the same as that of the host CPU.

Finally, I have with me the co-ordinates of a "mask rectangle", i.e. the
portion of the bitmap that needs to updated on the screen. Consequently,
the first time my function is called, the mask rectangle will be the
entire window size; but later calls will contain mask rectangle
co-ordinates for portions of the screen that need updating.

Now for the questions :)

1) What is the best way to draw this bitmap data onto the screen? Note
that the bitmap data on memory will not stick around, I have to copy it.
 I had a look at the Memimage set of methods, but am not sure that it's
the best way to go about it.

2) Do I have to worry about endianness?

3) A general question (un-related to the description above): How can I
create a "full-screen" window? "full-screen" means the application has
the undivided attention of the user, like many games run in other
operating systems. This is different from just resizing the window to
the size of the screen because the window border would still be visible
in this case :)

Help would be most appreciated!

Thank you,

Regards,
--
Anant


             reply	other threads:[~2007-06-08 15:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 15:19 Anant Narayanan [this message]
2007-06-08 15:37 ` andrey mirtchovski
2007-06-08 15:40   ` andrey mirtchovski
2007-06-08 15:37 ` Christian Kellermann

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=46697374.1020507@kix.in \
    --to=anant@kix.in \
    --cc=9fans@cse.psu.edu \
    /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).