示例#1
0
        private unsafe short PropertyGetProc(uint signature, uint key, int index, IntPtr *simpleProperty, Handle *complexProperty)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.PropertySuite, string.Format("Sig: {0}, Key: {1}, Index: {2}", DebugUtils.PropToString(signature), DebugUtils.PropToString(key), index.ToString()));
#endif
            if (signature != PSConstants.kPhotoshopSignature)
            {
                return(PSError.errPlugInPropertyUndefined);
            }

            short error = PSError.noErr;

            byte[] bytes = null;

            switch (key)
            {
            case PSProperties.BigNudgeH:
            case PSProperties.BigNudgeV:
                error = GetSimpleProperty(simpleProperty, new Fixed16(PSConstants.Properties.BigNudgeDistance).Value);
                break;

            case PSProperties.Caption:
                if (complexProperty != null)
                {
                    *complexProperty = HandleSuite.Instance.NewHandle(0);
                }
                break;

            case PSProperties.ChannelName:
                string name = string.Empty;
                switch (index)
                {
                case 0:
                    name = Resources.RedChannelName;
                    break;

                case 1:
                    name = Resources.GreenChannelName;
                    break;

                case 2:
                    name = Resources.BlueChannelName;
                    break;

                case 3:
                    name = Resources.AlphaChannelName;
                    break;

                default:
                    return(PSError.errPlugInPropertyUndefined);
                }

                bytes = Encoding.ASCII.GetBytes(name);

                error = CreateComplexPropertyHandle(complexProperty, bytes);
                break;

            case PSProperties.Copyright:
            case PSProperties.Copyright2:
                error = GetSimpleProperty(simpleProperty, false);
                break;

            case PSProperties.EXIFData:
            case PSProperties.XMPData:
                if (complexProperty != null)
                {
                    // If the complexProperty is not IntPtr.Zero we return a valid zero byte handle, otherwise some filters will crash with an access violation.
                    *complexProperty = HandleSuite.Instance.NewHandle(0);
                }
                break;

            case PSProperties.GridMajor:
                error = GetSimpleProperty(simpleProperty, new Fixed16(PSConstants.Properties.GridMajor).Value);
                break;

            case PSProperties.GridMinor:
                error = GetSimpleProperty(simpleProperty, PSConstants.Properties.GridMinor);
                break;

            case PSProperties.ImageMode:
                error = GetSimpleProperty(simpleProperty, PSConstants.plugInModeRGBColor);
                break;

            case PSProperties.InterpolationMethod:
                error = GetSimpleProperty(simpleProperty, PSConstants.Properties.InterpolationMethod.NearestNeghbor);
                break;

            case PSProperties.NumberOfChannels:
                error = GetSimpleProperty(simpleProperty, numberOfChannels);
                break;

            case PSProperties.NumberOfPaths:
                error = GetSimpleProperty(simpleProperty, 0);
                break;

            case PSProperties.WorkPathIndex:
            case PSProperties.ClippingPathIndex:
            case PSProperties.TargetPathIndex:
                error = GetSimpleProperty(simpleProperty, PSConstants.Properties.NoPathIndex);
                break;

            case PSProperties.RulerUnits:
                error = GetSimpleProperty(simpleProperty, PSConstants.Properties.RulerUnits.Pixels);
                break;

            case PSProperties.RulerOriginH:
            case PSProperties.RulerOriginV:
                error = GetSimpleProperty(simpleProperty, new Fixed16(0).Value);
                break;

            case PSProperties.SerialString:
                bytes = Encoding.ASCII.GetBytes(HostSerial);

                error = CreateComplexPropertyHandle(complexProperty, bytes);
                break;

            case PSProperties.URL:
                if (complexProperty != null)
                {
                    *complexProperty = HandleSuite.Instance.NewHandle(0);
                }
                break;

            case PSProperties.Title:
            case PSProperties.UnicodeTitle:
                string title = "temp.pdn";     // some filters just want a non empty string
                if (key == PSProperties.UnicodeTitle)
                {
                    bytes = Encoding.Unicode.GetBytes(title);
                }
                else
                {
                    bytes = Encoding.ASCII.GetBytes(title);
                }

                error = CreateComplexPropertyHandle(complexProperty, bytes);
                break;

            case PSProperties.WatchSuspension:
                error = GetSimpleProperty(simpleProperty, false);
                break;

            case PSProperties.DocumentWidth:
                error = GetSimpleProperty(simpleProperty, documentWidth);
                break;

            case PSProperties.DocumentHeight:
                error = GetSimpleProperty(simpleProperty, documentHeight);
                break;

            case PSProperties.ToolTips:
                error = GetSimpleProperty(simpleProperty, true);
                break;

            case PSProperties.HighDpi:
                error = GetSimpleProperty(simpleProperty, highDpi);
                break;

            default:
                return(PSError.errPlugInPropertyUndefined);
            }

            return(error);
        }
示例#2
0
        private void BufferUnlockProc(IntPtr bufferID)
        {
#if DEBUG
            DebugUtils.Ping(DebugFlags.BufferSuite, string.Format("Buffer: 0x{0}", bufferID.ToHexString()));
#endif
        }