Example #1
0
        public void blend_hline(int x1, int y, int x2, ColorF sourceColor, byte cover)
        {
            if (sourceColor.alpha != 0)
            {
                int len = x2 - x1 + 1;

                int     bufferOffset;
                float[] buffer = GetPixelPointerXY(x1, y, out bufferOffset);

                float alpha = sourceColor.alpha * (cover * (1.0f / 255.0f));
                if (alpha == 1)
                {
                    m_Blender.CopyPixels(buffer, bufferOffset, sourceColor, len);
                }
                else
                {
                    do
                    {
                        m_Blender.BlendPixel(buffer, bufferOffset, new ColorF(sourceColor.red, sourceColor.green, sourceColor.blue, alpha));
                        bufferOffset += m_DistanceInFloatsBetweenPixelsInclusive;
                    }while (--len != 0);
                }
            }
        }
Example #2
0
        public static void BasedOnAlpha(IRecieveBlenderFloat Blender, float[] destBuffer, int bufferOffset, ColorF sourceColor)
        {
            //if (sourceColor.m_A != 0)
            {
#if false // we blend regardless of the alpha so that we can get Light Opacity working (used this way we have additive and faster blending in one blender) LBB
                if (sourceColor.m_A == base_mask)
                {
                    Blender.CopyPixel(pDestBuffer, sourceColor);
                }
                else
#endif
                {
                    Blender.BlendPixel(destBuffer, bufferOffset, sourceColor);
                }
            }
        }
Example #3
0
        public static void BasedOnAlphaAndCover(IRecieveBlenderFloat Blender, float[] destBuffer, int bufferOffset, RGBA_Floats sourceColor, int cover)
        {
            if (cover == 255)
            {
                BasedOnAlpha(Blender, destBuffer, bufferOffset, sourceColor);
            }
            else
            {
                //if (sourceColor.m_A != 0)
                {
                    sourceColor.alpha = sourceColor.alpha * ((float)cover * (1 / 255));
#if false // we blend regardless of the alpha so that we can get Light Opacity working (used this way we have addative and faster blending in one blender) LBB
                    if (sourceColor.m_A == base_mask)
                    {
                        Blender.CopyPixel(pDestBuffer, sourceColor);
                    }
                    else
#endif
                    {
                        Blender.BlendPixel(destBuffer, bufferOffset, sourceColor);
                    }
                }
            }
        }
Example #4
0
		public static void BasedOnAlphaAndCover(IRecieveBlenderFloat Blender, float[] destBuffer, int bufferOffset, RGBA_Floats sourceColor, int cover)
		{
			if (cover == 255)
			{
				BasedOnAlpha(Blender, destBuffer, bufferOffset, sourceColor);
			}
			else
			{
				//if (sourceColor.m_A != 0)
				{
					sourceColor.alpha = sourceColor.alpha * ((float)cover * (1 / 255));
#if false // we blend regardless of the alpha so that we can get Light Opacity working (used this way we have additive and faster blending in one blender) LBB
                    if (sourceColor.m_A == base_mask)
                    {
                        Blender.CopyPixel(pDestBuffer, sourceColor);
                    }
                    else
#endif
					{
						Blender.BlendPixel(destBuffer, bufferOffset, sourceColor);
					}
				}
			}
		}