www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/13/11:12:40

From: Hartmut Schirmer <hsc AT techfak DOT uni-kiel DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GRX
Date: Mon, 13 Jan 1997 09:32:50 +0100
Organization: Technische Fakultaet, University of Kiel, Germany
Lines: 35
Message-ID: <32D9F332.715E@techfak.uni-kiel.de>
References: <5b8icg$ma7 AT news DOT interlog DOT com>
NNTP-Posting-Host: zora.techfak.uni-kiel.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> All I want is to get an image from X,Y with a width (W) and height (H)
> and a pointer to a buffer (void *buffer).  This is what I know
> in Turbo C.

  GrContext ic;
  char *memory[4]; /* 4 is magic */
  int planes, planesze, i;

  planes = GrNumPlanes();
  planesze = GrPlaneSize(width, height);
  for (i=0; i < planes; ++i)
    memory[i] = malloc(planesze);
  while (i<4) memory[i++] = NULL;
  GrCreateContext(width, height, memory, &ic);
  GrBitBlt(&ic, 0, 0, NULL, left, low, right, top, GrWRITE);

Now the memory context ic holds a copy of the screen area selected.
Put it back to screen is easy:

  GrBitBlt(NULL, left, low, &ic, 0, 0, ic.gc_xmax, ic.gc_ymax, GrWRITE);

I didn't check the code above, just copied it from BCC2GRX
getimage()/putimage() functions. See 

  http://www.techfak.uni-kiel.de/~hsc/BCC2GRX/

or any DJGPP mirror site form BCC2GRX zip archive

Hartmut
-- 
Hartmut Schirmer                   | Phone: +49-431-77572-709  FAX:-703
Automatisierungs- & Regelungstech. | hsc AT techfak DOT uni-kiel DOT de
Technische Fakult"at,              | http://www.techfak.uni-kiel.de/~hsc
Kaiserstr. 2, 24143 Kiel, Germany  | PGP key via WWW, Key ID:6D84AEC1

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019