Board index » delphi » Couple of questions - (Graphics)

Couple of questions - (Graphics)

In article F...@exeter.ac.uk, st93...@exeter.ac.uk (S.J.Walke) writes:

Quote
>Hi all,

>    I have a couple of queries regarding graphics in BP7(DOS).  I have seen
>many people write in to this group with hints on writing directly to video
>memory, using the Mem[] arrays and the VGA segment.  I use 640x480 VGA
>16 colour mode a lot and cannot seem to find the correct use of this approach.

>Could someone please tell me how to write a pixel, with colour defined by byte
>b, to the VGA memory so that it appears at position (X,Y) in 640x480 mode ??

I've only done this in text mode so can't help you out here.

Quote
>Question 2)

>    Does anyone know how GetImage stores images?  I've been wading through
>memory dumps to try and work it out, but can't see a pattern.  I assume the
>data is compressed, since grabbing the image of an (m x n) part of the screen
>results in an ImageSize value of (m x n) / 2 bytes.  In 16-colour mode I would
>normally assume this is because two colours can be packed into a single byte,
>but the memory contents I've seen do not seem to coincide with this.

I can't remember for sure, but the image may be stored in bit plane format,
which would account for your lack of success.  Also the width and height of  
the image are stored in reverse order to what the manual says (I think!)

Sorry I can't be more helpful, long time since I have worked on this, and I think
I decided it wasn't  worth the effort.

HTH

Ray Cramer
R...@pol.ac.uk

 

Re:Couple of questions - (Graphics)


In article <Dnuotn....@exeter.ac.uk>, st93...@exeter.ac.uk (S.J.Walke) says:

Quote
>    I have a couple of queries regarding graphics in BP7(DOS).  I have seen
>many people write in to this group with hints on writing directly to video
>memory, using the Mem[] arrays and the VGA segment.  I use 640x480 VGA
>16 colour mode a lot and cannot seem to find the correct use of this approach.

     VGA memory is planar and not linear.  If you think about it 640*480/2
is much greater than 64k.  Well, a standard VGA has 256k of memory that
maps itself into a 64k segment.  It sticks the memory into 4 "planes", where
only one plane of memory is mapped to $A000000 at a time to flip planes
you have to modify one of the VGA registers via port, although I forgot
which one.
     In 640x480x16, each byte of memory in $A000000 addresses 8 pixels.
Thus location (32,0) is the high bit of byte $A0000004.  But the color
(represented by 4 bits) is distributed through all four planes (one plane
per bit).
     My advice is to get a good tutorial on "Write Mode 2" which is what
you would use for 16 color graphics.

Quote
>    Does anyone know how GetImage stores images?  I've been wading through
>memory dumps to try and work it out, but can't see a pattern.  I assume the
>data is compressed, since grabbing the image of an (m x n) part of the screen
>results in an ImageSize value of (m x n) / 2 bytes.  In 16-colour mode I would
>normally assume this is because two colours can be packed into a single byte,
>but the memory contents I've seen do not seem to coincide with this.

The first two words contain the horizontal and vertical size of the image
in pixels.  The next word is reserved.  What follows is the binary data.

Other Threads