public void SetImage(TextureInfo value)
 {
     image = value;
 }
 private void ReadImage(XmlNode node)
 {
     XmlAttribute attr;
     attr = node.Attributes["Name"];
     string name = attr.Value;
     float xPos = float.Parse(node.Attributes["XPos"].Value);
     float yPos = float.Parse(node.Attributes["YPos"].Value);
     float width = float.Parse(node.Attributes["Width"].Value);
     float height = float.Parse(node.Attributes["Height"].Value);
     TextureInfo texInfo = new TextureInfo(this, name, new PointF(xPos, yPos), new SizeF(width, height));
     textures[name] = texInfo;
 }
 public static bool GetImage(string texture, out TextureAtlas imageset, out TextureInfo image)
 {
     imageset = null;
     image = null;
     bool createdImageset = false;
     string imageName = null;
     string imagesetName = null;
     string[] vals = null;
     if (texture != null) {
         char[] delims = { '/', '\\' };
         vals = texture.Split(delims);
     }
     if (vals != null && vals.Length >= 3) {
         imagesetName = vals[1];
         imageName = vals[2];
         if (!AtlasManager.Instance.ContainsKey(imagesetName)) {
             // Load the additional plugin imageset
             string imagesetFile =
                 AssetManager.Instance.ResolveResourceData("Imageset", imagesetName + ".xml");
             if (imagesetFile == null) {
                 log.WarnFormat("Invalid imageset: {0}", imagesetName);
                 return false;
             }
             imageset = AtlasManager.Instance.CreateAtlas(imagesetFile);
             createdImageset = true;
         }
         imageset = AtlasManager.Instance.GetTextureAtlas(imagesetName);
         if (imageset.ContainsKey(imageName))
             image = imageset.GetTextureInfo(imageName);
     }
     return createdImageset;
 }
 /// <summary>
 ///   Build a TextureInfo object based on the pixel offsets passed in.
 /// </summary>
 /// <param name="textureName"></param>
 /// <param name="points">These are the points, and are in pixel count space.</param>
 /// <returns></returns>
 public TextureInfo DefineImage(string textureName, PointF[] points)
 {
     PointF[] uvArray = new PointF[4];
     #if TEXEL_OFFSET
     uvArray[0] = new Point((points[0].x + .5f) / texture.Width, (points[0].y + .5f) / texture.Height);
     uvArray[1] = new Point((points[1].x - .5f) / texture.Width, (points[1].y + .5f) / texture.Height);
     uvArray[2] = new Point((points[2].x + .5f) / texture.Width, (points[2].y - .5f) / texture.Height);
     uvArray[3] = new Point((points[3].x - .5f) / texture.Width, (points[3].y - .5f) / texture.Height);
     #else
     uvArray[0] = new PointF(points[0].X / texture.Width, points[0].Y / texture.Height);
     uvArray[1] = new PointF(points[1].X / texture.Width, points[1].Y / texture.Height);
     uvArray[2] = new PointF(points[2].X / texture.Width, points[2].Y / texture.Height);
     uvArray[3] = new PointF(points[3].X / texture.Width, points[3].Y / texture.Height);
     #endif
     TextureInfo textureInfo = new TextureInfo(this, name, uvArray);
     //if (textures.ContainsKey(textureName))
     //    throw new Exception("duplicate image definition");
     textures[textureName] = textureInfo;
     return textureInfo;
 }
 public TextureInfo DefineImage(string textureName, RectangleF rect)
 {
     TextureInfo textureInfo = new TextureInfo(this, name, rect);
     //if (textures.ContainsKey(textureName))
     //    throw new Exception("duplicate image definition");
     textures[textureName] = textureInfo;
     return textureInfo;
 }
 public TextureInfo DefineImage(string textureName, Rect rect)
 {
     PointF point = new PointF(rect.Left, rect.Top);
     SizeF size = new SizeF(rect.Width, rect.Height);
     TextureInfo textureInfo = new TextureInfo(this, name, point, size);
     //if (textures.ContainsKey(textureName))
     //    throw new Exception("duplicate image definition");
     textures[textureName] = textureInfo;
     return textureInfo;
 }
 public TextureInfo DefineImage(string textureName, PointF point, SizeF size)
 {
     TextureInfo textureInfo = new TextureInfo(this, textureName, point, size);
     textures[textureName] = textureInfo;
     return textureInfo;
 }
 public void SetImage(TextureInfo value)
 {
     image = value;
 }