Initial StaticData platform abstraction

This commit is contained in:
John Lewin 2014-11-25 07:47:03 -08:00
parent 62730c186d
commit eba756966b
23 changed files with 113 additions and 127 deletions

View file

@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
hoverBackgroundColor = new RGBA_Bytes(100, 100, 100);
Agg.Image.ImageBuffer arrowImage = new Agg.Image.ImageBuffer();
ImageIO.LoadImageData(Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", "icon_arrow_left_16x16.png"), arrowImage);
StaticData.Instance.LoadImage(Path.Combine("Icons", "icon_arrow_left_16x16.png"), arrowImage);
arrowIndicator = new ImageWidget(arrowImage);
arrowIndicator.HAnchor = Agg.UI.HAnchor.ParentCenter;
arrowIndicator.VAnchor = Agg.UI.VAnchor.ParentCenter;

View file

@ -130,8 +130,8 @@ namespace MatterHackers.MatterControl
// set background images
if (noThumbnailImage.Width == 0)
{
ImageIO.LoadImageData(this.GetImageLocation(noThumbnailFileName), noThumbnailImage);
ImageIO.LoadImageData(this.GetImageLocation(buildingThumbnailFileName), buildingThumbnailImage);
StaticData.Instance.LoadImage(Path.Combine("Icons", noThumbnailFileName), noThumbnailImage);
StaticData.Instance.LoadImage(Path.Combine("Icons", buildingThumbnailFileName), buildingThumbnailImage);
}
this.thumbnailImage = new ImageBuffer(buildingThumbnailImage);
@ -179,13 +179,13 @@ namespace MatterHackers.MatterControl
{
case ImageSizes.Size115x115:
{
ImageIO.LoadImageData(this.GetImageLocation(Path.ChangeExtension("icon_sd_card_115x115", partExtension)), thumbnailWidget.thumbnailImage);
StaticData.Instance.LoadImage(Path.Combine("Icons", Path.ChangeExtension("icon_sd_card_115x115", partExtension)), thumbnailWidget.thumbnailImage);
}
break;
case ImageSizes.Size50x50:
{
ImageIO.LoadImageData(this.GetImageLocation(Path.ChangeExtension("icon_sd_card_50x50", partExtension)), thumbnailWidget.thumbnailImage);
StaticData.Instance.LoadImage(Path.Combine("Icons", Path.ChangeExtension("icon_sd_card_50x50", partExtension)), thumbnailWidget.thumbnailImage);
}
break;
@ -481,10 +481,5 @@ namespace MatterHackers.MatterControl
Stroke strokeRect = new Stroke(borderRect, BorderWidth);
graphics2D.Render(strokeRect, HoverBorderColor);
}
string GetImageLocation(string imageName)
{
return Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", imageName);
}
}
}

View file

@ -48,9 +48,11 @@ namespace MatterHackers.MatterControl.CreatorPlugins
ImageBuffer LoadImage(string imageName)
{
string path = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Icons", imageName);
string path = Path.Combine("Icons", imageName);
ImageBuffer buffer = new ImageBuffer(10, 10, 32, new BlenderBGRA());
ImageIO.LoadImageData(path, buffer);
StaticData.Instance.LoadImage(path, buffer);
return buffer;
}