Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
This commit is contained in:
commit
6c7911a602
|
@ -94,6 +94,12 @@ void SoFCOffscreenRenderer::writeToImage (QImage& img) const
|
||||||
|
|
||||||
void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* comment, const SbMatrix& mat, const QImage& image)
|
void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* comment, const SbMatrix& mat, const QImage& image)
|
||||||
{
|
{
|
||||||
|
if (image.isNull()) {
|
||||||
|
std::stringstream str;
|
||||||
|
str << "Cannot save null image.";
|
||||||
|
throw Base::ValueError(str.str());
|
||||||
|
}
|
||||||
|
|
||||||
Base::FileInfo file(filename);
|
Base::FileInfo file(filename);
|
||||||
if (file.hasExtension("JPG") || file.hasExtension("JPEG")) {
|
if (file.hasExtension("JPG") || file.hasExtension("JPEG")) {
|
||||||
// writing comment in case of jpeg (Qt ignores setText() in case of jpeg)
|
// writing comment in case of jpeg (Qt ignores setText() in case of jpeg)
|
||||||
|
@ -163,13 +169,15 @@ void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* c
|
||||||
f.close();
|
f.close();
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
str << "Cannot save image to file '" << filename << "'.";
|
str << "Cannot save image to file '" << filename << "'.";
|
||||||
throw Base::Exception(str.str());
|
throw Base::ValueError(str.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
str << "Cannot open file '" << filename << "' for writing.";
|
str << "Cannot open file '" << filename << "' for writing.";
|
||||||
throw Base::Exception(str.str());
|
Base::FileException e;
|
||||||
|
e.setMessage(str.str());
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -899,7 +899,7 @@ void View3DInventorViewer::savePicture(int w, int h, const QColor& bg, QImage& i
|
||||||
#if (COIN_MAJOR_VERSION >= 4)
|
#if (COIN_MAJOR_VERSION >= 4)
|
||||||
// The behaviour in Coin4 has changed so that when using the same instance of 'SoFCOffscreenRenderer'
|
// The behaviour in Coin4 has changed so that when using the same instance of 'SoFCOffscreenRenderer'
|
||||||
// multiple times internally the biggest viewport size is stored and set to the SoGLRenderAction.
|
// multiple times internally the biggest viewport size is stored and set to the SoGLRenderAction.
|
||||||
// The trick is to add a callback node and override the viewport size with wath we want.
|
// The trick is to add a callback node and override the viewport size with what we want.
|
||||||
//SoCallback* cbvp = new SoCallback;
|
//SoCallback* cbvp = new SoCallback;
|
||||||
//cbvp->setCallback(setViewportCB);
|
//cbvp->setCallback(setViewportCB);
|
||||||
//root->addChild(cbvp);
|
//root->addChild(cbvp);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user