diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/quartz/utils.h | 1 | ||||
-rw-r--r-- | vcl/quartz/utils.cxx | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h index 2452c151d28e..a2a39f2605d2 100644 --- a/vcl/inc/quartz/utils.h +++ b/vcl/inc/quartz/utils.h @@ -44,6 +44,7 @@ std::ostream &operator <<(std::ostream& s, const CGPoint &rPoint); std::ostream &operator <<(std::ostream& s, const CGSize &rSize); std::ostream &operator <<(std::ostream& s, CGColorRef pSize); std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform); +std::ostream &operator <<(std::ostream& s, CGColorSpaceRef cs); #endif // INCLUDED_VCL_INC_QUARTZ_UTILS_H diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx index 0e0ac8f4d90a..1bbd5cdde873 100644 --- a/vcl/quartz/utils.cxx +++ b/vcl/quartz/utils.cxx @@ -158,4 +158,60 @@ std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform) return s; } +std::ostream &operator <<(std::ostream& s, CGColorSpaceRef cs) +{ +#ifndef SAL_LOG_INFO + (void) cs; +#else + if (cs == nullptr) + { + s << "null"; + return s; + } + + CGColorSpaceModel model = CGColorSpaceGetModel(cs); + switch (model) + { + case kCGColorSpaceModelUnknown: + s << "Unknown"; + break; + case kCGColorSpaceModelMonochrome: + s << "Monochrome"; + break; + case kCGColorSpaceModelRGB: + s << "RGB"; + if (CGColorSpaceIsWideGamutRGB(cs)) + s << " (wide gamut)"; + break; + case kCGColorSpaceModelCMYK: + s << "CMYK"; + break; + case kCGColorSpaceModelLab: + s << "Lab"; + break; + case kCGColorSpaceModelDeviceN: + s << "DeviceN"; + break; + case kCGColorSpaceModelIndexed: + s << "Indexed (" << CGColorSpaceGetColorTableCount(cs) << ")"; + break; + case kCGColorSpaceModelPattern: + s << "Pattern"; + break; + case kCGColorSpaceModelXYZ: + s << "XYZ"; + break; + default: + s << "?(" << model << ")"; + break; + } + + CFStringRef name = CGColorSpaceCopyName(cs); + if (name != NULL) + s << " (" << [(NSString *)name UTF8String] << ")"; + + return s; +#endif +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |