Пример #1
0
        public static bool IsCanCutImage(TexturesInfo tex)
        {
            Bitmap tmpBitmap = GetBitmap(tex);

            Point originalSize = new Point(tmpBitmap.Width, tmpBitmap.Width);
            Point begin = tex.Begin;
            Point size = tex.Size;

            if ((begin.X > originalSize.X) || ((begin.X + size.X) > originalSize.X)) return false;
            if ((begin.Y > originalSize.Y) || ((begin.Y + size.Y) > originalSize.Y)) return false;
            return true;
        }
Пример #2
0
        private void cmdAddTexture_Click(object sender, RoutedEventArgs e)
        {
            string tmp = "";
            if (Dialogs.InputBox("Имя нового текстуры", "Введите имя новой текстуры", ref tmp) ==
                System.Windows.Forms.DialogResult.OK)
            {
                TexturesInfo tmpTexturesInfo = new TexturesInfo {Name = tmp};

                int index = ((ResoursesInfo)(lstTextureFilesName.SelectedItem)).IDResourses;
                int textureIndex = EngineMain.TextureListByID(lstTexturesResoursesPacksNames.SelectedIndex,
                    index);
                TexturesList tmpTexturesList =
                    EngineMain.ResPacks[lstTexturesResoursesPacksNames.SelectedIndex].TexturesInfoList[textureIndex];

                if (tmpTexturesList.TextureList.Count != 0)
                    tmpTexturesInfo.ID = tmpTexturesList.TextureList[tmpTexturesList.TextureList.Count - 1].ID;

                tmpTexturesList.TextureList.Add(tmpTexturesInfo);
                EngineMain.SortTexturesInfo();
                UpdateTabTexturesList();
                lstTexturesList.SelectedItem = (tmpTexturesInfo.ToString());
            }
        }
Пример #3
0
 public static Bitmap GetBitmap(TexturesInfo tex)
 {
     return new Bitmap(EngineMain.GetFullResoursesPath(tex.ImageFileName));
 }
Пример #4
0
 public static ImageSource ImageSourceFromBitmap(TexturesInfo tex)
 {
     Bitmap bmp = GetBitmap(tex);
     return Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(),
                 IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
 }
Пример #5
0
 public static Bitmap CutImage(TexturesInfo tex)
 {
     Bitmap tmpBitmap = new Bitmap(EngineMain.GetFullResoursesPath(tex.ImageFileName));
     return tmpBitmap.Clone(new Rectangle(tex.Begin.X, tex.Begin.Y, tex.Size.X, tex.Size.Y), tmpBitmap.PixelFormat);
 }