ECode CComposeShader::constructor(
    /* [in] */ IShader* shaderA,
    /* [in] */ IShader* shaderB,
    /* [in] */ IXfermode* mode)
{
    mShaderA = shaderA;
    mShaderB = shaderB;
    mNativeInstance = NativeCreate1(
                ((Shader*)shaderA->Probe(EIID_Shader))->mNativeInstance,
                ((Shader*)shaderB->Probe(EIID_Shader))->mNativeInstance,
                (mode != NULL) ? ((Xfermode*)mode->Probe(EIID_Xfermode))->mNativeInstance : 0);
    if (IPorterDuffXfermode::Probe(mode) != NULL) {
        PorterDuffMode pdMode;
        IPorterDuffXfermode::Probe(mode)->GetMode(&pdMode);
        mNativeShader = NativePostCreate2(mNativeInstance,
                ((Shader*)shaderA->Probe(EIID_Shader))->mNativeInstance,
                ((Shader*)shaderB->Probe(EIID_Shader))->mNativeInstance, pdMode != -1 ? pdMode : 0);
        return NOERROR;
    }
    else {
        mNativeShader = NativePostCreate1(mNativeInstance,
                ((Shader*)shaderA->Probe(EIID_Shader))->mNativeInstance,
                ((Shader*)shaderB->Probe(EIID_Shader))->mNativeInstance,
                (mode != NULL) ? ((Xfermode*)mode->Probe(EIID_Xfermode))->mNativeInstance : 0);
        return NOERROR;
    }
}
示例#2
0
ECode CRadialGradient::constructor(
    /* [in] */ Float x,
    /* [in] */ Float y,
    /* [in] */ Float radius,
    /* [in] */ ArrayOf<Int32>* colors,
    /* [in] */ ArrayOf<Float>* positions,
    /* [in] */ ShaderTileMode tile)
{
    if (radius <= 0) {
//        throw new IllegalArgumentException("radius must be > 0");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }
    if (colors == NULL || colors->GetLength() < 2) {
//        throw new IllegalArgumentException("needs >= 2 number of colors");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }
    if (positions != NULL && colors->GetLength() != positions->GetLength()) {
//        throw new IllegalArgumentException("color and position arrays must be of equal length");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }
    mType = TYPE_COLORS_AND_POSITIONS;
    mX = x;
    mY = y;
    mRadius = radius;
    mColors = colors;
    mPositions = positions;
    mTileMode = tile;
    Init(NativeCreate1(x, y, radius, colors, positions, tile));
    return NOERROR;
}
示例#3
0
ECode CComposeShader::constructor(
    /* [in] */ IShader* shaderA,
    /* [in] */ IShader* shaderB,
    /* [in] */ IXfermode* mode)
{
    mType = TYPE_XFERMODE;
    mShaderA = shaderA;
    mShaderB = shaderB;
    mXferMode = mode;
    Init(NativeCreate1(((Shader*)shaderA)->mNativeInstance,
            ((Shader*)shaderB)->mNativeInstance,
            (mode != NULL) ? ((Xfermode*)mode)->mNativeInstance : 0));
    return NOERROR;
}
示例#4
0
ECode CSweepGradient::constructor(
    /* [in] */ Float cx,
    /* [in] */ Float cy,
    /* [in] */ ArrayOf<Int32>* colors,
    /* [in] */ ArrayOf<Float>* positions)
{
    if (colors == NULL || colors->GetLength() < 2) {
//        throw new IllegalArgumentException("needs >= 2 number of colors");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }
    if (positions != NULL && colors->GetLength() != positions->GetLength()) {
//        throw new IllegalArgumentException(
//                    "color and position arrays must be of equal length");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }
    mType = TYPE_COLORS_AND_POSITIONS;
    mCx = cx;
    mCy = cy;
    mColors = colors;
    mPositions = positions;
    Init(NativeCreate1(cx, cy, colors, positions));
    return NOERROR;
}