internal void SetBlipType(ushort imageFormat) { byte bliptype = BlipType.FromImageFormat(imageFormat); Instance = bliptype; BlipTypeWin32 = bliptype; BlipTypeMacOS = bliptype; BlipRecord.Instance = BlipSignature.FromBlipType(bliptype); }
internal Blip(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipSignature blipSignature) : base(0, (uint)blipSignature, escherType, (uint)(imageLength + 16 + 1)) { m_rgbUID = checkSum; m_bTag = byte.MaxValue; m_streamIndex = streamIndex; m_imageLength = imageLength; }
private uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature, int workSheetId) { if (m_clusters.ContainsKey(workSheetId)) { int dgID = m_clusters[workSheetId]; m_drawingGroup.IncrementShapeCount(dgID); } else { m_clusters.Add(workSheetId, (ushort)(m_clusters.Count + 1)); int dgID = m_clusters.Count; m_drawingGroup.AddCluster(dgID); m_drawingGroup.IncrementShapeCount(dgID); } return(m_bStoreContainer.AddImage(checkSum, streamIndex, imageLength, escherType, blipType, blipSignature)); }
internal uint AddImage(byte[] checkSum, int streamIndex, int imageLength, EscherType escherType, BlipType blipType, BlipSignature blipSignature) { if (m_bSEList == null) { m_bSEList = new Hashtable(); } string @string = Encoding.ASCII.GetString(checkSum); if (m_bSEList.ContainsKey(@string)) { BlipStoreEntry obj = (BlipStoreEntry)m_bSEList[@string]; obj.ReferenceCount++; return(obj.ReferenceIndex); } if (m_blipList == null) { m_blipList = new ArrayList(); } Blip blip = new Blip(checkSum, streamIndex, imageLength, escherType, blipSignature); m_blipList.Add(blip); base.Instance = (uint)m_blipList.Count; BlipStoreEntry value = new BlipStoreEntry(checkSum, blipType, blip.Length, (uint)m_blipList.Count); m_bSEList.Add(@string, value); m_totalLength += 44 + imageLength + 8 + 16 + 1; return((uint)m_blipList.Count); }
internal uint AddImage(Stream imageData, ImageFormat format, string imageName, int workSheetId, out uint startSPID, out ushort dgID) { EscherType escherType = EscherType.MSOFBTUNKNOWN; BlipType blipType = BlipType.MSOBLIPUNKNOWN; BlipSignature blipSignature = BlipSignature.MSOBIUNKNOWN; if (format.Equals(ImageFormat.Bmp)) { escherType = EscherType.MSOFBTBLIP_DIB; blipType = BlipType.MSOBLIPDIB; blipSignature = BlipSignature.MSOBIDIB; } else if (format.Equals(ImageFormat.Jpeg)) { escherType = EscherType.MSOFBTBLIP_JPEG; blipType = BlipType.MSOBLIPJPEG; blipSignature = BlipSignature.MSOBIJFIF; } else if (format.Equals(ImageFormat.Gif)) { escherType = EscherType.MSOFBTBLIP_GIF; blipType = BlipType.MSOBLIPPNG; blipSignature = BlipSignature.MSOBIPNG; } else if (format.Equals(ImageFormat.Png)) { escherType = EscherType.MSOFBTBLIP_GIF; blipType = BlipType.MSOBLIPPNG; blipSignature = BlipSignature.MSOBIPNG; } if (m_clusters == null) { m_clusters = new Dictionary <int, ushort>(); } if (m_bStoreContainer == null) { m_bStoreContainer = new BlipStoreContainer(); } if (m_imageTable == null) { m_imageTable = new Dictionary <string, CheckSumImage>(); } int num = (int)imageData.Length; CheckSumImage checkSumImage; if (m_imageTable.ContainsKey(imageName)) { checkSumImage = m_imageTable[imageName]; } else { byte[] checkSum = CheckSum(imageData); int streamIndex = m_bStoreContainer.GetStreamPosFromCheckSum(checkSum); if (streamIndex == -1) { UpdateImageStreamDGC(imageName, imageData, escherType, out streamIndex); } checkSumImage = new CheckSumImage(checkSum, streamIndex); m_imageTable.Add(imageName, checkSumImage); } if (escherType == EscherType.MSOFBTBLIP_DIB) { num -= 14; StreamList[checkSumImage.StreamIndex].Offset = 14; } uint result = AddImage(checkSumImage.CheckSum, checkSumImage.StreamIndex, num, escherType, blipType, blipSignature, workSheetId); dgID = m_clusters[workSheetId]; startSPID = m_drawingGroup.GetStartingSPID(dgID); return(result); }