[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11919] trunk/blender/source/blender/imbuf /intern/divers.c: Bugfix #7125

Martin Poirier theeth at yahoo.com
Sun Sep 2 19:09:33 CEST 2007


You can probably use that too:

#define FTOCHAR(val) val<=0.0f?0: (val>(1.0f - 0.5f /
255.0f)?255: (char)(255.0f*val))

Multiplying by 255.99 will give values 1 higher than
they should be for float values > 0.5. (I dealt with a
similar issue at work, that's more or less what we
used).

Martin

--- Ton Roosendaal <ton at blender.org> wrote:

> Revision: 11919
>          
>
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11919
> Author:   ton
> Date:     2007-09-02 18:34:02 +0200 (Sun, 02 Sep
> 2007)
> 
> Log Message:
> -----------
> Bugfix #7125
> 
> The conversion from float to char (byte) was not
> correct. It should include
> the possibility for colors like 0.999999 to become
> 255 still. The correct
> multiplication factor I don't know though... and
> this should become a system
> wide definition!
> 
> Modified Paths:
> --------------
>    
> trunk/blender/source/blender/imbuf/intern/divers.c
> 
> Modified:
> trunk/blender/source/blender/imbuf/intern/divers.c
>
===================================================================
> ---
> trunk/blender/source/blender/imbuf/intern/divers.c
> 2007-09-02 15:55:43 UTC (rev 11918)
> +++
> trunk/blender/source/blender/imbuf/intern/divers.c
> 2007-09-02 16:34:02 UTC (rev 11919)
> @@ -174,7 +174,7 @@
>  	}
>  }
>  
> -#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255:
> (char)(255.0f*val))
> +#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255:
> (char)(255.99f*val))
>  
>  void IMB_rect_from_float(struct ImBuf *ibuf)
>  {
> 
> 
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
>
http://lists.blender.org/mailman/listinfo/bf-blender-cvs
> 



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  


More information about the Bf-committers mailing list