Search for usage in LXR

PerceptualColor::RgbColorSpaceFactory Class Reference

#include <rgbcolorspacefactory.h>

Static Public Member Functions

static QStringList colorProfileDirectories ()
static QSharedPointer< PerceptualColor::RgbColorSpace > createFromFile (const QString &fileName)
static QSharedPointer< PerceptualColor::RgbColorSpace > createSrgb ()

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:

// Create the color space object with the factory class.
// This call might be slow.
// These calls are fast:
// Create a widget with the color space:
// Create another widget with the very same color space:
new PerceptualColor::ColorWheel(myColorSpace);

Definition at line 35 of file rgbcolorspacefactory.h.

Member Function Documentation

◆ colorProfileDirectories()

QStringList PerceptualColor::RgbColorSpaceFactory::colorProfileDirectories ( )

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.

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.
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.

◆ createFromFile()

QSharedPointer< PerceptualColor::RgbColorSpace > PerceptualColor::RgbColorSpaceFactory::createFromFile ( const QString & fileName)

Try to create a color space object for a given ICC file.

This function may fail to create the color space object when it cannot open the given file, or when the file cannot be interpreted.
This function is called from the main thread.
fileNameThe 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.
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.

◆ createSrgb()

QSharedPointer< PerceptualColor::RgbColorSpace > PerceptualColor::RgbColorSpaceFactory::createSrgb ( )

Create an sRGB color space object.

This is build-in, no external ICC file is used.

This function is called from the main thread.
A shared pointer to the newly created color space object.

Definition at line 36 of file rgbcolorspacefactory.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 12:04:37 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.