private Cursor GetDragCursor(Image image) { if (image == null) { return(Cursors.Default); } image = GraphicExtensions.ResizeImage(imageListView.ThumbnailSize.Width, image); var imageBounds = new Rectangle(new Point(0, 0), image.Size); var result = new Bitmap(imageBounds.Width, imageBounds.Height); var resultGraphics = Graphics.FromImage(result); float[][] matrixItems = { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new[] { 0, 0, 0, 0.7f, 0 }, new float[] { 0, 0, 0, 0, 1 } }; var colorMatrix = new ColorMatrix(matrixItems); var imageAttributes = new ImageAttributes(); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); resultGraphics.DrawImage(image, imageBounds, imageBounds.X, imageBounds.Y, imageBounds.Width, imageBounds.Height, GraphicsUnit.Pixel, imageAttributes); var offset = new Point(imageBounds.Width / 2, imageBounds.Height / 2); return(GridDragDropHelper.CreateCursor(result, offset)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonExportCSP_Click(object sender, EventArgs e) { if (mxListBox1.SelectedItem is MEXCostume costume) { using (SaveFileDialog d = new SaveFileDialog()) { d.Filter = "PNG (*.png)|*.png"; if (d.ShowDialog() == DialogResult.OK) { using (var bmp = GraphicExtensions.TOBJToBitmap(costume.CSP)) bmp.Save(d.FileName); } } } }
/// <summary> /// /// </summary> private void RefreshPanel() { // enable edit panel if one icon is selected imageEditPanel.Visible = false; if (stageListBox.SelectedItems.Count == 1 && stageListBox.SelectedItem is MEXStageIcon icon) { imageEditPanel.Visible = true; if (nameTagBox.Image != null) { nameTagBox.Image.Dispose(); } nameTagBox.Image = GraphicExtensions.TOBJToBitmap(icon._previewText); iconBox.Image = icon.GetImage(); } }
/// <summary> /// /// </summary> private void RefreshSelected() { if (mxListBox1.SelectedItem is MEXCostume costume) { if (cspBox.Image != null) { cspBox.Image.Dispose(); } cspBox.Image = GraphicExtensions.TOBJToBitmap(costume.CSP); gawButton.Visible = MEX.Fighters.IndexOf(_fighter) == GAWIndex; if (MEX.Fighters.IndexOf(_fighter) == GAWIndex) { mxPropertyGrid1.SelectedObject = MEX.GaWColors[mxListBox1.SelectedIndex]; } else { mxPropertyGrid1.SelectedObject = costume; } } mxListBox1.Invalidate(); }