//------------------------------------------------------------------------- void QGuidoPainter::setResizePageToMusic(bool isOn) { if ( mResizePageToMusic != isOn ) { mResizePageToMusic = isOn; setGMNCode(gmnCode()); } }
//void GuidoViewer::export2Image (const File& file, ImageFileFormat* format) int guido2img::convert (guidosession* const currentSession) { ImageFileFormat *format; switch (currentSession->format_) { case GUIDO_WEB_API_PNG : format = new PNGImageFormat (); break; case GUIDO_WEB_API_JPEG : format = new JPEGImageFormat (); break; case GUIDO_WEB_API_GIF : format = new GIFImageFormat (); break; case GUIDO_WEB_API_SVG : assert (false); default : format = new PNGImageFormat (); break; } setGMNCode (currentSession->gmn_.c_str()); setPage (currentSession->page_); setResizePageToMusic (currentSession->resizeToPage_); GuidoPageFormat pagef; currentSession->fillGuidoPageFormatUsingCurrentSettings(&pagef); setGuidoPageFormat(pagef); Image::PixelFormat pf = Image::RGB; if (currentSession->format_ == GUIDO_WEB_API_PNG) pf = Image::ARGB; SoftwareImageType type; Image img (pf, currentSession->width_, currentSession->height_, true, type); Graphics g (img); if (pf == Image::RGB) { g.setColour (Colours::white); g.fillRect (0, 0, currentSession->width_, currentSession->height_); } GuidoComponent::paint(g); format->writeImageToStream (img, fBuffer); delete format; return 0; // need to fix this... }
//------------------------------------------------------------------------- void QGuidoPainter::setGuidoPageFormat(const GuidoPageFormat& pageFormat) { mPageFormat = pageFormat; setGMNCode( gmnCode() ); }