コード例 #1
0
        public ComparePalettesForm()
        {
            InitializeComponent();

            picPaletteLeft.Image  = PalettesGDI.GetPaletteBitmap(PalettesGDI.Palettes[0]);
            picPaletteRight.Image = PalettesGDI.GetPaletteBitmap(PalettesGDI.Palettes[0]);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: skittles1/meridian59-dotnet
        public Main()
        {
            // init meridian colorpalettes
            ColorTransformation.Provider.Initialize();
            PalettesGDI.Initialize();

            InitializeComponent();
        }
コード例 #3
0
        private void cbPaletteRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            Image oldImg;

            if (picPaletteRight.Image != null)
            {
                oldImg = picPaletteRight.Image;
                picPaletteRight.Image = null;
                oldImg.Dispose();
            }

            picPaletteRight.Image = PalettesGDI.GetPaletteBitmap(
                (byte)cbPaletteRight.SelectedIndex);
        }
コード例 #4
0
        private void cbPaletteRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            Image oldImg;

            if (picPaletteRight.Image != null)
            {
                oldImg = picPaletteRight.Image;
                picPaletteRight.Image = null;
                oldImg.Dispose();
            }

            // pick palette or special vale palette
            ColorPalette pal = (cbPaletteRight.SelectedIndex > 255) ? PalettesGDI.PaletteVale
                : PalettesGDI.Palettes[(byte)cbPaletteRight.SelectedIndex];

            picPaletteRight.Image = PalettesGDI.GetPaletteBitmap(pal);
        }
コード例 #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public RootClient()
        {
            // startup async logging
            Logger.Start();

            // log client startup
            Logger.Log(MODULENAME, LogType.Info, "Initializing client");

            // save reference to mainthread
            MainThread = Thread.CurrentThread;

            // init tick info
            GameTick = new T();

            // check if system supports high resolution ticks (at least 1ms precision)
            if (!GameTick.IsHighResolution)
            {
                Logger.Log(MODULENAME, LogType.Warning, "System does not support high resolution ticks.");
            }

#if DRAWING
            // Initialize GDI variants of colorpalettes if System.Drawing available
            PalettesGDI.Initialize();
#endif

            // Initialize legacy resources (bgf, roo, ...)
            ResourceManager = new R();

            // Initialize DataController
            Data = new D();

            // read in config
            Config = new C();

            // Initialize Outfitter
            Outfitter = new Outfitter(Data.InventoryObjects);
        }
コード例 #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            PalettesGDI.Initialize();

            // init resources
            ResourceManager = new ResourceManager();
            ResourceManager.Init(
                "",
                "",
                "",
                Properties.Settings.Default.PathTextures,
                "",
                "",
                "");

            // create ui
            MainForm = new MainForm();

            // run
            Application.Run(MainForm);
        }
コード例 #7
0
        /// <summary>
        /// Handles the HTTP request
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            HttpResponse response = context.Response;
            // --------------------------------------------------------------------------------------------
            // 1) PARSE URL PARAMETERS
            // --------------------------------------------------------------------------------------------

            // read parameters from url-path (see Global.asax):
            RouteValueDictionary parms = context.Request.RequestContext.RouteData.Values;
            string parmNum             = parms.ContainsKey("num")    ? (string)parms["num"]    : null;
            string parmFormat          = parms.ContainsKey("format") ? (string)parms["format"] : null;

            byte index;

            // no filename or request type
            if (!Byte.TryParse(parmNum, out index) || String.IsNullOrEmpty(parmFormat))
            {
                context.Response.StatusCode = 404;
                return;
            }

            // set cache behaviour
            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.Cache.VaryByParams["*"] = false;
            context.Response.Cache.SetLastModified(BgfCache.LastModified);

            // --------------------------------------------------------------------------------------------
            // PALETTE IMAGE
            // --------------------------------------------------------------------------------------------
            if (parmFormat == "bmp")
            {
                response.ContentType = "image/bmp";
                response.AddHeader(
                    "Content-Disposition",
                    "inline; filename=palette-" + index.ToString() + ".bmp");

                Bitmap bmp = PalettesGDI.GetPaletteBitmap(PalettesGDI.Palettes[index]);
                bmp.Save(context.Response.OutputStream, ImageFormat.Bmp);
                bmp.Dispose();

                // create BMP (256 col) or PNG (32-bit) or return raw pixels (8bit indices)

                /*if (parm1 == "bmp")
                 * {
                 *  response.ContentType = "image/bmp";
                 *  response.AddHeader(
                 *      "Content-Disposition",
                 *      "inline; filename=" + entry.Bgf.Filename + "-" + index.ToString() + ".bmp");
                 *
                 *  Bitmap bmp = PalettesGDI.GetPaletteBitmap(PalettesGDI.Palettes[index]);
                 *  bmp.Save(context.Response.OutputStream, ImageFormat.Bmp);
                 *  bmp.Dispose();
                 * }
                 * else if (parm1 == "png")
                 * {
                 *  response.ContentType = "image/png";
                 *  response.AddHeader(
                 *      "Content-Disposition",
                 *      "inline; filename=" + entry.Bgf.Filename + "-" + index.ToString() + ".png");
                 *
                 *  Bitmap bmp = entry.Bgf.Frames[index].GetBitmapA8R8G8B8(palette);
                 *  bmp.Save(context.Response.OutputStream, ImageFormat.Png);
                 *  bmp.Dispose();
                 * }
                 * else if (parm1 == "bin")
                 * {
                 *  response.ContentType = "application/octet-stream";
                 *  response.AddHeader(
                 *      "Content-Disposition",
                 *      "attachment; filename=" + entry.Bgf.Filename + "-" + index.ToString() + ".bin");
                 *
                 *  byte[] pixels = entry.Bgf.Frames[index].PixelData;
                 *  context.Response.OutputStream.Write(pixels, 0, pixels.Length);
                 * }
                 * else
                 *  context.Response.StatusCode = 404;*/
            }

            // --------------------------------------------------------------------------------------------
            // JSON COLOR PALETTE
            // --------------------------------------------------------------------------------------------
            else if (parmFormat == "json")
            {
                // set response type
                response.ContentType     = "application/json";
                response.ContentEncoding = new System.Text.UTF8Encoding(false);
                response.AddHeader("Content-Disposition", "inline; filename=palette-" + index.ToString() + ".json");

                /////////////////////////////////////////////////////////////
                response.Write('[');
                for (int i = 0; i < ColorTransformation.Palettes[index].Length; i++)
                {
                    if (i > 0)
                    {
                        response.Write(',');
                    }

                    response.Write(ColorTransformation.Palettes[index][i].ToString());
                }
                response.Write(']');
            }

            // --------------------------------------------------------------------------------------------
            // INVALID
            // --------------------------------------------------------------------------------------------
            else
            {
                context.Response.StatusCode = 404;
                return;
            }
        }
コード例 #8
0
        static void Main()
        {
            // .net stuff
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // initialize color palettes
            PalettesGDI.Initialize();

            // init bgf data model
            CurrentFile = new BgfFile();
            CurrentFile.Frames.AllowEdit = true;

            // init roomobject model for viewer
            RoomObject          = new RoomObject();
            RoomObject.Resource = CurrentFile;

            // init imagecomposer for this roomobject
            ImageComposer = new ImageComposerGDI <RoomObject>();
            ImageComposer.UseViewerFrame = true;
            ImageComposer.DataSource     = RoomObject;

            // init mainform
            MainForm             = new MainForm();
            MainForm.FormClosed += OnMainFormFormClosed;
            MainForm.Show();

            // init shrinkform
            SettingsForm = new SettingsForm();
            SettingsForm.DataBindings.Add("Version", CurrentFile, "Version");
            SettingsForm.DataBindings.Add("ShrinkFactor", CurrentFile, "ShrinkFactor");
            SettingsForm.DataBindings.Add("Name", CurrentFile, "Name");

            // init addframsetindexform
            AddFrameSetIndexForm = new AddFrameSetIndexForm();

            // init ticker
            stopWatch = new Stopwatch();
            stopWatch.Start();

            // set running
            IsRunning = true;

            // start mainthread loop
            while (IsRunning)
            {
                long oldTick = Tick;

                // update current tick
                Tick = stopWatch.ElapsedTicks / MSTICKDIVISOR;

                long span = Tick - oldTick;

                // update roomobject
                if (IsPlaying)
                {
                    RoomObject.Tick(Tick, span);
                }

                // process window messages / events
                Application.DoEvents();

                // sleep
                Thread.Sleep(1);
            }
        }