/// <summary>Sends the request off. Callbacks such as onreadystatechange will be triggered.</summary> public void send() { if (readyState_ == 0) { // Act like it just opened: readyState = 1; } // Do we have a file protocol handler available? FileProtocol fileProtocol = location.Handler; if (fileProtocol == null) { return; } // Some protocols enforce a particular content type. // E.g. Dynamic:// always is "dyn". string fileType = fileProtocol.ContentType(location); // Some file formats internally cache. // This means we can entirely avoid hitting the protocol system. // Get the format for the type: Contents = ImageFormats.GetInstance(fileType); // Did it internally cache? if (Contents.InternallyCached(location, this)) { // Yes it did! return; } fileProtocol.OnGetGraphic(this); }
/// <summary>Assign the given image to this package.</summary> public void AssignImage(Texture image) { // Get the contents as a picture block: PictureFormat picture = Contents as PictureFormat; if (picture == null) { // Clear the package: Clear(); // Get the picture format: Contents = ImageFormats.GetInstance("pict"); // Update picture var: picture = Contents as PictureFormat; } // Apply the image: picture.Image = image; }