/** * Testing function. */ void LC_SimpleTests::slotTestInsertImage() { RS_DEBUG->print("%s\n: begin\n", __func__); RS_Document* d = QC_ApplicationWindow::getAppWindow()->getDocument(); if (d) { RS_Graphic* graphic = (RS_Graphic*)d; if (graphic==NULL) { return; } RS_Image* image; RS_ImageData imageData; imageData = RS_ImageData(0, RS_Vector(50.0,30.0), RS_Vector(0.5,0.5), RS_Vector(-0.5,0.5), RS_Vector(640,480), "/home/andrew/data/image.png", 50, 50, 0); image = new RS_Image(graphic, imageData); image->setLayerToActive(); image->setPen(RS_Pen(RS_Color(255, 0, 0), RS2::Width01, RS2::SolidLine)); graphic->addEntity(image); } RS_DEBUG->print("%s\n: end\n", __func__); }
/** * Creates an image with the given data. */ RS_Image* RS_Creation::createImage(RS_ImageData& data) { if (document!=NULL && handleUndo) { document->startUndoCycle(); } RS_Image* img = new RS_Image(container, data); img->setLayerToActive(); img->setPenToActive(); img->update(); if (container!=NULL) { container->addEntity(img); } if (document!=NULL && handleUndo) { document->addUndoable(img); document->endUndoCycle(); } if (graphicView!=NULL) { graphicView->drawEntity(img); } return img; }