예제 #1
0
        public virtual void imageBegin(int w, int h, int bucketSize)
        {
            if (writer == null)
            {
                return;
            }

            try {
                writer.openFile(filename);
                writer.writeHeader(w, h, bucketSize);
            } catch (IOException e) {
                UI.printError(UI.Module.IMG, "I/O error occured while preparing image for display: {0}", e.Message);
            }
        }
예제 #2
0
        public void save(string filename)
        {
            string       extension = FileUtils.getExtension(filename);
            BitmapWriter writer    = PluginRegistry.bitmapWriterPlugins.createObject(extension);

            if (writer == null)
            {
                UI.printError(UI.Module.IMG, "Unable to save file \"{0}\" - unknown file format: {1}", filename, extension);
                return;
            }
            try {
                writer.openFile(filename);
                writer.writeHeader(w, h, Math.Max(w, h));
                writer.writeTile(0, 0, w, h, color, alpha);
                writer.closeFile();
            } catch (IOException e) {
                UI.printError(UI.Module.IMG, "Unable to save file \"{0}\" - {1}", filename, e.Message);
            }
        }