Example #1
0
 /// <summary>
 /// Performs a color math operation by applying the values of an RGB pixel array to another.
 /// The result is drawn over a specified destination pixel array, ignoring transparent pixels.
 /// All arrays must be the same size.
 /// </summary>
 /// <param name="src">The pixels to apply to the operand array.</param>
 /// <param name="operand">The RGB pixel array to perform the operation on.
 /// The original referenced array is not modified during the operation.</param>
 /// <param name="dst">The RGB pixel array draw the result over.</param>
 /// <param name="width">The width, in pixels, of the pixel maps.</param>
 /// <param name="height">The height, in pixels, of the pixel maps.</param>
 /// <param name="halfIntensity">Indicates whether to add the pixels at half their RGB value.</param>
 /// <param name="minusSubscreen">Indicates whether to subtract the pixels instead of adding them.</param>
 public static void ColorMath(int[] src, int[] operand, int[] dst, int width, int height, bool halfIntensity, bool minusSubscreen)
 {
     if (src == null || operand == null || dst == null)
     {
         return;
     }
     int[] pixels = Bits.Copy(operand);
     // Apply subscreen to priority layer pixels using color math
     Do.ColorMath(src, pixels, width, height, halfIntensity, minusSubscreen);
     // Draw color math result to this instance's RGB pixel array
     Do.PixelsToPixels(pixels, dst, true);
 }
Example #2
0
 /// <summary>
 /// Performs a color math operation by applying the values of an RGB pixel array to another.
 /// Both arrays must be the same size.
 /// </summary>
 /// <param name="src">The pixels to apply to the destination array.</param>
 /// <param name="dst">The RGB pixel array to perform the operation on.</param>
 /// <param name="width">The width, in pixels, of the pixel maps.</param>
 /// <param name="height">The height, in pixels, of the pixel maps.</param>
 /// <param name="halfIntensity">Indicates whether to add the pixels at half their RGB value.</param>
 /// <param name="minusSubscreen">Indicates whether to subtract the pixels instead of adding them.</param>
 public static void ColorMath(int[] src, int[] dst, int width, int height, bool halfIntensity, bool minusSubscreen)
 {
     if (src == null || dst == null)
     {
         return;
     }
     for (int y = 0; y < height; y++)
     {
         for (int x = 0; x < width; x++)
         {
             if (src[y * width + x] != 0 && dst[y * width + x] != 0)
             {
                 dst[y * width + x] = Do.ColorMath(dst[y * width + x], src[y * width + x], halfIntensity, minusSubscreen);
             }
         }
     }
 }