اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release بدلاً من aosp-main لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتيح نظام التشغيل Android 8.1 والإصدارات الأحدث إدارة الألوان التي يمكن استخدامها لتوفير
تجربة متسقة على مستوى تقنيات العرض. يمكن للتطبيقات التي تعمل على
نظام التشغيل Android الاستفادة من الإمكانات الكاملة لشاشة النطاق الواسع من أجل الاستفادة
إلى أقصى حد من جهاز العرض.
لم تتضمّن إصدارات Android السابقة ميزة إدارة الألوان، وبدلًا من ذلك، كانت تعتمد على توافق المحتوى والشاشات (وهو هدف غالبًا ما يساهم فيه
قطاع التلفزيون). ومع ذلك، تتيح تكنولوجيات العرض الحديثة استخدام شاشات عريضة النطاق بشكلٍ أكبر بكثير لا تعرض المحتوى الحالي على النحو المتوقّع. باستخدام الإصدار Android
8.1 والإصدارات الأحدث، يمكن للأجهزة التي تستخدم شاشة ذات نطاق ألوان واسع (مثل شاشة diode المُصدر للضوء المُركّز من مصفوفة نشطة أو AMOLED، وبعض شاشات LCD) عرض محتوى ذي نطاق ألوان واسع من التطبيقات.
تحديد مدى توافق الجهاز
يجب أن تتيح الأجهزة التي تعمل بالإصدار 8.1 من نظام التشغيل Android أو الإصدارات الأحدث التي تتضمّن شاشات بألوان عريضة إمكانية التحكّم في كثافة الألوان (ألوان عريضة). قبل تفعيل هذه الميزة، تأكَّد من أنّ الجهاز يستوفي
المتطلبات التالية:
تستوفي شاشة الجهاز متطلبات الأجهزة، بما في ذلك
شاشة ذات مواصفات جيدة تتوافق مع مساحة ألوان Display-P3. إذا كانت الشاشة لا تستوفي هذا الشرط، يجب عدم تفعيل ميزة "إدارة الألوان". للحدّ من تأثير وحدة المعالجة المركزية ووحدة معالجة الرسومات، من المستحسن توفير تنسيق sRGB الموسّع وHDR10 في مسار عرض المحتوى.
يتيح الجهاز عملية معايرة من المصنع تُنشئ بيانات المعايرة (التي يتم تخزينها على الجهاز) للتكيّف مع الاختلافات في التصنيع في سلوك الشاشة. على الأقل، يجب أن تسمح بيانات المعايرة للشاشة بaccurately
عرض محتوى 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.
بالنسبة إلى التطبيقات التي تريد استخدام إطارات عرض افتراضية بتنسيق sRGB لإجراء عملية عرض sRGB على أجهزة العرض بسهولة أكبر، تسمح هذه الإضافة بإنشاء سطح EGL سيتم عرضه بتنسيق sRGB من خلال سياقات OpenGL التي تتيح هذه الميزة. يجب أن يتيح برنامج التشغيل سلوك sRGB.
يوفّر Android أيضًا الإضافات الاختيارية التالية:
EGL_EXT_colorspace_scrgb_linear.
توفّر هذه الإضافة خيارًا جديدًا لمساحة الألوان، وهو scRGB، يمكن للتطبيقات
اختياره عند إنشاء EGLSurface. تحدِّد مساحة الألوان scRGB مساحة مرجعية لشاشة خطية
بنقطة الأبيض والألوان الأساسية نفسها المستخدَمة في sRGB
(وبالتالي تكون متوافقة مع sRGB). من المفترض ألا يتطلّب ذلك تجهيز ملف تعريف السائق، ويمكن تنفيذه في حزمة Android EGL. لكي تكون هذه الإضافة مفيدة، يجب أن تكون متوافقة مع النقطة العائمة 16 بت (FP16).
EGL_EXT_gl_colorspace_display_p3
وEGL_EXT_gl_colorspace_display_p3_linear بالنسبة إلى التطبيقات التي تريد
استخدام إطارات عرض تلقائية بتنسيق Display-P3 لتحقيق عرض sRGB
بسهولة أكبر على أجهزة العرض، تسمح هذه الإضافة بإنشاء EGLSurfaces التي
سيتم عرضها بتنسيق Display-P3 من خلال سياقات OpenGL التي تتيح هذه الميزة.
ويمكن تنفيذ ذلك في حزمة تشغيل برنامج تشغيل EGL.
VK_EXT_swapchain_colorspace
(Vulkan). يتيح للتطبيقات الإشارة إلى سلاسل التبديل باستخدام مساحة الألوان التي تستخدمها. يتضمّن عددًا من مساحات الألوان الشائعة، مثل DCI-P3 وDisplay-P3
وAdobeRGB وBT2020.
التخصيص
يمكنك تخصيص ميزة إدارة الألوان من خلال تضمين دعم لvaried من معايير الألوان، مثل DCI-P3 وAdobeRGB وRec709 وRec2020. تشمل الإعدادات المخصّصة الأخرى ما يلي:
توافق الأجهزة مع تحويل الألوان في مسار عرض المحتوى يتيح هذا الخيار إمكانية استخدام تحويلات ألوان متعددة في الأجهزة.
إتاحة تحويل الألوان بشكل مستقل في طبقات متعددة
(على سبيل المثال، يمكن أن تكون بعض الطبقات بتنسيق sRGB والأخرى بتنسيق sRGB الموسّع، ولكل منها
مسار ألوان خاص به) عندما يكون هناك أكثر من مساحة ألوان واحدة مرئية، يجب تحويل بعض مساحات
الألوان إلى مساحة ألوان الشاشة. من الأفضل أن يقدّم محرّك العرض
هذه العملية على أفضل وجه (وإلا على Android
تنفيذ عملية التركيب باستخدام وحدة معالجة الرسومات).
الاختبار
لاختبار إدارة الألوان، استخدِم المراجع التالية في
opengl/tests:
gl2_basic هو إصدار تجريبي بسيط من OpenGL يطلب استخدام colorspace Display-P3.
EGL_test
اختبارات لضمان توفُّر الإضافات والإعدادات اللازمة (10:10:10:2 وFP16)
test_wide_color تنشئ سطحًا بالطريقة نفسها التي يستخدمها
SurfaceFlinger (على سبيل المثال، الإعدادات ومساحة الألوان وتنسيق البكسل).
التنفيذ المرجعي
للحصول على مرجع تنفيذ، يُرجى الرجوع إلى frameworks/native. بالنسبة إلى
العناوين، يُرجى الرجوع إلى:
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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_*`"]]