paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/draw gradient.cpp,1.3.6.4,1.3.6.5


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw gradient.cpp,1.3.6.4,1.3.6.5
Date: Sat, 29 Mar 2003 16:26:43 -0500

Update of /cvsroot/paragui/paragui/src/draw
In directory subversions:/tmp/cvs-serv31476/src/draw

Modified Files:
      Tag: devel-1-0
        gradient.cpp 
Log Message:
fixed PG_WidgetList::Remove(All) methods (Thanks Ivan Stankovic 
<address@hidden>)



Index: gradient.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/gradient.cpp,v
retrieving revision 1.3.6.4
retrieving revision 1.3.6.5
diff -C2 -r1.3.6.4 -r1.3.6.5
*** gradient.cpp        22 Nov 2002 17:58:43 -0000      1.3.6.4
--- gradient.cpp        29 Mar 2003 21:26:40 -0000      1.3.6.5
***************
*** 30,33 ****
--- 30,34 ----
  
  #include "pgdraw.h"
+ #include "pglog.h"
  
  #include <cmath>
***************
*** 67,70 ****
--- 68,83 ----
  }
  
+ static const Sint32 DitherMatrix4[4][4] = {
+      1/*(0/16.)*256*/,  (16./8.)*256,  (16./2.)*256, (16./10.)*256,
+     (16./12.)*256,  (16./4.)*256, (16./14.)*256,  (16./6.)*256,
+      (16./3.)*256, (16./11.)*256,  (16./1.)*256,  (16./9.)*256,
+     (16./15.)*256,  (16./7.)*256, (16./13.)*256,  (16./5.)*256
+ };
+ 
+ static const float DitherMatrix2[2][2] = {
+      0/16.,  8/16.,
+     12/16.,  4/16.,
+ };
+ 
  void PG_Draw::DrawGradient(SDL_Surface * surface, const PG_Rect& rect, const 
SDL_Color & ul, const SDL_Color & ur, const SDL_Color & dl, const SDL_Color & 
dr) {
        Sint32 v00,v01,v02;
***************
*** 153,156 ****
--- 166,174 ----
        Uint32 y_pitch = pitch*drawrect.h - bpp;
        register Uint32 pixel = 0;
+       
+       Sint32 mx;
+       Sint32 my;
+       Sint32 conv = ((bpp*8)*256 / 255*256);
+       Sint32 rd,gd,bd;
  
        for (register Sint32 x = 0; x < drawrect.w; x++) {
***************
*** 177,183 ****
  
                                case 2:
!                                       pixel =  (r>>Rloss) << Rshift
!                                                          | (g>>Gloss) << 
Gshift
!                                                          | (b>>Bloss) << 
Bshift;
  
                                        *((Uint16 *) (bits)) = (Uint16) pixel;
--- 195,209 ----
  
                                case 2:
!                                       mx = x & 3;
!                                       my = y & 3;
!                                       //PG_LogMSG("mx: %i, my: %i", mx, my);
!                                       rd = ((r / conv) + 
DitherMatrix4[my][mx]) * conv;
!                                       gd = ((g / conv) + 
DitherMatrix4[my][mx]) * conv;
!                                       bd = ((b / conv) + 
DitherMatrix4[my][mx]) * conv;
!                                       //PG_LogMSG("rd: %i, gd: %i, bd: %i", 
rd, gd, bd);
! 
!                                       pixel =  (rd>>Rloss) << Rshift
!                                                          | (gd>>Gloss) << 
Gshift
!                                                          | (bd>>Bloss) << 
Bshift;
  
                                        *((Uint16 *) (bits)) = (Uint16) pixel;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]