void THTMLSelection::createCutFlowGraph(std::string content)
{
	size_t found = content.find_first_of("\n");
	while(found!=string::npos){
		content.replace(found,1,"<br>");
		found = content.find_first_of("\n");
	}
	stringstream sectionContent;
	sectionContent<<"<p>\n<pre>\n"<<content<<"\n</pre>\n</p>\n";

	sectionContent<<"<h3>Cut Flow Diagrams</h3>\n";
	sectionContent<<"<h4>Silicon Cuts</h4>\n";
	sectionContent<<"<p>\n";
	sectionContent<<"First Pie Chart shows the cuts for the silicon Plane, <br>\n";
	sectionContent<<" - noSilTrack (red) means that there is not in each Silicon Detector one and only one Silicon Cluster<br>\n";
	sectionContent<<" - notInFidCut (green) means that there is one and only one Cluster in each silicon plane, but the mean Position is not lying in the fiducial cuts<br>\n";
	sectionContent<<" - notExactlyOneDiamondCluster (blue), means that it has a valid silicon Track but there is not exactly one Cluster in the diamond detector<br>\n";
	sectionContent<<" - useForAlignment (yellow) are Events which have a valid Sil Track and have one and only one Cluster in the diamond hit. With the training track fraction they are choosen for Alignment<br>\n";
	sectionContent<<" - useForAnalysis (pink) are Events which have a valid Sil Track and have one and only one Cluster in the diamond hit. With the training track fraction they are choosen for Analysis<br>\n";
	sectionContent<<putImage(this->path,(string)"cMainCutFlow","png",50)<<"<br>\n";
	sectionContent<<"</p>\n";
	sectionContent<<"<h4>Diamond Cuts</h4>\n";
	sectionContent<<"<p>\n";
	sectionContent<<"This is a Pie Chart of all Events which have a valid Silicon Track (e.g. one and only one Cluster in each detector && mean is in fiducialCut area).<br>\n";
	sectionContent<<"the point notExactlyOneDiamondCluster from the chart above is divided into moreThanOneDiamondCluster and noDiamondCluster<br>\n";
	sectionContent<<"with that pie chart you can see the efficency of the diamond <br>\n";
	sectionContent<<putImage(this->path,(string)"cPieValidSiliconTrack","png",50);
	sectionContent<<"<br>\n";

	sectionContent<<putImage(this->path,(string)"hAnalysisFraction","png",70);
	sectionContent<<"<br></p>";
	this->addSection("CutFlow",sectionContent.str());

}
예제 #2
0
void TopLevel::flipPage()
{
  if(!thispage || !Image || !faxqtwin || !display_is_setup)
    return;

  XDefineCursor(qtdisplay, Win, WorkCursor);
  XFlush(qtdisplay);

  XImage *newflipimage = FlipImage(Images[0]);

  XDefineCursor(qtdisplay, Win, ReadyCursor);

  if(newflipimage == NULL){ // out of memory
    return;
  }

  thispage->extra = Images[0] = newflipimage;
  thispage->orient ^= TURN_U;

  freeImages();
  Image = generateZoomImages(oz);

  Refresh = Resize = 1;
  putImage();
}
예제 #3
0
void TopLevel::rotatePage()
{
  if(!thispage || !Image || !faxqtwin || !display_is_setup)
    return;

  XDefineCursor(qtdisplay, Win, WorkCursor);
  XFlush(qtdisplay);

  XImage *newrotimage = RotImage(Images[0]);

  XDefineCursor(qtdisplay, Win, ReadyCursor);

  if(newrotimage == NULL){ // out of memory
    return;
  }

  thispage->extra = Images[0] = newrotimage;
  thispage->orient ^= TURN_L;

  freeImages();
  Image = generateZoomImages(oz);

  { int t = xpos ; xpos= ypos; ypos= t; }

  Refresh = Resize = 1;

  putImage();
}
예제 #4
0
void Widget_CheckBox::paintEvent(WidgetPaintEvent* event)
{
    auto p = event->painter();
    p->strokeRect({0, 0, width(), height()}, Color(31, 31, 31), Color(190, 190, 190), 2);
    if(isChecked())
    {
        p->putImage(g_check_texture, {0, 0});
    }
}
예제 #5
0
void TopLevel::scrollVert(int ){

  if(!Image)
    return;

  //  printf("vsb value: %d\n",vsb->value());
  ypos=  vsb->value() + qwindow_height/2;

  Refresh = 1;
  putImage();
}
예제 #6
0
void TopLevel::scrollHorz(int){

  if(!Image)
    return;

  //  printf("hsb value: %d\n",hsb->value());
  xpos=  hsb->value() + qwindow_width/2;

  Refresh = 1;
  putImage();
}
예제 #7
0
파일: dimeclient.cpp 프로젝트: 119-org/TND
int main(const int argc, const char *const *const argv) { 
	if (4 != argc) {
		printf("usage: %s imagename outputfilename\n", argv[0]);
		return 1;
	}
	int nRet = 0;
	nRet = getImage(argv[1], argv[2], argv[3]);
	if (0 == nRet) {
		nRet = putImage(argv[1], argv[2], argv[3]);
	}
	return nRet;
}
void THTMLSelection::createFiducialCuts()
{
	stringstream sectionContent;
	sectionContent<<"<h3>Fiducial Cut - valid Silicon Track</h3>\n";
	sectionContent<<"<p>\n";
	sectionContent<<"The Fiducial cut is applied to the mean of the position of the cluster in each plane.\n ";
	sectionContent<<"To find good values for the fiducial cut. The mean position of all silicon planes is calculated\n ";
	sectionContent<<"and plotted in the next plot. To be able to calculate this mean position one and only one Cluster\n";
	sectionContent<<"in each detector is required.<br>\n";
	sectionContent<<(putImage(this->path,(string)"chFidCutSilicon_OneAndOnlyOneCluster","png",50));
	sectionContent<<"</p>\n";
	sectionContent<<"<br>\n";
	sectionContent<<"<h3>Fiducial Cut - valid Silicon Track && at least one Diamond Cluster</h3>\n";
	sectionContent<<"<p>\n";
	sectionContent<<"The next plot shows the mean position of the clusters in each silicon plane with one and only one\n";
	sectionContent<<"cluster in the diamond detector. With this condition you can see the needed fiducial cuts to calculate\n";
	sectionContent<<"efficency in the diamond detector.<br>\n";
	sectionContent<<(putImage(this->path,(string)"chFidCutSilicon_OneAndOnlyOneCluster_DiamondCluster","png",50))<<"<br>\n";

	sectionContent<<putImage(this->path,(string)"chProjX","png",49)<<" \n";
	sectionContent<<putImage(this->path,(string)"chProjY","png",49)<<"<br>\n";

    sectionContent<<"<h3>Fiducial Cut - valid Silicon Track && exactly one Diamond Cluster</h3>\n";
    sectionContent<<"<p>\n";
    sectionContent<<"The next plot shows the mean position of the clusters in each silicon plane with one and only one\n";
    sectionContent<<"cluster in the diamond detector. With this condition you can see the needed fiducial cuts to calculate\n";
    sectionContent<<"efficency in the diamond detector.<br>\n";
    sectionContent<<(putImage(this->path,(string)"chFidCutSilicon_OneAndOnlyOneCluster_DiamondCluster","png",50))<<"<br>\n";

	sectionContent<<putImage(this->path,(string)"chSelectedEvents","png",50)<<" \n";

	sectionContent<<"</p>\n";
	this->addSection("Fiducial Cut",sectionContent.str());
}
예제 #9
0
    void Presentation::drawScroller(Presentation *prs, const char *image1,
            const char *image2, const char *image3, IplImage* leftArrow, IplImage *rightArrow){
        char filepath[80];
        snprintf(filepath, sizeof(filepath), "tmp/1/%s", image1);
        IplImage *img1 = cvLoadImage(filepath, CV_LOAD_IMAGE_UNCHANGED);
        snprintf(filepath, sizeof(filepath), "tmp/1/%s", image2);
        IplImage *img2 = cvLoadImage(filepath, CV_LOAD_IMAGE_UNCHANGED);
        snprintf(filepath, sizeof(filepath), "tmp/1/%s", image3);
        IplImage *img3 = cvLoadImage(filepath, CV_LOAD_IMAGE_UNCHANGED);
        /* Each image occupies 17% of scroller height and 67% of scroller lenght
         * Each arrow occupies 7% of scroller height and 50% of scroller lenght
         * Space between images and images and arrows - 7%
         */
        //calculations of relative coordinates
        putImage(cvPoint(prs->scrollerUL[0].x, prs->scrollerUL[0].y), cvPoint(prs->scrollerBR[0].x, prs->scrollerBR[0].y), leftArrow);
        putImage(cvPoint(prs->scrollerUL[1].x, prs->scrollerUL[1].y), cvPoint(prs->scrollerBR[1].x, prs->scrollerBR[1].y), img1);
         putImage(cvPoint(prs->scrollerUL[2].x, prs->scrollerUL[2].y), cvPoint(prs->scrollerBR[2].x, prs->scrollerBR[2].y), img2);
        putImage(cvPoint(prs->scrollerUL[3].x, prs->scrollerUL[3].y), cvPoint(prs->scrollerBR[3].x, prs->scrollerBR[3].y), img3);
        putImage(cvPoint(prs->scrollerUL[4].x, prs->scrollerUL[4].y), cvPoint(prs->scrollerBR[4].x, prs->scrollerBR[4].y), rightArrow);

        applyBuffer();
     }
void THTMLLandaus::addLandauDiamond(Float_t width, Float_t MP, Float_t area, Float_t GSigma)
{
	stringstream sectionContent;
	sectionContent<<"<p>\n";
	sectionContent<<"Two dimensional distribution of ClusterCharge vs. ClusterSize for all Events which are used\n";
	sectionContent<<"for Alignment or Analysis, i.e. one and only one cluster in ALL detectors<br>\n";
	sectionContent<<putImage(this->path,(TString)"hLandauDiamond_OneCluster","png",50)<<"<br>\n";
	sectionContent<<"<br>\nThe next plot shows the Projection of the two dimensional plot to the x axis.<br\n";
	sectionContent<<"This is the Plot for all ClusterSizes. ";
	sectionContent<<putImage(this->path,(TString)"c_hPulseHeightDiamondAll","png",49)<<" \n";
	sectionContent<<putImage(this->path,(TString)"c_hPulseHeigthDiamond_1_2_ClusterSize","png",49)<<"<br>\n";
	for(UInt_t i=1;i<8;i++){
		stringstream name;
		if(i<5) name<<"c_";
		name <<"hPulseHeigthDiamond_"<<i<<"_ClusterSize";
		sectionContent<<putImage(this->path,name.str(),"png",24)<<"\n"<<(i%4==0?"<br>":"");
	}
	sectionContent<<putImage(this->path,(TString)"cMVP_Landau_vs_ClusterSize","png",50)<<"<br>\n";
	//	sectionContent<<putImage(this->path,"hLandauDiamond_OneCluster","png",50)<<"<br>\n";
	sectionContent<<"</p>";

	this->addSection("Landau Distributions Diamond",sectionContent.str());

}
예제 #11
0
void TopLevel::nextPage()
{
  if(!thispage)
    return;

  if (thispage->next)
  {
    thispage = thispage->next;

    newPage();
    resizeView();
    putImage();
  }

  updateGoActions();
}
예제 #12
0
void TopLevel::prevPage()
{
  if(!thispage)
    return;

  if (thispage->prev)
  {
    thispage = thispage->prev;

    newPage();
    resizeView();
    putImage();
  }

  updateGoActions();
}
예제 #13
0
void TopLevel::lastPage()
{
  if(!thispage)
    return;

  if ( thispage->next )
  {
    while(thispage->next != NULL)
      thispage = thispage->next;

    newPage();
    resizeView();
    putImage();
  }

  updateGoActions();
}
예제 #14
0
void TopLevel::firstPage()
{
  if(!thispage)
    return;

  if ( thispage->prev )
  {
    while(thispage->prev != NULL)
      thispage = thispage->prev;

    newPage();
    resizeView();
    putImage();
  }

  updateGoActions();
}
예제 #15
0
Image* CSSGradientValue::image(RenderObject* renderer, const IntSize& size)
{
    ASSERT(m_clients.contains(renderer));
    
    // Need to look up our size.  Create a string of width*height to use as a hash key.
    Image* result = getImage(renderer, size);
    if (result)
        return result;
    
    if (size.isEmpty())
        return 0;
    
    // We need to create an image.
    result = new GeneratedImage(createGradient(renderer, size), size);
    putImage(size, result);

    return result;
}
예제 #16
0
void TopLevel::zoom( int factor )
{
  if(!thispage || !Image || !faxqtwin || !display_is_setup)
    return;

  Resize = Refresh = 1;

  Image = generateZoomImages(factor);

  PaneWidth = Image->width;
  PaneHeight = Image->height;

  resizeView();
  putImage();

  uiUpdate();

  updateZoomActions();
}
예제 #17
0
void TopLevel::openadd(QString filename)
{
  auxpage = lastpage;

  loadfile(filename);

  if( firstpage != lastpage )
  {
    if(auxpage->next)
      auxpage = auxpage->next;
  }

  // auxpage should now point to the first pagenode which was created for
  // the newly added fax file.
  have_no_fax = false;
  thispage = auxpage;
  newPage();
  resizeView();
  putImage();
}
예제 #18
0
void CD_disco(int type)
{
	
	putScreen(0, 0, "");
	putScreen(0, 0, "");
	
	unsigned discColor = 0;
	char discName[256];
		
	if(type==4)
	{
		sprintf(discName, "%s", "USE SWAP");
		discColor = GS_SET_RGBA(0x5A,0xD2,0x43,0x80);
	}
	if(type==2)
	{
		sprintf(discName, "%s", "PS2 CD-ROM");
		discColor = GS_SET_RGBA(0x12,0x00,0xFF,0x80);
	}
	if(type==3)
	{
		sprintf(discName, "%s", "PS2 DVD-ROM");
		discColor = GS_SET_RGBA(0xE3,0xCD,0x3B,0x80);
	}
	if(type==1)
	{
		sprintf(discName, "%s", "PSX CD-ROM");
		discColor = GS_SET_RGBA(0x00,0x00,0x00,0x80);
	}
	
	putBackground(img_fondo);
	myGsDriver->drawPipe.RectFlat(0,0,tvmx,60,0,colorNegro);
	myGsDriver->drawPipe.RectGouraud(0,420,colorNegro,tvmx,tvmy,colorAzul,0);
	myFont.uploadFont(fontTex, myGsDriver->getTextureBufferBase(), fontTex->TexWidth, 0, 0 );
	myFont.Print(420, tvmx, 15, 1, colorBlanco, GSFONT_ALIGN_LEFT, txt_1);
	myFont.Print(420, tvmx, 30, 1, colorNaranja, GSFONT_ALIGN_LEFT, "http://ps2dev.siirlabs.com");
	myGsDriver->drawPipe.RectFlat(55,125,591,367,0,colorBlanco);
	myGsDriver->drawPipe.Line(0,59,tvmx,59,0,colorGris2);
	myGsDriver->drawPipe.Line(0,420,tvmx,420,0,colorGris2);
	
	myFont.Print(53, tvmx, 97, 1, colorBlanco, GSFONT_ALIGN_LEFT, "CogSwap Loader");
	
	if(type > 0)
	{
		fillCircle(175, 245, 100, discColor);
		fillCircle(175, 245, 20, GS_SET_RGBA(0xFF,0xFF,0xFF,0x80));
		myFont.Print(304, 640, 196, 1, GS_SET_RGBA(0x0E,0x23,0xA1,0x80), GSFONT_ALIGN_LEFT, "Formato del disco:");
		myFont.Print(304, 640, 216, 1, GS_SET_RGBA(0x00,0x00,0x00,0x80), GSFONT_ALIGN_LEFT, (char *)discName);
	}
	else
	{
		myFont.Print(230, 640, 216, 1, GS_SET_RGBA(0x00,0x00,0x00,0x80), GSFONT_ALIGN_LEFT, "No Hay Disco");
	}
	
	putImage(img_logo, 21, 18);
	myFont.uploadFont(fontTex, myGsDriver->getTextureBufferBase(), fontTex->TexWidth, 0, 0 );
	myFont.Print(15, tvmx-15, 435, 1, colorGris2, GSFONT_ALIGN_LEFT, txt_40);
	
	myGsDriver->drawPipe.Flush();
	myGsDriver->WaitForVSync();
	myGsDriver->swapBuffers();
}
예제 #19
0
void MyServer::slotReadClient()
{

    QTcpSocket* pClientSocket = (QTcpSocket*)sender();

    QDataStream in(pClientSocket);
    in.setVersion(QDataStream::Qt_5_3);


    for(;;){

        if(!nextBlockSize){
            if(pClientSocket->bytesAvailable() < sizeof(quint32)) {
                break;
            }

            in >> nextBlockSize;
        }

        if(pClientSocket->bytesAvailable() < nextBlockSize) {
            break;
        }


        QString request;
        in >> request;

        QStringList req_param = request.split(" ");

        if(req_param.at(0) == "GETCURRENTVERSION")
            sendCurrVers(pClientSocket);

        if(req_param.at(0) == "GETSUBJECTS")
            sendArrayToClient(pClientSocket,getSubjects());

        if(req_param.at(0) == "GETTHEMES")
            sendArrayToClient(pClientSocket,getThemes(req_param.at(1)));

        if(req_param.at(0) == "GETPICTURES")
            sendArrayToClient(pClientSocket,getPictures(req_param.at(1),req_param.at(2)));

        if(req_param.at(0) == "GETIMAGE")
            sendImageToClient(pClientSocket,getImage(req_param.at(1)));

        if(req_param.at(0) == "PUTSUBJECT"){
            putSubject(req_param.at(1));
            version++;
        }
        if(req_param.at(0) == "PUTTHEME"){
            putTheme(req_param.at(1),req_param.at(2));
            version++;
        }
        if(req_param.at(0) == "PUTIMAGE")
        {
            QImage img;

            in >> img;

            quint32 k = putImage(img,req_param.at(1),req_param.at(2), req_param.at(3));
            version++;
            QList<QString> lst;
            lst << QString("%1").arg(k);
            sendArrayToClient(pClientSocket,lst);
        }
        if(req_param.at(0) == "DELETESUBJECT"){
            deleteSubject(req_param.at(1));
            version++;
        }
        if(req_param.at(0) == "DELETETHEME"){
            deleteTheme(req_param.at(1),req_param.at(2));
            version++;
        }
        if(req_param.at(0) == "DELETEIMAGE"){
            deleteImage(req_param.at(1));
            version++;
        }
        if(req_param.at(0) == "SWAPIMAGE"){
            QImage img;

            in >> img;

            swapImage(img,req_param.at(1));
            version++;
        }
예제 #20
0
파일: layer.cpp 프로젝트: gotomypc/Drawpile
void Layer::resize(int top, int right, int bottom, int left)
{
	// Minimize amount of data that needs to be copied
	optimize();

	// Resize sublayers
	foreach(Layer *sl, _sublayers)
		sl->resize(top, right, bottom, left);

	// Calculate new size
	int width = left + _width + right;
	int height = top + _height + bottom;

	int xtiles = Tile::roundTiles(width);
	int ytiles = Tile::roundTiles(height);
	QVector<Tile> tiles(xtiles * ytiles);

	// if there is no old content, resizing is simple
	bool hascontent = false;
	for(int i=0;i<_tiles.count();++i) {
		if(!_tiles.at(i).isBlank()) {
			hascontent = true;
			break;
		}
	}
	if(!hascontent) {
		_width = width;
		_height = height;
		_xtiles = xtiles;
		_ytiles = ytiles;
		_tiles = tiles;
		return;
	}

	// Sample colors around the layer edges to determine fill color
	// for the new tiles
	Tile bgtile;
	{
		QColor bgcolor = _sampleEdgeColors(this, top>0, right>0, bottom>0, left>0);
		if(bgcolor.alpha()>0)
			bgtile = Tile(bgcolor);
	}

	if((left % Tile::SIZE) || (top % Tile::SIZE)) {
		// If top/left adjustment is not divisble by tile size,
		// we need to move the layer content

		QImage oldcontent = toImage();

		_width = width;
		_height = height;
		_xtiles = xtiles;
		_ytiles = ytiles;
		_tiles = tiles;
		if(left<0 || top<0) {
			int cropx = 0;
			if(left<0) {
				cropx = -left;
				left = 0;
			}
			int cropy = 0;
			if(top<0) {
				cropy = -top;
				top = 0;
			}
			oldcontent = oldcontent.copy(cropx, cropy, oldcontent.width()-cropx, oldcontent.height()-cropy);
		}

		_tiles.fill(bgtile);

		putImage(left, top, oldcontent, false);

	} else {
		// top/left offset is aligned at tile boundary:
		// existing tile content can be reused

		const int firstrow = Tile::roundTiles(-top);
		const int firstcol = Tile::roundTiles(-left);

		int oldy = firstrow;
		for(int y=0;y<ytiles;++y,++oldy) {
			int oldx = firstcol;
			const int oldyy = _xtiles * oldy;
			const int yy = xtiles * y;
			for(int x=0;x<xtiles;++x,++oldx) {
				const int i = yy + x;

				if(oldy<0 || oldy>=_ytiles || oldx<0 || oldx>=_xtiles) {
					tiles[i] = bgtile;

				} else {
					const int oldi = oldyy + oldx;
					tiles[i] = _tiles.at(oldi);
				}
			}
		}

		_width = width;
		_height = height;
		_xtiles = xtiles;
		_ytiles = ytiles;
		_tiles = tiles;
	}
}
예제 #21
0
void BrushPreview::updatePreview()
{
#ifndef DESIGNER_PLUGIN
	if(!m_preview) {
		m_preview = new paintcore::LayerStack;
		m_previewCache = new paintcore::LayerStackPixmapCacheObserver(this);
		m_previewCache->attachToLayerStack(m_preview);
	}

	auto layerstack = m_preview->editor(0);

	if(m_preview->width() == 0) {
		const QSize size = contentsRect().size();
		layerstack.resize(0, size.width(), size.height(), 0);
		layerstack.createLayer(0, 0, QColor(0,0,0), false, false, QString());

	} else if(m_preview->width() != contentsRect().width() || m_preview->height() != contentsRect().height()) {
		layerstack.resize(0, contentsRect().width() - m_preview->width(), contentsRect().height() - m_preview->height(), 0);
	}

	QRectF previewRect(
		m_preview->width()/8,
		m_preview->height()/4,
		m_preview->width()-m_preview->width()/4,
		m_preview->height()-m_preview->height()/2
	);
	paintcore::PointVector pointvector;

	switch(_shape) {
	case Stroke: pointvector = brushes::shapes::sampleStroke(previewRect); break;
	case Line:
		pointvector
			<< paintcore::Point(previewRect.left(), previewRect.top(), 1.0)
			<< paintcore::Point(previewRect.right(), previewRect.bottom(), 1.0);
		break;
	case Rectangle: pointvector = brushes::shapes::rectangle(previewRect); break;
	case Ellipse: pointvector = brushes::shapes::ellipse(previewRect); break;
	case FloodFill:
	case FloodErase: pointvector = brushes::shapes::sampleBlob(previewRect); break;
	}

	QColor bgcolor = m_bg;

	brushes::ClassicBrush brush = m_brush;
	// Special handling for some blending modes
	// TODO this could be implemented in some less ad-hoc way
	if(brush.blendingMode() == paintcore::BlendMode::MODE_BEHIND) {
		// "behind" mode needs a transparent layer for anything to show up
		brush.setBlendingMode(paintcore::BlendMode::MODE_NORMAL);

	} else if(brush.blendingMode() == paintcore::BlendMode::MODE_COLORERASE) {
		// Color-erase mode: use fg color as background
		bgcolor = m_color;
	}

	if(_shape == FloodFill) {
		brush.setColor(bgcolor);
	}

	auto layer = layerstack.getEditableLayerByIndex(0);
	layer.putTile(0, 0, 99999, isTransparentBackground() ? paintcore::Tile() : paintcore::Tile(bgcolor));

	brushes::BrushEngine brushengine;
	brushengine.setBrush(1, 1, brush);

	for(int i=0;i<pointvector.size();++i)
		brushengine.strokeTo(pointvector[i], layer.layer());
	brushengine.endStroke();

	const auto dabs = brushengine.takeDabs();
	for(int i=0;i<dabs.size();++i)
		brushes::drawBrushDabsDirect(*dabs.at(i), layer);

	layer.mergeSublayer(1);

	if(_shape == FloodFill || _shape == FloodErase) {
		paintcore::FillResult fr = paintcore::floodfill(m_preview, previewRect.center().toPoint(), _shape == FloodFill ? m_color : QColor(), _fillTolerance, 0, false, 360000);
		if(_fillExpansion>0)
			fr = paintcore::expandFill(fr, _fillExpansion, m_color);
		if(!fr.image.isNull())
			layer.putImage(fr.x, fr.y, fr.image, _shape == FloodFill ? (_underFill ? paintcore::BlendMode::MODE_BEHIND : paintcore::BlendMode::MODE_NORMAL) : paintcore::BlendMode::MODE_ERASE);
	}

	m_needupdate=false;
#endif
}
예제 #22
0
void MainWindow::updateDisplayWindows(){
    if(stereo->flags.showInputImages){
        putImage(stereo->imageL[0],LEFT_WINDOW);
        putImage(stereo->imageR[0],RIGHT_WINDOW);

        ui->toggleBtnShowHist->hide();
        ui->toggleBtnShowXYZ->hide();
        ui->toggleBtnShowDispDepth->hide();
        ui->toggleBtnShowLeftImage->hide();
        ui->toggleBtnShowOverlay->hide();
    }

    if(stereo->flags.showDisparityMap){
        if(stereo->flags.showLeftOnLeftWindow){
            putImage(stereo->imageL[0],LEFT_WINDOW);
            ui->toggleBtnShowLeftImage->setText("ShowDisp");
        }else{
            putImage(stereo->disp.disp_8U,LEFT_WINDOW);
            ui->toggleBtnShowLeftImage->setText("ShowLeft");
        }

        if(stereo->flags.showOverlayOnRightWindow){
            putImage(stereo->morph.overlayView,RIGHT_WINDOW);
            ui->toggleBtnShowOverlay->setText("ShowDispBGR");
        }else{
            putImage(stereo->disp.disp_BGR,RIGHT_WINDOW);
            ui->toggleBtnShowOverlay->setText("ShowOverlay");
        }

        ui->toggleBtnShowHist->show();
        ui->toggleBtnShowXYZ->hide();
        ui->toggleBtnShowDispDepth->show();
        ui->toggleBtnShowLeftImage->show();
        ui->toggleBtnShowOverlay->show();
    }

    if(stereo->flags.show3Dreconstruction){
        putImage(stereo->view3D.disp3D_8U,LEFT_WINDOW);
        putImage(stereo->view3D.disp3D_BGR,RIGHT_WINDOW);

        ui->toggleBtnShowHist->hide();
        ui->toggleBtnShowXYZ->show();
        ui->toggleBtnShowDispDepth->hide();
        ui->toggleBtnShowLeftImage->hide();
        ui->toggleBtnShowOverlay->hide();
    }

    if(stereo->flags.showTrackingObjectView){
        if(stereo->flags.showLeftOnLeftWindow){
            putImage(stereo->disp.disp_8U,LEFT_WINDOW);
            ui->toggleBtnShowLeftImage->setText("ShowTrack");
        }else{
            putImage(stereo->morph.trackingView,LEFT_WINDOW);
            ui->toggleBtnShowLeftImage->setText("ShowDisp");
        }
        putImage(stereo->morph.imgThresholdDraw,RIGHT_WINDOW);

        ui->toggleBtnShowHist->hide();
        ui->toggleBtnShowXYZ->hide();
        ui->toggleBtnShowDispDepth->hide();
        ui->toggleBtnShowLeftImage->show();
        ui->toggleBtnShowOverlay->hide();
    }

    if(stereo->flags.showDiffImage && stereo->diff.StartDiff){
        putImage(stereo->diff.diffImage,LEFT_WINDOW);
        putImage(stereo->diff.res_AND,RIGHT_WINDOW);

        ui->toggleBtnShowHist->hide();
        ui->toggleBtnShowXYZ->hide();
        ui->toggleBtnShowDispDepth->hide();
        ui->toggleBtnShowLeftImage->hide();
        ui->toggleBtnShowOverlay->hide();
    }

    if(stereo->flags.showWarningLines && stereo->diff.StartDiff){
        putImage(stereo->diff.res_ADD,LEFT_WINDOW);
        putImage(stereo->diff.res_AND_BGR,RIGHT_WINDOW);

        ui->toggleBtnShowHist->hide();
        ui->toggleBtnShowXYZ->hide();
        ui->toggleBtnShowDispDepth->hide();
        ui->toggleBtnShowLeftImage->hide();
        ui->toggleBtnShowOverlay->hide();
    }
}
예제 #23
0
void TopLevel::handle_X_event(XEvent Event)
{
  if(!thispage || !Image || !faxqtwin || !display_is_setup)
    return;

  bool putimage = false; // Do we actually have to write the image to the scree?

  do {
    switch(Event.type) {
    case MappingNotify:
      XRefreshKeyboardMapping((XMappingEvent *)(&Event));
		break;

    case LeaveNotify:
      /*      buttondown = false;
	XDefineCursor(qtdisplay, Win, ReadyCursor);
	XFlush(qtdisplay);*/
      break;
    case Expose:
      {

	if(Event.xexpose.count != 0)
	  break;

	if(!Image)
	  break;

	putimage = TRUE;
      }
    break;

    case KeyPress:
      if (ExpectConfNotify &&
	  (Event.xkey.time < (Lasttime + PATIENCE)))
	break;
      Lasttime = Event.xkey.time;
      ExpectConfNotify = 0;
      switch(XKeycodeToKeysym(qtdisplay, Event.xkey.keycode, 0)) {
      case XK_m:
	mirrorPage();
	if (Event.xkey.state & ShiftMask)
	  TurnFollowing(TURN_M, thispage->next);
  	break;
      case XK_o:
	zoomout();
	break;

      case XK_i:
	zoomin();
	break;

      case XK_Up:
	ypos-= qwindow_height / 3;
	putimage = TRUE;
	break;
      case XK_Down:
	ypos+= qwindow_height / 3;
	putimage = TRUE;
	break;
      case XK_Left:
	xpos-= qwindow_width / 4;
	putimage = TRUE;
	break;
      case XK_Right:
	xpos+= qwindow_width / 4;
	putimage = TRUE;
	break;
      case XK_Home:
      case XK_R7:
	if (Event.xkey.state & ShiftMask) {
	  thispage = firstpage;
	  newPage();
	  resizeView();
	  putImage();
	  break;
	}
	xpos= 0;
	ypos= 0;
	putImage();
	break;
      case XK_End:
      case XK_R13:
	if (Event.xkey.state & ShiftMask) {
	  thispage = lastpage;
	  newPage();
	  resizeView();
	  putImage();
	  break;
	}
	xpos= Image->width;
	ypos= Image->height;
	putImage();
	break;
      case XK_l:
      case XK_r:
	rotatePage();
	if (Event.xkey.state & ShiftMask)
	  TurnFollowing(TURN_L, thispage->next);
	break;
      case XK_p:
      case XK_minus:
      case XK_Prior:
      case XK_R9:
      case XK_BackSpace:
	prevPage();
	break;
      case XK_n:
      case XK_plus:
      case XK_space:
      case XK_Next:
      case XK_R15:
	nextPage();
	break;
      case XK_u:
	flipPage();
	if (Event.xkey.state & ShiftMask)
	  TurnFollowing(TURN_U, thispage->next);
	break;

      case XK_q:
	if (viewpage) {
	  thispage = viewpage;
	  viewpage = NULL;
	  newPage();
	  resizeView();
	  putImage();
	}

      }

      break;

    case ButtonPress:

      if (ExpectConfNotify && (Event.xbutton.time < (Lasttime + PATIENCE)))
	break;

      Lasttime = Event.xbutton.time;
      ExpectConfNotify = 0;


      switch (Event.xbutton.button) {

      case Button1:
	buttondown = true;

	switch (((Image->width > qwindow_width)<<1) |
		(Image->height > qwindow_height)) {
	case 0:
	  break;
	case 1:
	  XDefineCursor(qtdisplay, Win, UDCursor);
	  break;
	case 2:
	  XDefineCursor(qtdisplay, Win, LRCursor);
	  break;
	case 3:
	  XDefineCursor(qtdisplay, Win, MoveCursor);
	}

	XFlush(qtdisplay);
		offx = Event.xbutton.x;
		offy = Event.xbutton.y;
	break;

      }

      break;

    case MotionNotify:
      if(!buttondown)
	break;
      do {

	nx = Event.xmotion.x;
	ny = Event.xmotion.y;


      } while (XCheckTypedEvent(qtdisplay, MotionNotify, &Event));


      xpos+= offx - nx;
      ypos+= offy - ny;

      offx = nx;
      offy = ny;

      putimage = TRUE;

      break;

    case ButtonRelease:

      if (Event.xbutton.button == Button1) {

	buttondown = false;
	XDefineCursor(qtdisplay, Win, ReadyCursor);
	XFlush(qtdisplay);
      }

    }

  } while (XCheckWindowEvent(qtdisplay, Win, KeyPressMask|ButtonPressMask, &Event));

  if(putimage == TRUE) {
    Refresh = Resize = 1;
    putImage();
  }
}