示例#1
0
 public ArtworkFormat(ArtworkUsage usage, short width, short height, short correlationId,
                      int size, PixelFormat pformat, short rotation)
 {
     this.usage         = usage;
     this.width         = width;
     this.height        = height;
     this.correlationId = correlationId;
     this.size          = size;
     this.pformat       = pformat;
     this.rotation      = rotation;
 }
示例#2
0
 public ArtworkFormat(ArtworkUsage usage, short width, short height, short correlationId,
     int size, PixelFormat pformat, short rotation)
 {
     this.usage = usage;
     this.width = width;
     this.height = height;
     this.correlationId = correlationId;
     this.size = size;
     this.pformat = pformat;
     this.rotation = rotation;
 }
示例#3
0
        public ReadOnlyCollection <ArtworkFormat> LookupArtworkFormats(ArtworkUsage usage)
        {
            List <ArtworkFormat> list = new List <ArtworkFormat> ();

            foreach (ArtworkFormat format in artwork_formats.Values)
            {
                if (format.Usage == usage)
                {
                    list.Add(format);
                }
            }

            return(new ReadOnlyCollection <ArtworkFormat> (list));
        }
示例#4
0
        private void ParseArtwork(XmlNodeList photoNodes, ArtworkUsage artworkUsage)
        {
            foreach (XmlNode formatNode in photoNodes) {
                ArtworkUsage usage = artworkUsage;
                short width = 0;
                short height = 0;
                short correlationId = 0;
                int size = 0;
                PixelFormat pformat = PixelFormat.Unknown;
                short rotation = 0;

                string key = null;
                for (XmlNode child = formatNode.FirstChild; child != null; child = child.NextSibling) {
                    if (child.Name == "key") {
                        key = child.InnerText;
                        continue;
                    }

                    if (key != null)
                        switch (key) {
                        case "FormatId":
                            correlationId = short.Parse (child.InnerText);
                            break;
                        case "RenderWidth":
                            width = short.Parse (child.InnerText);
                            break;
                        case "RenderHeight":
                            height = short.Parse (child.InnerText);
                            break;
                        case "PixelFormat":
                            switch (child.InnerText) {
                            case "4C353635":
                                pformat = PixelFormat.Rgb565;
                                break;
                            case "42353635":
                                pformat = PixelFormat.Rgb565BE;
                                break;
                            case "32767579":
                                pformat = PixelFormat.IYUV;
                                break;
                            default:
                                pformat = PixelFormat.Unknown;
                                break;
                            }
                            break;
                        case "Rotation":
                            rotation = short.Parse (child.InnerText);
                            break;
                        }
                }

                size = width * height * 2;

                if (!(correlationId == 0 || width == 0 || height == 0 || size == 0))
                    formats.Add (correlationId, new ArtworkFormat (usage, width, height, correlationId, size, pformat, rotation));
            }
        }
示例#5
0
文件: Device.cs 项目: mono/ipod-sharp
        public ReadOnlyCollection<ArtworkFormat> LookupArtworkFormats(ArtworkUsage usage)
        {
            List<ArtworkFormat> list = new List<ArtworkFormat> ();
            foreach (ArtworkFormat format in artwork_formats.Values) {
                if (format.Usage == usage) {
                    list.Add (format);
                }
            }

            return new ReadOnlyCollection<ArtworkFormat> (list);
        }
示例#6
0
        private void ParseArtwork(XmlNodeList photoNodes, ArtworkUsage artworkUsage)
        {
            foreach (XmlNode formatNode in photoNodes)
            {
                ArtworkUsage usage         = artworkUsage;
                short        width         = 0;
                short        height        = 0;
                short        correlationId = 0;
                int          size          = 0;
                PixelFormat  pformat       = PixelFormat.Unknown;
                short        rotation      = 0;

                string key = null;
                for (XmlNode child = formatNode.FirstChild; child != null; child = child.NextSibling)
                {
                    if (child.Name == "key")
                    {
                        key = child.InnerText;
                        continue;
                    }

                    if (key != null)
                    {
                        switch (key)
                        {
                        case "FormatId":
                            correlationId = short.Parse(child.InnerText);
                            break;

                        case "RenderWidth":
                            width = short.Parse(child.InnerText);
                            break;

                        case "RenderHeight":
                            height = short.Parse(child.InnerText);
                            break;

                        case "PixelFormat":
                            switch (child.InnerText)
                            {
                            case "4C353635":
                                pformat = PixelFormat.Rgb565;
                                break;

                            case "42353635":
                                pformat = PixelFormat.Rgb565BE;
                                break;

                            case "32767579":
                                pformat = PixelFormat.IYUV;
                                break;

                            default:
                                pformat = PixelFormat.Unknown;
                                break;
                            }
                            break;

                        case "Rotation":
                            rotation = short.Parse(child.InnerText);
                            break;
                        }
                    }
                }

                size = width * height * 2;

                if (!(correlationId == 0 || width == 0 || height == 0 || size == 0))
                {
                    formats.Add(correlationId, new ArtworkFormat(usage, width, height, correlationId, size, pformat, rotation));
                }
            }
        }