home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 2000 April & May / AMIGA_2000_04.iso / patches / mesa3.1 / mesa-3_1.lha / src / AOS / natDisplay / natPixelG.c < prev    next >
Encoding:
Text File  |  1999-07-16  |  2.4 KB  |  69 lines

  1. /*
  2.  * $Id: $
  3.  */
  4.  
  5. /*
  6.  * Mesa 3-D graphics library
  7.  * Version:  3.1
  8.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Library General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18.  * Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public
  21.  * License along with this library; if not, write to the Free
  22.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. /**********************************************************************/
  26. /*****        write arrays of RGBA pixels                         *****/
  27. /**********************************************************************/
  28.  
  29. void natGWriteRGBAPixel(const GLcontext * ctx, GLuint n, const GLint x[], const GLint y[],
  30.             CONST GLubyte rgba[][4], const GLubyte mask[])
  31. {
  32.   amigaMesaContext amesa;
  33.   struct RastPort *rp;
  34.  
  35.   amesa = (amigaMesaContext) ctx->DriverCtx;
  36.   rp = amesa->rp;
  37.  
  38.   DEBUGOUT(1, "natGWriteRGBAPixel(%d)\n", n);
  39.  
  40.   for (--(GLshort)n; (GLshort)n >= 0; (GLshort)n--, RGBAi++, Xx++, Yy++) {
  41.     if (*mask++) {
  42.       /* write pixel x[i], y[i] using rgba[i][0],rgba[i][1],rgba[i][2],rgba[i][3] */
  43.       SetAPen(rp, PLG_RGBA(amesa, *RGBAb0, *RGBAb1, *RGBAb2));
  44.       DEBUGOUT(9, "  WritePixel(%d, %d)\n", FIXx(*Xx), FIXy(*Yy));
  45.       WritePixel(rp, FIXx(*Xx), FIXy(*Yy));
  46.     }
  47.   }
  48. }
  49.  
  50. /**********************************************************************/
  51. /*****        write arrays of RGBA pixels doublebuffered          *****/
  52. /**********************************************************************/
  53.  
  54. void natGWriteRGBAPixelDB(const GLcontext * ctx, GLuint n, const GLint x[], const GLint y[],
  55.               CONST GLubyte rgba[][4], const GLubyte mask[])
  56. {
  57.   amigaMesaContext amesa;
  58.   GLubyte *db;
  59.  
  60.   amesa = (amigaMesaContext) ctx->DriverCtx;
  61.   db = dbPenGet(amesa);
  62.  
  63.   DEBUGOUT(1, "natGWriteRGBAPixelDB(%d)\n", n);
  64.  
  65.   for (--(GLshort)n; (GLshort)n >= 0; (GLshort)n--, RGBAi++, Xx++, Yy++)
  66.     if (*mask++)
  67.       *(dbPen(db, *Xx, *Yy)) = PLG_RGBA(amesa, *RGBAb0, *RGBAb1, *RGBAb2);
  68. }
  69.