קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-Android מגרסה 8.1 ואילך יש תמיכה בניהול צבעים, שאפשר להשתמש בה כדי לספק חוויה עקבית בטכנולוגיות מסך שונות. אפליקציות שפועלות ב-Android יכולות לגשת ליכולות המלאות של מסך עם מגוון רחב של צבעים כדי להפיק את המקסימום מהמסך.
גרסאות קודמות של Android לא כללו תמיכה בניהול צבעים, ובמקום זאת הסתמכו על תאימות בין התוכן למסכים (מטרה שענף הטלוויזיה עוזר להשיג לעיתים קרובות). עם זאת, טכנולוגיות התצוגה החדשות מאפשרות להציג צבעים רחבים יותר, אבל התוכן הקיים לא מוצג בהם כצפוי. במכשירים עם Android מגרסה 8.1 ואילך, שמשתמשים במסך עם מגוון רחב של צבעים (לדוגמה, נורית LED אורגנית במטריצה פעילה או AMOLED, מסכי LCD מסוימים), אפשר לראות תוכן עם מגוון רחב של צבעים מאפליקציות.
בדיקת התמיכה במכשיר
מכשירים עם מסכים בצבעים רחבים שפועלים עם Android מגרסה 8.1 ומעלה אמורים לתמוך בניהול צבעים (צבעים רחבים). לפני שמפעילים את התכונה הזו, צריך לוודא שהמכשיר עומד בדרישות הבאות:
מסך המכשיר עומד בדרישות החומרה, כולל מסך עם מאפיינים טובים שתומך במרחב הצבעים Display-P3. אם המסך לא עומד בדרישות האלה, אל תפעילו את ניהול הצבעים. כדי לצמצם את ההשפעה על המעבד (CPU) ועל המעבד הגרפי (GPU), מומלץ שתהיה תמיכה ב-sRGB מורחב וב-HDR10 בצינור עיבוד הנתונים של המסך.
המכשיר תומך בתהליך כיול מקור שמייצר נתוני כיול (שנשמרים במכשיר) כדי להתאים את התנהגות המסך לשינויים בייצור. נתוני התאמה צריכים לאפשר למסך להציג תוכן sRGB ותווית לבנה D65 ו-D73 בצורה מדויקת.
אם הדרישות האלה מתקיימות, תוכלו להפעיל את התכונה של ניהול הצבעים במכשיר.
הטמעת ניהול צבע
כדי להטמיע ניהול צבעים, קודם צריך לעדכן את מנהל ההתקן Hardware Composer 2 (HWC2) כדי להבין את מצבי הצבעים ולהחיל את המצבים האלה על החומרה.
באופן ספציפי, המלחין של HWC2 צריך לדווח על מצבי הצבעים Display-P3 ו-sRGB באמצעות HWCDisplay::GetColorModes.
לאחר מכן, מפעילים את התוספים הנדרשים של OpenGL ואת התמיכה בספריות כדי לתרגם את מרחבי הצבעים של OpenGL למרחבי נתונים של HAL. תוספי OpenGL הנדרשים כוללים:
EGL_EXT_pixel_format_float.
מאפשר לאפליקציות ליצור EGLSurfaces שניתנים להצגה עם רכיבי צבע של 16 ביט. תעדוף: גבוה (זהו פורמט הפיקסלים שמוגדר כברירת מחדל באפליקציות שתומכות בצבעים רחבים). נדרשת תמיכה בדרייבר.
EGL_KHR_gl_colorspace.
באפליקציות שרוצות להשתמש בפורמט ברירת המחדל של framebuffers ב-sRGB כדי להשיג בקלות רבה יותר עיבוד ב-sRGB למכשירי תצוגה, התוסף הזה מאפשר ליצור EGLSurfaces שיעובדו ב-sRGB על ידי הקשרי OpenGL שתומכים ביכולת הזו. נדרש מנהל התקן עם תמיכה בהתנהגות sRGB.
ב-Android יש גם את התוספים האופציונליים הבאים:
EGL_EXT_colorspace_scrgb_linear.
התוסף הזה מספק אפשרות חדשה למרחב צבעים, scRGB, שאפליקציות יכולות לבחור כשיוצרים EGLSurface. מרחב הצבעים scRGB מגדיר מרחב לינארי שמתייחס לתצוגה, עם אותו נקודת לבן וצבעי יסוד כמו ב-sRGB (ולכן הוא תואם לאחור ל-sRGB). הפעולה הזו לא אמורה לדרוש תמיכה במנהל התקן, וניתן להטמיע אותה ב-EGL wrapper של Android. כדי להשתמש בתוסף הזה, צריך תמיכה בנקודת צפה של 16 ביט (FP16).
EGL_EXT_gl_colorspace_display_p3
ו-EGL_EXT_gl_colorspace_display_p3_linear. באפליקציות שרוצות להשתמש בפורמט ברירת המחדל של framebuffers ב-Display-P3 כדי לבצע עיבוד גרפי של sRGB למכשירי תצוגה בקלות רבה יותר, התוסף הזה מאפשר ליצור EGLSurfaces שיועברו לעיבוד גרפי ב-Display-P3 על ידי הקשרי OpenGL שתומכים ביכולת הזו.
אפשר להטמיע את זה ב-EGL driver wrapper.
VK_EXT_swapchain_colorspace
(Vulkan). מאפשרת לאפליקציות לתייג שרשרות החלפה במרחב הצבעים שבו הן משתמשות. כולל מספר מרחבי צבעים נפוצים כמו DCI-P3, Display-P3, AdobeRGB ו-BT2020.
התאמה אישית
אפשר להתאים אישית את התכונה של ניהול הצבעים כך שתכלול תמיכה במגוון תקני צבעים, כמו DCI-P3, AdobeRGB, Rec709 ו-Rec2020. אפשרויות נוספות להתאמה אישית:
תמיכה בחומרה להמרת צבעים בצינור עיבוד הנתונים של המסך הפעלת תמיכה במספר טרנספורמציות צבע בחומרה.
תמיכה בטרנספורמציית צבע עצמאית בכמה שכבות (לדוגמה, חלק מהשכבות יכולות להיות בפורמט sRGB וחלק בפורמט sRGB מורחב, לכל שכבה צינור עיבוד נתונים משלה). כשמוצגים יותר ממרחב צבע אחד, צריך להמיר חלק ממרחי הצבע למרחב הצבע של המסך. באופן אידיאלי, המנוע להצגה הוא המקום המתאים ביותר לבצע את הטרנספורמציה הזו (אחרת, Android צריך לבצע קומפוזיציה של GPU).
בדיקה
כדי לבדוק את ניהול הצבעים, תוכלו להיעזר במקורות המידע הבאים ב-opengl/tests:
gl2_basic היא הדגמה פשוטה של OpenGL שמבקשת מרחב צבעים של Display-P3.
EGL_test
בודק אם יש תמיכה בתוספים ובתצורות הנדרשים (10:10:10:2 ו-FP16).
test_wide_color יוצרת משטח באותו אופן כמו SurfaceFlinger (לדוגמה, תצורה, מרחב צבעים ופורמט פיקסלים).
הטמעת הפניה
להטמעה לדוגמה, אפשר לעיין במאמר frameworks/native. למידע נוסף על כותרות, אפשר לעיין במאמרים הבאים:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Color management\n\nAndroid 8.1 and higher include support for color management that can be used to provide a\nconsistent experience across display technologies. Apps running on\nAndroid can access the full capabilities of a wide-gamut display to get the\nmost out of a display device.\n\nPrevious Android releases didn't include color management support and\ninstead relied on content and displays being compatible (a goal often aided by\nthe TV industry). However, recent display technologies allow for much larger\ngamut displays that don't display existing content as expected. With Android\n8.1 and higher, devices that use a wide-gamut display (for example, active-matrix organic\nlight-emitting diode or AMOLED, some LCDs) can see wide-gamut\ncontent from apps.\n\nDetermine device support\n------------------------\n\nDevices with wide-color displays running Android 8.1 or higher should support color\nmanagement (wide-color). Before enabling this feature, ensure that the device meets\nthe following requirements:\n\n- Device display meets the hardware requirements, which include a well-characterized display that supports the Display-P3 colorspace. If the display doesn't meet this requirement, don't enable color management. To reduce CPU and GPU impact, support for extended sRGB and HDR10 in the display pipeline is desirable.\n- Device supports a factory calibration process that generates calibration data (stored on the device) to adjust for manufacturing variance in display behavior. At a minimum, calibration data should allow the display to accurately display sRGB content and D65 and D73 white points.\n\nIf these requirements are met, you can enable the color management\nfeature for the device.\n\nImplement color management\n--------------------------\n\nTo implement color management, first update the\n[Hardware Composer 2 (HWC2)](/docs/core/graphics/implement-hwc) driver\nto understand color modes and to apply those modes to the hardware.\nSpecifically, the HWC2 composer must report the Display-P3 and sRGB\ncolor modes using `HWCDisplay::GetColorModes`.\n| **Key Term:** Display-P3 uses Digital Cinema Initiatives primaries and sRGB transfer function.\n\nNext, enable the necessary OpenGL extensions and library support to\ntranslate OpenGL color spaces to HAL data spaces. Required OpenGL extensions\ninclude:\n\n- [`EGL_EXT_pixel_format_float`](https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_pixel_format_float.txt). Allows apps to create presentable EGLSurfaces with 16-bit float color components. Priority: high (expect this is the default pixel format for wide-color aware apps). Requires driver support.\n- [`EGL_KHR_gl_colorspace`](https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_colorspace.txt). For apps that want to use sRGB format default framebuffers to more easily achieve sRGB rendering to display devices, this extension allows creating EGLSurfaces that will be rendered to in sRGB by OpenGL contexts supporting that capability. Requires driver support for sRGB behavior.\n\nAndroid also provides the following optional extensions:\n\n- [`EGL_EXT_colorspace_scrgb_linear`](https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_gl_colorspace_scrgb_linear.txt). This extension provides a new color space option, scRGB, that apps can choose when creating an EGLSurface. The scRGB color space defines a linear display referred space with the same white point and color primaries as sRGB (and thus is backward compatible with sRGB). This shouldn't require driver support and can be implemented in the Android EGL wrapper. To be useful, this extension requires support for 16-bit floating point (FP16).\n- [`EGL_EXT_gl_colorspace_display_p3`\n and `EGL_EXT_gl_colorspace_display_p3_linear`](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_gl_colorspace_display_p3.txt). For apps that want to use Display-P3 format default framebuffers to more easily achieve sRGB rendering to display devices, this extension allows creating EGLSurfaces that will be rendered to in Display-P3 by OpenGL contexts supporting that capability. This can be implemented in EGL driver wrapper.\n- [`VK_EXT_swapchain_colorspace`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VK_EXT_swapchain_colorspace) (Vulkan). Enables apps to tag swap chains with the color space they're using. Includes a number of common color spaces such as DCI-P3, Display-P3, AdobeRGB, and BT2020.\n\nCustomization\n-------------\n\nYou can customize the color management feature by including support for a\nvariety of color standards such as DCI-P3, AdobeRGB, Rec709, and Rec2020. Other\ncustomizations include:\n\n- **Hardware support for color conversion in the display\n pipeline.** Enables support for multiple color transforms in hardware.\n- **Support for independent color transform on multiple layers** (for example, some layers could be sRGB and others extended-sRGB, each with their own color pipeline). When there's more than one color space visible, some color spaces need to be converted to the color space of the display. Ideally, this transform is best provided by the display engine (otherwise Android must perform GPU composition).\n\nTesting\n-------\n\nTo test color management, use the following resources in\n`opengl/tests`:\n\n- `gl2_basic` is a simple OpenGL demo that requests a Display-P3 colorspace.\n- [`EGL_test`](https://android.googlesource.com/platform/frameworks/native/+/android16-release/opengl/tests/EGLTest/EGL_test.cpp) tests for necessary extension and config support (10:10:10:2 and FP16).\n- `test_wide_color` creates a surface in same manner as SurfaceFlinger (for example, config, color space, and pixel format).\n\nReference implementation\n------------------------\n\nFor a reference implementation, refer to `frameworks/native`. For\nheaders, refer to:\n\n- [`system/core/include/system/graphics.h`](https://android.googlesource.com/platform/system/core/+/android16-release/libsystem/include/system/graphics.h)\n- [`system/core/include/system/graphics-base.h`](https://android.googlesource.com/platform/system/core/+/android16-release/libsystem/include/system/graphics-base.h)\n - `HAL_DATASPACE_*`\n - `HAL_COLOR_MODE_*`"]]