Exemplo n.º 1
0
void TImageSnapshot::showParams()
{
    QImage tempImg = wgt->image;
    if (manipulatorIsClosed) {
        manip = new ImageManipulator(QList<QVariant>()
                << imageParams.brightness
                << imageParams.contrast
                << wgt->imageTransform.rotate + serverValues[0]
                << imageParams.gamma
                << picMode->getLBorder()
                << picMode->getRBorder()
                << wgt->imageTransform.horFlip
                << wgt->imageTransform.verFlip
                << wgt->imageTransform.imageScale
                << picMode->_maxContrast
                << _timer
                << picMode->getPictureMode()
                << wgt->imageTransform.fullPictureMode
                << wgt->moveX
                << wgt->moveY
                << dimX / picMode->getDelimitr() << dimY,
                val16, tempImg);
        manip->setAttribute(Qt::WA_DeleteOnClose);
        manipulatorIsClosed = false;
        manip->setModal(true);

        connect(manip, SIGNAL(destroyed()), this, SLOT(manipDestroed()));
        connect(manip, SIGNAL(setBr(QVariant)), this, SLOT(setBrightness(QVariant)));
        connect(manip, SIGNAL(setCon(QVariant)), this, SLOT(setContrast(QVariant)));
        connect(manip, SIGNAL(setGm(QVariant)), this, SLOT(setGamma(QVariant)));
        connect(manip, SIGNAL(setLBorder(unsigned short)), this, SLOT(setLBorder(unsigned short)));
        connect(manip, SIGNAL(setRBorder(unsigned short)), this, SLOT(setRBorder(unsigned short)));
        connect(manip, SIGNAL(sendRotationVal(QVariant)), this, SLOT(setRotate(QVariant)));
        connect(manip, SIGNAL(sendHorFlipVal(QVariant)), this, SLOT(setHFlip(QVariant)));
        connect(manip, SIGNAL(sendVerFlipVal(QVariant)), this, SLOT(setVFlip(QVariant)));
        //connect(manip, SIGNAL(changeFormatOfColor(int)), this, SLOT(setImageType(int)));
        connect(manip, SIGNAL(changePictureModeSignal(int)), this, SLOT(setImageType(int)));
        connect(manip, SIGNAL(setTime(int)), this, SLOT(sendTimer(int)));
        connect(manip, SIGNAL(setScaleSignal(double)), this, SLOT(setScale(double)));
        connect(manip, SIGNAL(fullScreenMode(bool)), this, SLOT(setFullscreenMode(bool)));
        connect(manip, SIGNAL(getDataHistogram()), this, SLOT(drawHistogram()));

        connect(manip, SIGNAL(chPicX(int)), wgt, SLOT(setMoveX(int)));
        connect(manip, SIGNAL(chPicY(int)), wgt, SLOT(setMoveY(int)));
        connect(wgt, SIGNAL(showPictureSize(int, int, int, int)), manip, SLOT(setShowPicSize(int, int, int, int)));
        setImage(wgt->image);
        manip->show();
    }
}
Exemplo n.º 2
0
bool rcBuildCompactHeightfield(const int walkableHeight, const int walkableClimb,
							   unsigned char flags, rcHeightfield& hf,
							   rcCompactHeightfield& chf)
{
	rcTimeVal startTime = rcGetPerformanceTimer();
	
	const int w = hf.width;
	const int h = hf.height;
	const int spanCount = getSpanCount(flags, hf);

	// Fill in header.
	chf.width = w;
	chf.height = h;
	chf.spanCount = spanCount;
	chf.walkableHeight = walkableHeight;
	chf.walkableClimb = walkableClimb;
	chf.maxRegions = 0;
	vcopy(chf.bmin, hf.bmin);
	vcopy(chf.bmax, hf.bmax);
	chf.bmax[1] += walkableHeight*hf.ch;
	chf.cs = hf.cs;
	chf.ch = hf.ch;
	chf.cells = new rcCompactCell[w*h];
	if (!chf.cells)
	{
		if (rcGetLog())
			rcGetLog()->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.cells' (%d)", w*h);
		return false;
	}
	memset(chf.cells, 0, sizeof(rcCompactCell)*w*h);
	chf.spans = new rcCompactSpan[spanCount];
	if (!chf.spans)
	{
		if (rcGetLog())
			rcGetLog()->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.spans' (%d)", spanCount);
		return false;
	}
	memset(chf.spans, 0, sizeof(rcCompactSpan)*spanCount);
	
	const int MAX_HEIGHT = 0xffff;
	
	// Fill in cells and spans.
	int idx = 0;
	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			const rcSpan* s = hf.spans[x + y*w];
			// If there are no spans at this cell, just leave the data to index=0, count=0.
			if (!s) continue;
			rcCompactCell& c = chf.cells[x+y*w];
			c.index = idx;
			c.count = 0;
			while (s)
			{
				if (s->flags == flags)
				{
					const int bot = (int)s->smax;
					const int top = s->next ? (int)s->next->smin : MAX_HEIGHT;
					chf.spans[idx].y = (unsigned short)rcClamp(bot, 0, 0xffff);
					chf.spans[idx].h = (unsigned char)rcClamp(top - bot, 0, 0xff);
					idx++;
					c.count++;
				}
				s = s->next;
			}
		}
	}

	// Find neighbour connections.
	for (int y = 0; y < h; ++y)
	{
		for (int x = 0; x < w; ++x)
		{
			const rcCompactCell& c = chf.cells[x+y*w];
			for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
			{
				rcCompactSpan& s = chf.spans[i];
				for (int dir = 0; dir < 4; ++dir)
				{
					setCon(s, dir, 0xf);
					const int nx = x + rcGetDirOffsetX(dir);
					const int ny = y + rcGetDirOffsetY(dir);
					// First check that the neighbour cell is in bounds.
					if (nx < 0 || ny < 0 || nx >= w || ny >= h)
						continue;
					// Iterate over all neighbour spans and check if any of the is
					// accessible from current cell.
					const rcCompactCell& nc = chf.cells[nx+ny*w];
					for (int k = (int)nc.index, nk = (int)(nc.index+nc.count); k < nk; ++k)
					{
						const rcCompactSpan& ns = chf.spans[k];
						const int bot = rcMax(s.y, ns.y);
						const int top = rcMin(s.y+s.h, ns.y+ns.h);

						// Check that the gap between the spans is walkable,
						// and that the climb height between the gaps is not too high.
						if ((top - bot) >= walkableHeight && rcAbs((int)ns.y - (int)s.y) <= walkableClimb)
						{
							// Mark direction as walkable.
							setCon(s, dir, k - (int)nc.index);
							break;
						}
					}
				}
			}
		}
	}
	
	rcTimeVal endTime = rcGetPerformanceTimer();
	
	if (rcGetBuildTimes())
		rcGetBuildTimes()->buildCompact += rcGetDeltaTimeUsec(startTime, endTime);
	
	return true;
}