Java 类android.hardware.camera2.params.TonemapCurve 实例源码

项目:OkayCamera-Android    文件:TonemapComponent.java   
public void setSubModeValue(int mode, Object value) {
    switch (mode) {
        case CONTRAST_CURVE:
            mTonemapCurve = (TonemapCurve) value;
            break;
        case PRESET_CURVE:
            mPresetCurveValue = (int) value;
            break;
        case GAMMA_VALUE:
            /*
             * 当 TONEMAP_MODE 为 GAMMA_VALUE 时,所使用的色调映射曲线值,* OUT = pow(IN, 1.0 / gamma),
             * gamma 的值在不同设备上有所不同,但是1-5之内的不会被剪掉
             */
            mGammaCurveValue = (float) value;
            break;
    }
}
项目:Camera2    文件:CaptureDataSerializer.java   
private static String toString(TonemapCurve curve) {
    StringBuilder str = new StringBuilder();
    str.append("TonemapCurve:");

    float[] reds = new float[curve.getPointCount(TonemapCurve.CHANNEL_RED)
            * TonemapCurve.POINT_SIZE];
    curve.copyColorCurve(TonemapCurve.CHANNEL_RED, reds, 0);
    float[] greens = new float[curve.getPointCount(TonemapCurve.CHANNEL_GREEN)
            * TonemapCurve.POINT_SIZE];
    curve.copyColorCurve(TonemapCurve.CHANNEL_GREEN, greens, 0);
    float[] blues = new float[curve.getPointCount(TonemapCurve.CHANNEL_BLUE)
            * TonemapCurve.POINT_SIZE];
    curve.copyColorCurve(TonemapCurve.CHANNEL_BLUE, blues, 0);

    str.append("\n\nReds: ");
    str.append(Arrays.toString(reds));
    str.append("\n\nGreens: ");
    str.append(Arrays.toString(greens));
    str.append("\n\nBlues: ");
    str.append(Arrays.toString(blues));

    return str.toString();
}
项目:Camera2    文件:CaptureDataSerializer.java   
private static String metadataValueToString(Object object) {
    if (object == null) {
        return "<null>";
    }
    if (object.getClass().isArray()) {
        StringBuilder builder = new StringBuilder();
        builder.append("[");

        int length = Array.getLength(object);
        for (int i = 0; i < length; ++i) {
            Object item = Array.get(object, i);
            builder.append(metadataValueToString(item));

            if (i != length - 1) {
                builder.append(", ");
            }
        }
        builder.append(']');

        return builder.toString();
    } else {
        // These classes don't have a toString() method yet
        // See: http://b/16899576
        if (object instanceof RggbChannelVector) {
            return toString((RggbChannelVector) object);
        } else if (object instanceof ColorSpaceTransform) {
            return toString((ColorSpaceTransform) object);
        } else if (object instanceof TonemapCurve) {
            return toString((TonemapCurve) object);
        } else if (object instanceof Pair) {
            return toString((Pair<?, ?>) object);
        }
        return object.toString();
    }
}