示例#1
0
        public virtual NSColor ColorUsingColorSpaceName(NSString colorSpace, NSDictionary deviceDescription)
        {
            if (colorSpace == null)
            {
                if (deviceDescription != null)
                    colorSpace = (NSString)deviceDescription.ObjectForKey(NSColorSpace.NSDeviceColorSpaceName);
                if (colorSpace == null)
                    colorSpace = NSColorSpace.NSDeviceRGBColorSpace;
            }
            if (colorSpace.IsEqualToString(ColorSpaceName))
            {
                return this;
            }

            if (colorSpace.IsEqualToString(NSColorSpace.NSNamedColorSpace))
            {
                // FIXME: We cannot convert to named color space.
                return null;
            }

            //[self subclassResponsibility: _cmd);

            return null;
        }
示例#2
0
        public override NSColor ColorUsingColorSpaceName(NSString colorSpace, NSDictionary deviceDescription)
        {
            NSColorList list;
            NSColor real;

            if (colorSpace == null)
            {
                if (deviceDescription != null)
                    colorSpace = (NSString)deviceDescription.ObjectForKey(NSColorSpace.NSDeviceColorSpaceName);
                // FIXME: If the deviceDescription is nil, we should get it from the
                // current view or printer
                if (colorSpace == null)
                    colorSpace = NSColorSpace.NSCalibratedRGBColorSpace;
            }
            if (colorSpace.IsEqualToString(this.ColorSpaceName))
            {
                return this;
            }

            namedColorLock.Lock();
            if (false == colorSpace.IsEqualToString(_cached_name_space))
            {
                list = NSColorList.ColorListNamed(_catalog_name);
                real = list.ColorWithKey(_color_name);
                _cached_color = real.ColorUsingColorSpaceName(colorSpace, deviceDescription);
                _cached_name_space = colorSpace;
            }
            real = _cached_color;
            namedColorLock.Unlock();

            return real;
        }
示例#3
0
 public virtual void SetPreferredFilename(NSString filename)
 {
     if (filename == null || filename.IsEqualToString(""))
     {
         NSException.Raise("NSInternalInconsistencyException", "Empty or nil argument to setPreferredFilename: ");
     }
     else
     {
         _preferredFilename = filename;
     }
 }