PerceptualColor::RgbColorSpaceFactory
#include <rgbcolorspacefactory.h>
Static Public Member Functions | |
static QStringList | colorProfileDirectories () |
static QSharedPointer< PerceptualColor::RgbColorSpace > | createSrgb () |
static QSharedPointer< PerceptualColor::RgbColorSpace > | tryCreateFromFile (const QString &fileName) |
Detailed Description
Factory for color space objects.
These color space objects are needed in the constructors of various classes of this library.
Creating color space objects can be slow. But once created, they can be used simultaneously on various widgets. Thanks to the QSharedPointer, you can easily create a color space object, pass it to the widget constructors you like, and then forget about it – it will be deleted automatically when the last widget that used it has been deleted. And passing the shared pointer to widget constructors is fast! Usage example:
Definition at line 35 of file rgbcolorspacefactory.h.
Member Function Documentation
◆ colorProfileDirectories()
|
staticnodiscard |
List of directories where color profiles are typically stored on the current system.
Often, but not always, operating systems have an API to get access to this directories with color profiles or to get the actual color profile of a specific device (screen, printer…). On Linux, this is typically provided by colord. Also on Windows, there are specific API calls ([1] [2] [3] [4]) Some other operating systems have similar APIs.
The best solution is to rely on the operating system’s API. However, if you can’t use this API for some reasons, this function provides a last-resort alternative. Not all operating systems have standardised directories for colour profiles. This function provide a list of typical storage locations of ICC profile files and works satisfactorily for at least Linux, BSD, MacOS and Windows.
- Returns
- A preference-ordered list of typical storage locations of color profiles on the current system. The list might be empty if no color profile directories are found on the system. The returned directories use '/' as file separator regardless of the operating system, just as
QFile
expects. To find color profiles, parse these directories recursively, including subdirectories. Note that ICC colour profiles traditionally have a file name ending in.icm
on Windows systems and a name ending in.icc
on all other operating systems, but today on every operating system you might find actually both file name endings.
- Note
- This function takes into account environment variables, home directories and so on. Potential colour profile directories that do not actually exist on the current system are not returned. Since these values could change, another call of this function could return a different result.
Definition at line 106 of file rgbcolorspacefactory.cpp.
◆ createSrgb()
|
staticnodiscard |
Create an sRGB color space object.
This is build-in, no external ICC file is used.
- Precondition
- This function is called from the main thread.
- Returns
- A shared pointer to the newly created color space object.
Definition at line 36 of file rgbcolorspacefactory.cpp.
◆ tryCreateFromFile()
|
staticnodiscard |
Try to create a color space object for a given ICC file.
- Note
- This function may fail to create the color space object when it cannot open the given file, or when the file cannot be interpreted.
- Precondition
- This function is called from the main thread.
- Parameters
-
fileName The file name. See QFile
documentation for what are valid file names. The file is only used during the execution of this function and it is closed again at the end of this function. The created object does not need the file anymore, because all necessary information has already been loaded into memory. Accepted are most RGB-based ICC profiles up to version 4.
- Returns
- A shared pointer to a newly created color space object on success. A shared pointer to
nullptr
on fail.
Definition at line 57 of file rgbcolorspacefactory.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.