Lightens a color by increasing its alpha channel value

@param context the current context
@param res     the color resource
@param alpha   the alpha to set
@return a color int
767303
@ColorInt public static int increaseOpacity(Context context, @ColorRes int res, int alpha) {
        int c = resolveColor(res, context);
        return increaseOpacityFromInt(context, resolveColor(res, context), alpha);
    }
1096388
public void setClearColor (float red, float green, float blue, float alpha) {
    cred = red; cgreen = green; cblue = blue; calpha = alpha;
  }
82643
@Override
    protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
    {
        final double w = attr.getWidth();

        final double h = attr.getHeight();

        final double r = attr.getCornerRadius();

        if ((w > 0) && (h > 0))
        {
            context.beginPath();

            if ((r > 0) && (r < (w / 2)) && (r < (h / 2)))
            {
                context.moveTo(r, 0);

                context.lineTo(w - r, 0);

                context.arc(w - r, r, r, (Math.PI * 3) / 2, 0, false);

                context.lineTo(w, h - r);

                context.arc(w - r, h - r, r, 0, Math.PI / 2, false);

                context.lineTo(r, h);

                context.arc(r, h - r, r, Math.PI / 2, Math.PI, false);

                context.lineTo(0, r);

                context.arc(r, r, r, Math.PI, (Math.PI * 3) / 2, false);
            }
            else
            {
                context.rect(0, 0, w, h);
            }
            context.closePath();

            return true;
        }
        return false;
    }
943483
public GenericColor darken(ColorFactor factor) {

    return valueOf(this.red.decrease(factor), this.green.decrease(factor), this.blue.decrease(factor), this.alpha);
  }
50611
public void setAlpha(javax.el.ValueExpression _alpha) {
		getStateHelper().put(PropertyKeys.alpha, _alpha);
	}
326858
def set_alpha(node, alpha=0.1):
    
    for child_node in node.findall(".//*[@rgba]"):
        rgba_orig = string_to_array(child_node.get("rgba"))
        child_node.set("rgba", array_to_string(list(rgba_orig[0:3]) + [alpha]))
754901
def set_alpha_for_selection(self, alpha):
        '''
        
        '''
        #  1. Look up selected layer.
        selection = self.treeview_layers.get_selection()
        list_store, selected_iter = selection.get_selected()

        # 2. Set alpha value for layer (if selected).
        if selected_iter is None:
            # No layer was selected, so disable scale widget.
            return
        else:
            surface_name, original_alpha = list_store[selected_iter]

            self.set_alpha(surface_name, alpha)
            self.set_scale_alpha_from_selection()
220951
def _change_color(self, event):
        """"""
        h = self.bar.get()
        self.square.set_hue(h)
        (r, g, b), (h, s, v), sel_color = self.square.get()
        self.red.set(r)
        self.green.set(g)
        self.blue.set(b)
        self.hue.set(h)
        self.saturation.set(s)
        self.value.set(v)
        self.hexa.delete(0, "end")
        self.hexa.insert(0, sel_color.upper())
        if self.alpha_channel:
            self.alphabar.set_color((r, g, b))
            self.hexa.insert('end',
                             ("%2.2x" % self.alpha.get()).upper())
        self._update_preview()
288883
public void setLayerOpacity(int alpha, int layer) {

        if ((alpha >= 0) && (alpha <= 100) && isAttached()) {
            Element colorbar;

            switch (layer) {
                case COLORBAR_A:
                    colorbar = m_colorA.getElement();
                    break;
                case COLORBAR_B:
                    colorbar = m_colorB.getElement();
                    break;
                case COLORBAR_C:
                    colorbar = m_colorC.getElement();
                    break;
                case COLORBAR_D:
                    colorbar = m_colorD.getElement();
                    break;
                default:
                    return;
            }
            colorbar.getStyle().setOpacity((1.0 * alpha) / 100);
            CmsTransparencyImpl.setTransparency(colorbar, alpha);
        }
    }
439449
public void setClearColor (int argb) {
    float red   = ((argb >> 16) & 0xFF) / 255f;
    float green = ((argb >>  8) & 0xFF) / 255f;
    float blue  = ((argb >>  0) & 0xFF) / 255f;
    float alpha = ((argb >> 24) & 0xFF) / 255f;
    setClearColor(red, green, blue, alpha);
  }
158672
@Override
    protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
    {
        if (m_inits)
        {
            init();

            if ((null == m_error) && (isAutoPlay()))
            {
                play();
            }
        }
        int wide = getWidth();

        int high = getHeight();

        if (null != m_error)
        {
            if (false == context.isSelection())
            {
                if (wide < 1)
                {
                    wide = MOVIE_ERROR_WIDE;
                }
                if (high < 1)
                {
                    high = MOVIE_ERROR_HIGH;
                }
                context.save();

                context.setFillColor(ColorName.BLACK);

                context.rect(0, 0, wide, high);

                context.fill();

                context.setTextAlign(TextAlign.CENTER);

                context.setTextBaseline(TextBaseLine.MIDDLE);

                context.setTextFont(getTextBestFit(context, m_error, wide));

                context.setFillColor(ColorName.WHITE);

                context.rect(0, 0, wide, high);

                context.clip();

                context.fillText(m_error, wide / 2.0d, high / 2.0d);

                context.restore();
            }
        }
        else
        {
            if ((wide < 1) || (high < 1))
            {
                return false;
            }
            if (context.isSelection())
            {
                final String color = getColorKey();

                if (null != color)
                {
                    context.save();

                    context.setFillColor(color);

                    context.fillRect(0, 0, wide, high);

                    context.restore();
                }
                return false;
            }
            if (isEnded())
            {
                if (null != m_postr)
                {
                    context.save();

                    context.setGlobalAlpha(alpha);

                    context.drawImage(m_postr, 0, 0, wide, high);

                    context.restore();
                }
                else
                {
                    final String fill = getFillColor();

                    if (null != fill)
                    {
                        context.save();

                        context.setGlobalAlpha(alpha);

                        context.setFillColor(fill);

                        context.fillRect(0, 0, wide, high);

                        context.restore();
                    }
                }
                return false;
            }
            context.save();

            context.setGlobalAlpha(alpha);

            if ((false == m_xorig) && (m_filters.isActive()))
            {
                try
                {
                    m_canvas.getContext().drawImage(m_video.getElement(), 0, 0, wide, high);

                    m_canvas.getContext().putImageData(m_filters.filter(m_canvas.getContext().getImageData(0, 0, wide, high), false), 0, 0);

                    context.drawImage(m_canvas.getElement(), 0, 0, wide, high);
                }
                catch (final Exception e)
                {
                    // We should only get an exception here if the URL is cross-origin, and getImageData() is basically a security exception.
                    // ...or other unknown bad things, either way, turn off filtering. DSJ 7/18/2014

                    context.drawImage(m_video.getElement(), 0, 0, wide, high);

                    m_xorig = true;

                    LienzoCore.get().error("ERROR: In Movie filtering " + m_video.getSrc() + " " + e.getMessage());
                }
            }
            else
            {
                context.drawImage(m_video.getElement(), 0, 0, wide, high);
            }
            context.restore();
        }
        return false;
    }
697605
def set_map_alpha(alpha):
    
    if alpha < 0 or alpha > 255:
        raise Exception('invalid alpha '  + str(alpha))
    _global_config.map_alpha = alpha
148708
public int color(Context ctx) {
        if (mColorInt == 0 && mColorRes != -1) {
            mColorInt = ContextCompat.getColor(ctx, mColorRes);
        }
        return mColorInt;
    }
122407
protected boolean fill(final Context2D context, final Attributes attr, double alpha)
    {
        final boolean filled = attr.hasFill();

        if ((filled) || (attr.isFillShapeForSelection()))
        {
            alpha = alpha * attr.getFillAlpha();

            if (alpha <= 0)
            {
                return false;
            }
            if (context.isSelection())
            {
                final String color = getColorKey();

                if (null == color)
                {
                    return false;
                }
                context.save();

                context.setFillColor(color);

                context.fill();

                context.restore();

                return true;
            }
            if (false == filled)
            {
                return false;
            }
            context.save();

            if (attr.hasShadow())
            {
                doApplyShadow(context, attr);
            }
            context.setGlobalAlpha(alpha);

            final String fill = attr.getFillColor();

            if (null != fill)
            {
                context.setFillColor(fill);

                context.fill();

                context.restore();

                return true;
            }
            final FillGradient grad = attr.getFillGradient();

            if (null != grad)
            {
                final String type = grad.getType();

                if (LinearGradient.TYPE.equals(type))
                {
                    context.setFillGradient(grad.asLinearGradient());

                    context.fill();

                    context.restore();

                    return true;
                }
                else if (RadialGradient.TYPE.equals(type))
                {
                    context.setFillGradient(grad.asRadialGradient());

                    context.fill();

                    context.restore();

                    return true;
                }
                else if (PatternGradient.TYPE.equals(type))
                {
                    context.setFillGradient(grad.asPatternGradient());

                    context.fill();

                    context.restore();

                    return true;
                }
            }
            context.restore();
        }
        return false;
    }
994117
public void setColor(int color, boolean callback) {

    int alpha = Color.alpha(color);
    int red = Color.red(color);
    int blue = Color.blue(color);
    int green = Color.green(color);

    float[] hsv = new float[3];

    Color.RGBToHSV(red, green, blue, hsv);

    this.alpha = alpha;
    hue = hsv[0];
    sat = hsv[1];
    val = hsv[2];

    if (callback && onColorChangedListener != null) {
      onColorChangedListener.onColorChanged(Color.HSVToColor(this.alpha, new float[] { hue, sat, val }));
    }

    invalidate();
  }
899156
private function setGlowColor($color, $alpha, $type)
    {
        if (!is_null($color)) {
            $this->glowProperties['color']['value'] = (string) $color;
        }
        if (!is_null($alpha)) {
            $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
        }
        if (!is_null($type)) {
            $this->glowProperties['color']['type'] = (string) $type;
        }

        return $this;
    }
709858
public static Color darker (Color color, double fraction)
	{
		int red   = (int) Math.round (color.getRed()   * (1.0 - fraction));
		int green = (int) Math.round (color.getGreen() * (1.0 - fraction));
		int blue  = (int) Math.round (color.getBlue()  * (1.0 - fraction));

		if (red   < 0) red   = 0; else if (red   > 255) red   = 255;
		if (green < 0) green = 0; else if (green > 255) green = 255;
		if (blue  < 0) blue  = 0; else if (blue  > 255) blue  = 255;

		int alpha = color.getAlpha();

		return new Color (red, green, blue, alpha);
	}