public StdPicture CreateStandardPicture(IMonikerAttributes monikerAttributes, Image image) { var pictureDisp = (IPictureDisp)GetIPictureDispFromPicture(image); var standardPicture = (dynamic)pictureDisp; return(standardPicture); }
public Image CreateImage(IMonikerAttributes monikerAttributes, IVsUIObject vsUiObject) { try { if (vsUiObject == null) { return(null); } var colorType = monikerAttributes.GetColorType(); var themedColor = _imageDataProvider.GetThemedColor(colorType); if (!themedColor.HasValue) { return(null); } var imageMoniker = _imageDataProvider.GetImageMoniker(vsUiObject); var image = _imageDataProvider.GetImage(imageMoniker, themedColor.Value); return(image); } catch { return(null); } }
public Image GetImage(IMonikerAttributes monikerAttributes) { var imageMoniker = monikerAttributes.ImageMoniker; var imageAttributes = monikerAttributes.GetImageAttributes(); var vsUiObject = _imageDataProvider.GetVsUiObject(imageMoniker, imageAttributes); var image = _imageMonikerCreator.CreateImage(monikerAttributes, vsUiObject); return(image); }
public StdPicture GetStandardPicture(IMonikerAttributes monikerAttributes) { var imageMoniker = monikerAttributes.ImageMoniker; var imageAttributes = monikerAttributes.GetImageAttributes(); var vsUiObject = _imageDataProvider.GetVsUiObject(imageMoniker, imageAttributes); var image = _imageMonikerCreator.CreateImage(monikerAttributes, vsUiObject); var standardPicture = _imageMonikerCreator.CreateStandardPicture(monikerAttributes, image); return(standardPicture); }
public Icon CreateIcon(IMonikerAttributes monikerAttributes, Image image) { Icon icon; var maxDimension = monikerAttributes.GetMaxDimension(); var imageBytes = _imageDataProvider.GetImageBytes(image); image.Dispose(); using (var memoryStream = new MemoryStream()) { var iconBytes = _imageDataProvider.GetIconBytes(imageBytes, maxDimension); memoryStream.Write(iconBytes, offset: 0, count: iconBytes.Length); memoryStream.Write(imageBytes, offset: 0, count: imageBytes.Length); memoryStream.Position = 0; icon = new Icon(memoryStream); } return(icon); }