Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14487,6 +14487,8 @@ package android.graphics { @AnyThread public abstract class ColorSpace { method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Adaptation); method @NonNull @Size(3) public static float[] cctToXyz(@IntRange(from=1) int); method @NonNull @Size(9) public static float[] chromaticAdaptation(@NonNull android.graphics.ColorSpace.Adaptation, @NonNull @Size(min=2, max=3) float[], @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace); core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.javadeleted 100644 → 0 +0 −75 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWith(AndroidJUnit4.class) public class ColorSpaceRendererTest { @Test public void testRendererSize() { Bitmap b = ColorSpace.createRenderer() .size(0) .render(); assertEquals(128, b.getWidth()); assertEquals(128, b.getHeight()); b = ColorSpace.createRenderer() .size(768) .render(); assertEquals(768, b.getWidth()); assertEquals(768, b.getHeight()); } @Test public void testRenderer() { Bitmap b = ColorSpace.createRenderer() .size(1024) .clip(true) .showWhitePoint(false) .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .render(); assertNotNull(b); } @Test public void testUcsRenderer() { Bitmap b = ColorSpace.createRenderer() .size(1024) .clip(true) .showWhitePoint(false) .uniformChromaticityScale(true) .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .render(); assertNotNull(b); } } graphics/java/android/graphics/ColorSpace.java +6 −850 File changed.Preview size limit exceeded, changes collapsed. Show changes non-updatable-api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14469,6 +14469,8 @@ package android.graphics { @AnyThread public abstract class ColorSpace { method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Adaptation); method @NonNull @Size(3) public static float[] cctToXyz(@IntRange(from=1) int); method @NonNull @Size(9) public static float[] chromaticAdaptation(@NonNull android.graphics.ColorSpace.Adaptation, @NonNull @Size(min=2, max=3) float[], @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace); services/core/java/com/android/server/display/color/DisplayWhiteBalanceTintController.java +28 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.server.display.color; import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_DISPLAY_WHITE_BALANCE; import android.annotation.NonNull; import android.annotation.Size; import android.content.Context; import android.content.res.Resources; import android.graphics.ColorSpace; Loading @@ -32,7 +34,6 @@ import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import java.io.PrintWriter; import java.lang.System; final class DisplayWhiteBalanceTintController extends TintController { Loading Loading @@ -131,6 +132,30 @@ final class DisplayWhiteBalanceTintController extends TintController { : ColorDisplayService.MATRIX_IDENTITY; } /** * Multiplies two 3x3 matrices, represented as non-null arrays of 9 floats. * * @param lhs 3x3 matrix, as a non-null array of 9 floats * @param rhs 3x3 matrix, as a non-null array of 9 floats * @return A new array of 9 floats containing the result of the multiplication * of rhs by lhs */ @NonNull @Size(9) private static float[] mul3x3(@NonNull @Size(9) float[] lhs, @NonNull @Size(9) float[] rhs) { float[] r = new float[9]; r[0] = lhs[0] * rhs[0] + lhs[3] * rhs[1] + lhs[6] * rhs[2]; r[1] = lhs[1] * rhs[0] + lhs[4] * rhs[1] + lhs[7] * rhs[2]; r[2] = lhs[2] * rhs[0] + lhs[5] * rhs[1] + lhs[8] * rhs[2]; r[3] = lhs[0] * rhs[3] + lhs[3] * rhs[4] + lhs[6] * rhs[5]; r[4] = lhs[1] * rhs[3] + lhs[4] * rhs[4] + lhs[7] * rhs[5]; r[5] = lhs[2] * rhs[3] + lhs[5] * rhs[4] + lhs[8] * rhs[5]; r[6] = lhs[0] * rhs[6] + lhs[3] * rhs[7] + lhs[6] * rhs[8]; r[7] = lhs[1] * rhs[6] + lhs[4] * rhs[7] + lhs[7] * rhs[8]; r[8] = lhs[2] * rhs[6] + lhs[5] * rhs[7] + lhs[8] * rhs[8]; return r; } @Override public void setMatrix(int cct) { if (!mSetUp) { Loading Loading @@ -160,9 +185,9 @@ final class DisplayWhiteBalanceTintController extends TintController { mDisplayNominalWhiteXYZ, mCurrentColorTemperatureXYZ); // Convert the adaptation matrix to RGB space float[] result = ColorSpace.mul3x3(mChromaticAdaptationMatrix, float[] result = mul3x3(mChromaticAdaptationMatrix, mDisplayColorSpaceRGB.getTransform()); result = ColorSpace.mul3x3(mDisplayColorSpaceRGB.getInverseTransform(), result); result = mul3x3(mDisplayColorSpaceRGB.getInverseTransform(), result); // Normalize the transform matrix to peak white value in RGB space final float adaptedMaxR = result[0] + result[3] + result[6]; Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14487,6 +14487,8 @@ package android.graphics { @AnyThread public abstract class ColorSpace { method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Adaptation); method @NonNull @Size(3) public static float[] cctToXyz(@IntRange(from=1) int); method @NonNull @Size(9) public static float[] chromaticAdaptation(@NonNull android.graphics.ColorSpace.Adaptation, @NonNull @Size(min=2, max=3) float[], @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace);
core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.javadeleted 100644 → 0 +0 −75 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; @SmallTest @RunWith(AndroidJUnit4.class) public class ColorSpaceRendererTest { @Test public void testRendererSize() { Bitmap b = ColorSpace.createRenderer() .size(0) .render(); assertEquals(128, b.getWidth()); assertEquals(128, b.getHeight()); b = ColorSpace.createRenderer() .size(768) .render(); assertEquals(768, b.getWidth()); assertEquals(768, b.getHeight()); } @Test public void testRenderer() { Bitmap b = ColorSpace.createRenderer() .size(1024) .clip(true) .showWhitePoint(false) .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .render(); assertNotNull(b); } @Test public void testUcsRenderer() { Bitmap b = ColorSpace.createRenderer() .size(1024) .clip(true) .showWhitePoint(false) .uniformChromaticityScale(true) .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff) .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000) .render(); assertNotNull(b); } }
graphics/java/android/graphics/ColorSpace.java +6 −850 File changed.Preview size limit exceeded, changes collapsed. Show changes
non-updatable-api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -14469,6 +14469,8 @@ package android.graphics { @AnyThread public abstract class ColorSpace { method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Adaptation); method @NonNull @Size(3) public static float[] cctToXyz(@IntRange(from=1) int); method @NonNull @Size(9) public static float[] chromaticAdaptation(@NonNull android.graphics.ColorSpace.Adaptation, @NonNull @Size(min=2, max=3) float[], @NonNull @Size(min=2, max=3) float[]); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent); method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace);
services/core/java/com/android/server/display/color/DisplayWhiteBalanceTintController.java +28 −3 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.server.display.color; import static com.android.server.display.color.DisplayTransformManager.LEVEL_COLOR_MATRIX_DISPLAY_WHITE_BALANCE; import android.annotation.NonNull; import android.annotation.Size; import android.content.Context; import android.content.res.Resources; import android.graphics.ColorSpace; Loading @@ -32,7 +34,6 @@ import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import java.io.PrintWriter; import java.lang.System; final class DisplayWhiteBalanceTintController extends TintController { Loading Loading @@ -131,6 +132,30 @@ final class DisplayWhiteBalanceTintController extends TintController { : ColorDisplayService.MATRIX_IDENTITY; } /** * Multiplies two 3x3 matrices, represented as non-null arrays of 9 floats. * * @param lhs 3x3 matrix, as a non-null array of 9 floats * @param rhs 3x3 matrix, as a non-null array of 9 floats * @return A new array of 9 floats containing the result of the multiplication * of rhs by lhs */ @NonNull @Size(9) private static float[] mul3x3(@NonNull @Size(9) float[] lhs, @NonNull @Size(9) float[] rhs) { float[] r = new float[9]; r[0] = lhs[0] * rhs[0] + lhs[3] * rhs[1] + lhs[6] * rhs[2]; r[1] = lhs[1] * rhs[0] + lhs[4] * rhs[1] + lhs[7] * rhs[2]; r[2] = lhs[2] * rhs[0] + lhs[5] * rhs[1] + lhs[8] * rhs[2]; r[3] = lhs[0] * rhs[3] + lhs[3] * rhs[4] + lhs[6] * rhs[5]; r[4] = lhs[1] * rhs[3] + lhs[4] * rhs[4] + lhs[7] * rhs[5]; r[5] = lhs[2] * rhs[3] + lhs[5] * rhs[4] + lhs[8] * rhs[5]; r[6] = lhs[0] * rhs[6] + lhs[3] * rhs[7] + lhs[6] * rhs[8]; r[7] = lhs[1] * rhs[6] + lhs[4] * rhs[7] + lhs[7] * rhs[8]; r[8] = lhs[2] * rhs[6] + lhs[5] * rhs[7] + lhs[8] * rhs[8]; return r; } @Override public void setMatrix(int cct) { if (!mSetUp) { Loading Loading @@ -160,9 +185,9 @@ final class DisplayWhiteBalanceTintController extends TintController { mDisplayNominalWhiteXYZ, mCurrentColorTemperatureXYZ); // Convert the adaptation matrix to RGB space float[] result = ColorSpace.mul3x3(mChromaticAdaptationMatrix, float[] result = mul3x3(mChromaticAdaptationMatrix, mDisplayColorSpaceRGB.getTransform()); result = ColorSpace.mul3x3(mDisplayColorSpaceRGB.getInverseTransform(), result); result = mul3x3(mDisplayColorSpaceRGB.getInverseTransform(), result); // Normalize the transform matrix to peak white value in RGB space final float adaptedMaxR = result[0] + result[3] + result[6]; Loading