Package ej.microvg

Enum BlendMode

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DST_IN
      Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.
      DST_OUT
      Keeps the destination pixels that are not covered by source pixels.
      DST_OVER
      The source pixels are drawn behind the destination pixels.
      MULTIPLY
      Multiplies the source and destination pixels.
      PLUS
      Adds the source pixels to the destination pixels and saturates the result.
      SCREEN
      Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.
      SRC
      The source pixels replace the destination pixels.
      SRC_IN
      Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.
      SRC_OVER
      The source pixels are drawn over the destination pixels.
    • Enum Constant Detail

      • SRC

        public static final BlendMode SRC
        The source pixels replace the destination pixels.

        \(\alpha_{out} = \alpha_{src}\)

        \(C_{out} = C_{src}\)

      • SRC_OVER

        public static final BlendMode SRC_OVER
        The source pixels are drawn over the destination pixels.

        \(\alpha_{out} = \alpha_{src} + (1 - \alpha_{src}) * \alpha_{dst}\)

        \(C_{out} = C_{src} + (1 - \alpha_{src}) * C_{dst}\)

      • DST_OVER

        public static final BlendMode DST_OVER
        The source pixels are drawn behind the destination pixels.

        \(\alpha_{out} = \alpha_{dst} + (1 - \alpha_{dst}) * \alpha_{src}\)

        \(C_{out} = C_{dst} + (1 - \alpha_{dst}) * C_{src}\)

      • SRC_IN

        public static final BlendMode SRC_IN
        Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.

        \(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)

        \(C_{out} = C_{src} * \alpha_{dst}\)

      • DST_IN

        public static final BlendMode DST_IN
        Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.

        \(\alpha_{out} = \alpha_{src} * \alpha_{dst}\)

        \(C_{out} = C_{dst} * \alpha_{src}\)

      • DST_OUT

        public static final BlendMode DST_OUT
        Keeps the destination pixels that are not covered by source pixels. Discards destination pixels that are covered by source pixels. Discards all source pixels.

        \(\alpha_{out} = (1 - \alpha_{src}) * \alpha_{dst}\)

        \(C_{out} = (1 - \alpha_{src}) * C_{dst}\)

      • PLUS

        public static final BlendMode PLUS
        Adds the source pixels to the destination pixels and saturates the result.

        \(\alpha_{out} = max(0, min(\alpha_{src} + \alpha_{dst}, 1))\)

        \(C_{out} = max(0, min(C_{src} + C_{dst}, 1))\)

      • SCREEN

        public static final BlendMode SCREEN
        Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.

        \(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)

        \(C_{out} = C_{src} + C_{dst} - C_{src} * C_{dst}\)

      • MULTIPLY

        public static final BlendMode MULTIPLY
        Multiplies the source and destination pixels.

        \(\alpha_{out} = \alpha_{src} + \alpha_{dst} - \alpha_{src} * \alpha_{dst}\)

        \(C_{out} = C_{src} * (1 - \alpha_{dst}) + C_{dst} * (1 - \alpha_{src}) + (C_{src} * C_{dst})\)

    • Method Detail

      • values

        public static BlendMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BlendMode c : BlendMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BlendMode valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null