Search in sources :

Example 1 with Xfermode_Delegate

use of android.graphics.Xfermode_Delegate in project platform_frameworks_base by android.

the class GcSnapshot method setComposite.

private void setComposite(Graphics2D g, Paint_Delegate paint, boolean usePaintAlpha, int forceMode) {
    // the alpha for the composite. Always opaque if the normal paint color is used since
    // it contains the alpha
    int alpha = usePaintAlpha ? paint.getAlpha() : 0xFF;
    if (forceMode != 0) {
        g.setComposite(AlphaComposite.getInstance(forceMode, (float) alpha / 255.f));
        return;
    }
    Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
    if (xfermodeDelegate != null) {
        if (xfermodeDelegate.isSupported()) {
            Composite composite = xfermodeDelegate.getComposite(alpha);
            assert composite != null;
            if (composite != null) {
                g.setComposite(composite);
                return;
            }
        } else {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), null, /*throwable*/
            null);
        }
    }
    // that will handle the alpha.
    if (alpha != 0xFF) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) alpha / 255.f));
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Xfermode_Delegate(android.graphics.Xfermode_Delegate) Paint(android.graphics.Paint)

Example 2 with Xfermode_Delegate

use of android.graphics.Xfermode_Delegate in project android_frameworks_base by DirtyUnicorns.

the class GcSnapshot method setComposite.

private void setComposite(Graphics2D g, Paint_Delegate paint, boolean usePaintAlpha, int forceMode) {
    // the alpha for the composite. Always opaque if the normal paint color is used since
    // it contains the alpha
    int alpha = usePaintAlpha ? paint.getAlpha() : 0xFF;
    if (forceMode != 0) {
        g.setComposite(AlphaComposite.getInstance(forceMode, (float) alpha / 255.f));
        return;
    }
    Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
    if (xfermodeDelegate != null) {
        if (xfermodeDelegate.isSupported()) {
            Composite composite = xfermodeDelegate.getComposite(alpha);
            assert composite != null;
            if (composite != null) {
                g.setComposite(composite);
                return;
            }
        } else {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), null, /*throwable*/
            null);
        }
    }
    // that will handle the alpha.
    if (alpha != 0xFF) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) alpha / 255.f));
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Xfermode_Delegate(android.graphics.Xfermode_Delegate) Paint(android.graphics.Paint)

Example 3 with Xfermode_Delegate

use of android.graphics.Xfermode_Delegate in project android_frameworks_base by AOSPA.

the class GcSnapshot method setComposite.

private void setComposite(Graphics2D g, Paint_Delegate paint, boolean usePaintAlpha, int forceMode) {
    // the alpha for the composite. Always opaque if the normal paint color is used since
    // it contains the alpha
    int alpha = usePaintAlpha ? paint.getAlpha() : 0xFF;
    if (forceMode != 0) {
        g.setComposite(AlphaComposite.getInstance(forceMode, (float) alpha / 255.f));
        return;
    }
    Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
    if (xfermodeDelegate != null) {
        if (xfermodeDelegate.isSupported()) {
            Composite composite = xfermodeDelegate.getComposite(alpha);
            assert composite != null;
            if (composite != null) {
                g.setComposite(composite);
                return;
            }
        } else {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), null, /*throwable*/
            null);
        }
    }
    // that will handle the alpha.
    if (alpha != 0xFF) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) alpha / 255.f));
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Xfermode_Delegate(android.graphics.Xfermode_Delegate) Paint(android.graphics.Paint)

Example 4 with Xfermode_Delegate

use of android.graphics.Xfermode_Delegate in project android_frameworks_base by ResurrectionRemix.

the class GcSnapshot method setComposite.

private void setComposite(Graphics2D g, Paint_Delegate paint, boolean usePaintAlpha, int forceMode) {
    // the alpha for the composite. Always opaque if the normal paint color is used since
    // it contains the alpha
    int alpha = usePaintAlpha ? paint.getAlpha() : 0xFF;
    if (forceMode != 0) {
        g.setComposite(AlphaComposite.getInstance(forceMode, (float) alpha / 255.f));
        return;
    }
    Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
    if (xfermodeDelegate != null) {
        if (xfermodeDelegate.isSupported()) {
            Composite composite = xfermodeDelegate.getComposite(alpha);
            assert composite != null;
            if (composite != null) {
                g.setComposite(composite);
                return;
            }
        } else {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), null, /*throwable*/
            null);
        }
    }
    // that will handle the alpha.
    if (alpha != 0xFF) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) alpha / 255.f));
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Xfermode_Delegate(android.graphics.Xfermode_Delegate) Paint(android.graphics.Paint)

Example 5 with Xfermode_Delegate

use of android.graphics.Xfermode_Delegate in project android_frameworks_base by crdroidandroid.

the class GcSnapshot method setComposite.

private void setComposite(Graphics2D g, Paint_Delegate paint, boolean usePaintAlpha, int forceMode) {
    // the alpha for the composite. Always opaque if the normal paint color is used since
    // it contains the alpha
    int alpha = usePaintAlpha ? paint.getAlpha() : 0xFF;
    if (forceMode != 0) {
        g.setComposite(AlphaComposite.getInstance(forceMode, (float) alpha / 255.f));
        return;
    }
    Xfermode_Delegate xfermodeDelegate = paint.getXfermode();
    if (xfermodeDelegate != null) {
        if (xfermodeDelegate.isSupported()) {
            Composite composite = xfermodeDelegate.getComposite(alpha);
            assert composite != null;
            if (composite != null) {
                g.setComposite(composite);
                return;
            }
        } else {
            Bridge.getLog().fidelityWarning(LayoutLog.TAG_XFERMODE, xfermodeDelegate.getSupportMessage(), null, /*throwable*/
            null);
        }
    }
    // that will handle the alpha.
    if (alpha != 0xFF) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) alpha / 255.f));
    }
}
Also used : AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Xfermode_Delegate(android.graphics.Xfermode_Delegate) Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)6 Xfermode_Delegate (android.graphics.Xfermode_Delegate)6 AlphaComposite (java.awt.AlphaComposite)6 Composite (java.awt.Composite)6 Shader_Delegate (android.graphics.Shader_Delegate)1 Color (java.awt.Color)1 Graphics2D (java.awt.Graphics2D)1