Mail Archives: djgpp/1997/10/10/10:45:48
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 -