delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/10/10:45:48

Date: Fri, 10 Oct 1997 10:29:50 -0400 (EDT)
Message-Id: <199710101429.KAA23527@delorie.com>
To: <pete AT duchess DOT compulink DOT co DOT uk>
From: Alexander Bokovoy <bokovoy AT bspu DOT ac DOT by>
Cc: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: copying memory buffer to screen - help
In-Reply-To: <876472720.3425.0.nnrp-04.9e9889d0@news.demon.co.uk>
References: <876472720 DOT 3425 DOT 0 DOT nnrp-04 DOT 9e9889d0 AT news DOT demon DOT co DOT uk>
MIME-Version: 1.0

On Fri, 10 Oct 1997 16:44:56 GMT pete AT duchess DOT compulink DOT co DOT uk wrote:

> I'm using the grx library, and I'm in 800
> *600*256 colour mode. I've set the pallette to greyscales. No problem.
> I have an array in which I have an inage, 1 byte per pixel, in 320*200
> format. How can I put this on the screne at an arbitrary point (not
> pixel by pixel!).
> 
> 
You'll need to create a device context in memory, transfer your image
into it and BLIT image from memory context to screen context.
Example:
{
/* Create a device context in memory */
GrContext *image = GrCreateContext(320,200,NULL,NULL);
/* Section I. */
/* Save current context handle */
GrContext *OldContext = GrCurrentContext();
/* and set current context to our image */
GrSetContext(image);
/* Now drawing pixels on the context */   
for(int y=0;y<200;y++)
   for(int x=0;x<320;x++) GrPlot(x,y,your_image_data[x][y]);
/*   
   A section I. work only one time - when we initialize context with
   image data
*/      
/* Section II. */
/* Restore old context */
GrSetContext(OldContext);
/* BLIT image from  memory to screen context at an arbitrary position */
/*          destination               point coordinates    source     */
GrBitBlt(GrScreenContext(),your_position_x,your_position_y,image, 
/*    coordinates of copying rectangle   logic operation              */
         0,0, 319, 199,                   GrWRITE);
/* Now all is done */
}
Alexander Bokovoy, <bokovoy AT bspu DOT ac DOT by>
---== The Soft Age coming soon ==---

- Raw text -


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