public MImgElement Clone(MImgsManager parentT) { MImgElement newElement = new MImgElement(parentT); newElement.name = name + ""; newElement.image = image; newElement.imageTextured = imageTextured; newElement.forbidOptimize = forbidOptimize; newElement.strAlphaImage = strAlphaImage; newElement.strPmt = strPmt; newElement.alpha = alpha; newElement.linkID = linkID; return newElement; }
public MImgElement Clone(MImgsManager parentT) { MImgElement newElement = new MImgElement(parentT); newElement.name = name + ""; newElement.image = image; newElement.imageTextured = imageTextured; newElement.forbidOptimize = forbidOptimize; newElement.strAlphaImage = strAlphaImage; newElement.strPmt = strPmt; newElement.alpha = alpha; newElement.linkID = linkID; return(newElement); }
public void CastBaseClip(MImgElement imgElementNew) { if (optmizeClip != null) { optmizeClip.clipElement.clipRect.X = (int)m_dX; optmizeClip.clipElement.clipRect.Y = (int)m_dY; optmizeClip.clipElement.clipRect.Width = (int)m_dWidth; optmizeClip.clipElement.clipRect.Height = (int)m_dHeight; if (imgElementNew != null) { optmizeClip.clipElement.imageElement = imgElementNew; } //映射到子矩形 optmizeClip.CastSubClipList(imgElementNew); } }
public bool renameImage(String newName) { if (this.name == null) { return(false); } //改变文件名称 String path = Consts.PATH_PROJECT_FOLDER + Consts.SUBPARH_IMG + name; String newPath = Consts.PATH_PROJECT_FOLDER + Consts.SUBPARH_IMG + newName; if (File.Exists(newPath)) { MessageBox.Show("已经存在同名文件"); return(false); } if (File.Exists(path)) { File.Copy(path, newPath); File.Delete(path); } //检查动画图片中的同类名字 MImgsManager imsManager = ((MImgsManager)parent).form_Main.form_MAnimation.form_MImgsList.mImgsManager; for (int i = 0; i < imsManager.Count(); i++) { MImgElement imgElement = imsManager[i]; if (!imgElement.Equals(this) && imgElement.name.Equals(name)) { imgElement.name = newName; } } //检查地图图片中的同类名字 imsManager = ((MImgsManager)parent).form_Main.mapImagesManager; for (int i = 0; i < imsManager.Count(); i++) { MImgElement imgElement = imsManager[i]; if (!imgElement.Equals(this) && imgElement.name.Equals(name)) { imgElement.name = newName; } } this.name = newName; return(true); }
//判断名字是否相等(包括半透明图片、半透明度、调色板信息) public bool equalsOnName(MImgElement compareElement) { if (compareElement == null) { return(false); } if (!name.Equals(compareElement.name)) { return(false); } if (!strAlphaImage.Equals(compareElement.strAlphaImage)) { return(false); } if (!strPmt.Equals(compareElement.strPmt)) { return(false); } if (alpha != compareElement.alpha) { return(false); } return(true); }
public TileClip(MImgElement imageElementP,Rectangle clipRectP, int xP, int yP) { imageElement = imageElementP; clipRect = clipRectP; x = xP; y = yP; }
//生成处理后的图片,此图片在图片对象newImgElement中,并且当保存完成之后会被销毁 private void SaveGenImage(String strFormat, String subFolderName, MImgElement newImgElement) { Image imgExort = newImgElement.image; //bmp图片添加背景色 if (strFormat.Equals("bmp") && imgExort != null) { Bitmap imgTemp = new Bitmap(imgExort.Width, imgExort.Height, PixelFormat.Format32bppArgb); Graphics gTemp = Graphics.FromImage(imgTemp); GraphicsUtil.fillRect(gTemp, 0, 0, imgExort.Width, imgExort.Height, 0xFF00FF); GraphicsUtil.drawClip(gTemp, imgExort, 0, 0, 0, 0, imgExort.Width, imgExort.Height, 0); imgExort.Dispose(); gTemp.Dispose(); imgExort = imgTemp; } //保存图片 String newName = subFolderName + MiscUtil.getPureFileName(newImgElement.name) + "." + strFormat; if (imgExort != null) { imgExort.Save(newName); } else { MessageBox.Show("导出图片" + newImgElement.name + "时发生错误,请检查源图格式!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } newImgElement.exportSize = imgExort.Size; imgExort.Dispose(); newImgElement.image = null; }
public void AddHistory_ImgRename(MImgElement imgelement) { HistoryValue_ImgRename nextValue_ImgRename = new HistoryValue_ImgRename(); nextValue_ImgRename.imgElement = imgelement; nextValue_ImgRename.destName = imgelement.name; HistoryItem_ImgRename item = new HistoryItem_ImgRename(this); item.setValue(preValue_ImgRename, nextValue_ImgRename); AddItem(item); form_MA.refreshHistoryButtons(); ReadyHistory_ImgRename(imgelement); }
//历史记录--------图片重命名 public void ReadyHistory_ImgRename(MImgElement imgelement) { preValue_ImgRename = new HistoryValue_ImgRename(); preValue_ImgRename.imgElement = imgelement; preValue_ImgRename.destName = imgelement.name; }
public void CastSubClipList(MImgElement imgElementNew) { foreach (OptmizeClip subClip in subClips) { //将CLIP根据父剪切区的翻转而翻转------------------------ subClip.clipElement.clipRect.X = clipElement.clipRect.X + subClip.clipElement.clipRect.X - clipRectOld.X; subClip.clipElement.clipRect.Y = clipElement.clipRect.Y + subClip.clipElement.clipRect.Y - clipRectOld.Y; if (imgElementNew != null) { subClip.clipElement.imageElement = imgElementNew; } subClip.CastSubClipList(imgElementNew); } }
//获得映射图片 public static MImgElement getMappedImage(ObjectVector imgMappingList, MImgElement imgElementFrom) { if (imgMappingList == null) { return null; } for (int i = 0; i < imgMappingList.getElementCount(); i++) { Object obj = imgMappingList.getElement(i); if (!(obj is ImageMappingElement)) { return null; } ImageMappingElement imgMaElement = (ImageMappingElement)obj; if (imgMaElement.ImgFrom.Equals(imgElementFrom)) { return imgMaElement.ImgTo; } } return null; }
//设置属性 public void setImageValue(MImgElement p_ImageElement, Rectangle p_clipRect) { imageElement = p_ImageElement; clipRect = p_clipRect; resetImgClip(); }
//判断名字是否相等(包括半透明图片、半透明度、调色板信息) public bool equalsOnName(MImgElement compareElement) { if (compareElement == null) { return false; } if (!name.Equals(compareElement.name)) { return false; } if (!strAlphaImage.Equals(compareElement.strAlphaImage)) { return false; } if (!strPmt.Equals(compareElement.strPmt)) { return false; } if (alpha != compareElement.alpha) { return false; } return true; }