Esempio n. 1
0
        public ManagedBitmap ShrinkExpandWPF(ManagedBitmap source, double factor, Profile profile)
        {
            EnsureStarted(profile);

            ManagedBitmap result = new ManagedBitmap32(source.Width, source.Height);

            profile.Push("Remote call");
            ClientServerCommunication.SendMessage(
                null /*log*/,
                channel,
                ClientServerCommunication.Commands.ShrinkExpandWPF,
                new object[]
            {
                (int)Thread.CurrentThread.Priority,
                (int)source.Width,
                (int)source.Height,
                (string)source.BackingName,
                (string)result.BackingName,
                (double)factor,
            });
            Profile serverProfile;

            ClientServerCommunication.WaitForDone(channel, out serverProfile);
            profile.Add(serverProfile);
            profile.Pop();

            return(result);
        }
Esempio n. 2
0
        public ManagedBitmap CreateTile(ManagedBitmap source, int offsetX, int offsetY, int drawWidth, int drawHeight, int targetWidth, int targetHeight, Profile profile)
        {
            EnsureStarted(profile);

            ManagedBitmap result;
            string        mapId;
            int           width, height;
            Profile       serverProfile;
            bool          succeeded = false;

            profile.Push("Remote call");
            ClientServerCommunication.SendMessage(
                null /*log*/,
                channel,
                ClientServerCommunication.Commands.CreateTileGDI,
                new object[]
            {
                (int)Thread.CurrentThread.Priority,
                (string)source.BackingName,
                (int)source.Width,
                (int)source.Height,
                (int)offsetX,
                (int)offsetY,
                (int)drawWidth,
                (int)drawHeight,
                (int)targetWidth,
                (int)targetHeight
            });
            try
            {
                ClientServerCommunication.WaitForPending(channel, out serverProfile, out mapId, out width, out height);
                profile.Add(serverProfile);
                result    = new ManagedBitmap32(width, height, mapId);
                succeeded = true;
            }
            catch (ClientServerCommunication.RemoteException)
            {
                result = ManagedBitmap.CreateFromGDI(new Bitmap(Properties.Resources.InvalidPlaceHolder));
            }
            profile.Pop();

            if (succeeded)
            {
                profile.Push("Remote call");
                ClientServerCommunication.SendMessage(
                    null /*log*/,
                    channel,
                    ClientServerCommunication.Commands.Clear,
                    null);
                ClientServerCommunication.WaitForDone(channel, out serverProfile);
                profile.Add(serverProfile);
                profile.Pop();
            }

            return(result);
        }
Esempio n. 3
0
        public ManagedBitmap LoadAndOrientGDI(string path, int rightRotations, Profile profile, out RotateFlipType exifOrientation)
        {
            EnsureStarted(profile);

            exifOrientation = RotateFlipType.RotateNoneFlipNone;

            ManagedBitmap result;
            string        mapId;
            int           width, height;
            Profile       serverProfile;
            bool          succeeded = false;

            profile.Push("Remote call");
            ClientServerCommunication.SendMessage(
                null /*log*/,
                channel,
                ClientServerCommunication.Commands.LoadAndOrientGDI,
                new object[]
            {
                (int)Thread.CurrentThread.Priority,
                (string)path,
                (int)rightRotations,
            });
            try
            {
                object[] extra = ClientServerCommunication.WaitForPending(channel, out serverProfile, out mapId, out width, out height);
                exifOrientation = (RotateFlipType)(int)extra[0];
                profile.Add(serverProfile);
                result    = new ManagedBitmap32(width, height, mapId);
                succeeded = true;
            }
            catch (ClientServerCommunication.RemoteException)
            {
                result = ManagedBitmap.CreateFromGDI(new Bitmap(Properties.Resources.InvalidPlaceHolder));
            }
            profile.Pop();

            if (succeeded)
            {
                profile.Push("Remote call");
                ClientServerCommunication.SendMessage(
                    null /*log*/,
                    channel,
                    ClientServerCommunication.Commands.Clear,
                    null);
                ClientServerCommunication.WaitForDone(channel, out serverProfile);
                profile.Add(serverProfile);
                profile.Pop();
            }

            return(result);
        }