MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / importImage

Method importImage

Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp:1156–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1154}
1155
1156void CtrlrPanelCanvas::importImage (const File &imageFile, int x, int y)
1157{
1158 if (owner.getOwner().getResourceManager().addResource (imageFile))
1159 {
1160 AlertWindow::showMessageBox(AlertWindow::InfoIcon, "Image import", "Can't import the file as a image resource");
1161 return;
1162 }
1163
1164 Image i = owner.getOwner().getResourceManager().getResourceAsImage(imageFile.getFileNameWithoutExtension());
1165
1166 if (i == Image())
1167 {
1168 AlertWindow::showMessageBox(AlertWindow::InfoIcon, "Image import", "Image has been imported as a resource, but i can't fetch if from the resource manager");
1169 return;
1170 }
1171
1172 CtrlrComponent *c = addNewComponent(Ids::uiImage, Point<int>(x,y));
1173 if (c)
1174 {
1175 c->setProperty(Ids::uiImageResource, imageFile.getFileNameWithoutExtension());
1176 c->setSize (i.getWidth(), i.getHeight());
1177 }
1178}
1179
1180void CtrlrPanelCanvas::fitSelection()
1181{

Callers

nothing calls this directly

Calls 9

ImageClass · 0.85
addResourceMethod · 0.80
getResourceAsImageMethod · 0.80
getOwnerMethod · 0.45
setPropertyMethod · 0.45
setSizeMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected