Commit e6d74a87 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add convenience methods for getting a gray colorspace

parent 59a2e1f3
......@@ -577,6 +577,52 @@ const KoColorSpace * KoColorSpaceRegistry::alpha32f()
return d->alphaF32Cs;
}
const KoColorSpace *KoColorSpaceRegistry::graya8(const QString &profile)
{
if (profile.isEmpty()) {
KoColorSpaceFactory* factory = d->colorSpaceFactoryRegistry.get(GrayAColorModelID.id());
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), factory->defaultProfile());
}
else {
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), profile);
}
}
const KoColorSpace *KoColorSpaceRegistry::graya8(const KoColorProfile *profile)
{
if (!profile) {
return graya8();
}
else {
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), profile);
}
}
const KoColorSpace *KoColorSpaceRegistry::graya16(const QString &profile)
{
if (profile.isEmpty()) {
KoColorSpaceFactory* factory = d->colorSpaceFactoryRegistry.get(GrayAColorModelID.id());
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer16BitsColorDepthID.id(), factory->defaultProfile());
}
else {
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer16BitsColorDepthID.id(), profile);
}
}
const KoColorSpace *KoColorSpaceRegistry::graya16(const KoColorProfile *profile)
{
if (!profile) {
return graya8();
}
else {
return KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), profile);
}
}
const KoColorSpace * KoColorSpaceRegistry::rgb8(const QString &profileName)
{
......
......@@ -245,6 +245,39 @@ public:
#endif
const KoColorSpace *alpha32f();
/**
* Convenience method to get a GRAYA 8 bit colorspace. If a profile is not specified,
* the default profile defined in the GRAY colorspace will be used
* @param profile the profile name
* @return an 8 bit graya colorspace with the default profile or 0.
*/
const KoColorSpace *graya8(const QString &profile = QString());
/**
* Convenience method to get a GRAYA 8 bit colorspace. If a profile is not specified,
* the default profile defined in the GRAY colorspace will be used
* @param profile the profile
* @return an 8 bit graya colorspace with the default profile or 0.
*/
const KoColorSpace *graya8(const KoColorProfile *profile);
/**
* Convenience method to get a GRAYA 16 bit colorspace. If a profile is not specified,
* the default profile defined in the GRAY colorspace will be used
* @param the profile
* @return an 8 bit graya colorspace with the default profile or 0.
*/
const KoColorSpace *graya16(const QString &profile = QString());
/**
* Convenience method to get a GRAYA 16 bit colorspace. If a profile is not specified,
* the default profile defined in the GRAY colorspace will be used
* @param the profile
* @return an 8 bit graya colorspace with the default profile or 0.
*/
const KoColorSpace *graya16(const KoColorProfile *profile);
/**
* Convenience method to get an RGBA 8bit colorspace. If a profile is not specified,
* an sRGB profile will be used.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment