• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TRasterImageP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TRasterImageP的典型用法代码示例。如果您正苦于以下问题:C++ TRasterImageP类的具体用法?C++ TRasterImageP怎么用?C++ TRasterImageP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TRasterImageP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: build_gr_cum

void build_gr_cum(const TRasterImageP &image, int cum[256])
{
	int lx, ly, wrap, true_lx, true_ly;
	int i, x, y;
	UCHAR *pix, *buffer;
	int histo[256], raster_is_savebox;

	get_virtual_buffer(image, &lx, &ly, &wrap, &buffer);

	for (i = 0; i < 256; i++)
		histo[i] = 0;
	for (y = 0; y < ly; y++) {
		pix = buffer + y * wrap;
		for (x = 0; x < lx; x++)
			histo[*pix++]++;
	}

	raster_is_savebox = 1;
	TRect saveBox = image->getSavebox();
	if ((saveBox.getLx() > 0 && saveBox.getLx() < image->getRaster()->getLx()) ||
		(saveBox.getLy() > 0 && saveBox.getLy() < image->getRaster()->getLy()))
		raster_is_savebox = 0;

	if (raster_is_savebox) {
		true_lx = saveBox.getLx() ? saveBox.getLx() : image->getRaster()->getLx();
		true_ly = saveBox.getLy() ? saveBox.getLy() : image->getRaster()->getLy();
	} else {
		true_lx = image->getRaster()->getLx();
		true_ly = image->getRaster()->getLy();
	}
	histo[255] += true_lx * true_ly - lx * ly;

	build_cum(histo, cum);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:34,代码来源:autoadjust.cpp


示例2: delta_

/*! Add to current trasformation matrix a \b delta traslation.
*/
void ImageViewer::panQt(const QPoint &delta) {
  if (delta == QPoint()) return;

  // stop panning when the image is at the edge of window
  QPoint delta_(delta.x(), delta.y());

  TToonzImageP timg  = (TToonzImageP)m_image;
  TRasterImageP rimg = (TRasterImageP)m_image;
  if (timg || rimg) {
    bool isXPlus = delta.x() > 0;
    bool isYPlus = delta.y() > 0;

    TDimension imgSize((timg) ? timg->getSize() : rimg->getRaster()->getSize());
    int subSampling = (timg) ? timg->getSubsampling() : rimg->getSubsampling();

    TPointD cornerPos = TPointD(imgSize.lx * ((isXPlus) ? -1 : 1),
                                imgSize.ly * ((isYPlus) ? 1 : -1)) *
                        (0.5 / (double)subSampling);
    cornerPos = m_viewAff * cornerPos;

    if ((cornerPos.x > 0) == isXPlus) delta_.setX(0);
    if ((cornerPos.y < 0) == isYPlus) delta_.setY(0);
  }

  setViewAff(TTranslation(delta_.x(), -delta_.y()) * m_viewAff);

  update();
}
开发者ID:janisozaur,项目名称:opentoonz,代码行数:30,代码来源:imageviewer.cpp


示例3: pickColor

TPixel32 StylePicker::pickColor(const TPointD &pos, double radius2) const
{
	TToonzImageP ti = m_image;
	TRasterImageP ri = m_image;
	if (!!ri) // !!ti || !!ri)
	{
		TRasterP raster;
		//if(ti)
		//  raster = ti->getRGBM(true);
		//else
		raster = ri->getRaster();

		TPoint point = getRasterPoint(pos);
		if (!raster->getBounds().contains(point))
			return TPixel32::Transparent;

		TRaster32P raster32 = raster;
		if (raster32)
			return raster32->pixels(point.y)[point.x];

		TRasterGR8P rasterGR8 = raster;
		if (rasterGR8)
			return toPixel32(rasterGR8->pixels(point.y)[point.x]);
	} else if (TVectorImageP vi = m_image) {
		const TPalette *palette = m_palette.getPointer();
		if (!palette)
			return TPixel32::Transparent;
		int styleId = pickStyleId(pos, radius2);
		if (0 <= styleId && styleId < palette->getStyleCount())
			return palette->getStyle(styleId)->getAverageColor();
	}
	return TPixel32::Transparent;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:33,代码来源:stylepicker.cpp


示例4: TImageP

void FullColorBrushTool::updateWorkAndBackupRasters(const TRect &rect)
{
	TRasterImageP ri = TImageP(getImage(false, 1));
	if (!ri)
		return;

	TRasterP ras = ri->getRaster();

	TRect _rect = rect * ras->getBounds();
	TRect _lastRect = m_lastRect * ras->getBounds();

	if (_rect.isEmpty())
		return;

	if (m_lastRect.isEmpty()) {
		m_workRaster->extract(_rect)->clear();
		m_backUpRas->extract(_rect)->copy(ras->extract(_rect));
		return;
	}

	QList<TRect> rects = ToolUtils::splitRect(_rect, _lastRect);
	for (int i = 0; i < rects.size(); i++) {
		m_workRaster->extract(rects[i])->clear();
		m_backUpRas->extract(rects[i])->copy(ras->extract(rects[i]));
	}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:26,代码来源:fullcolorbrushtool.cpp


示例5: draw

void PlaneViewer::draw(TRasterImageP ri) {
  double dpiX, dpiY;
  ri->getDpi(dpiX, dpiY);

  if (dpiX == 0.0 || dpiY == 0.0) dpiX = dpiY = Stage::inch;

  draw(ri->getRaster(), dpiX, dpiY);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:8,代码来源:planeviewer.cpp


示例6: glDisable

void ImagePainter::paintImage(const TImageP &image, const TDimension &imageSize,
                              const TDimension &viewerSize, const TAffine &aff,
                              const VisualSettings &visualSettings,
                              const CompareSettings &compareSettings,
                              const TRect &loadbox) {
  glDisable(GL_DEPTH_TEST);

  if (visualSettings.m_drawExternalBG) {
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
  }

  GLenum error = glGetError();
  // assert(error==GL_NO_ERROR);
  if (error != GL_NO_ERROR) {
    printf("ImagePainter::paintImage() gl_error:%d\n", error);
  }

  if (!image) return;

  TRasterImageP rimg = (TRasterImageP)image;
  TVectorImageP vimg = (TVectorImageP)image;
  TToonzImageP timg  = (TToonzImageP)image;

  TRect clipRect(viewerSize);
  clipRect -= TPoint(viewerSize.lx * 0.5, viewerSize.ly * 0.5);
  Painter painter(viewerSize, imageSize, aff, image->getPalette(),
                  visualSettings);

  if (rimg)
    painter.onRasterImage(rimg.getPointer());
  else if (vimg)
    painter.onVectorImage(vimg.getPointer());
  else if (timg)
    painter.onToonzImage(timg.getPointer());

  if (visualSettings.m_blankColor != TPixel::Transparent) {
    painter.drawBlank();
    return;
  }

  // if I have a color filter applied using a glmask, , drawing of images must
  // be done on black bg!
  if (!vimg)
    painter.flushRasterImages(
        loadbox, visualSettings.m_doCompare ? compareSettings.m_compareX
                                            : DefaultCompareValue,
        visualSettings.m_doCompare ? compareSettings.m_compareY
                                   : DefaultCompareValue,
        compareSettings.m_swapCompared);

  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

  if (visualSettings.m_doCompare)
    drawCompareLines(viewerSize, compareSettings.m_compareX,
                     compareSettings.m_compareY);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:57,代码来源:imagepainter.cpp


示例7: TBinarizeUndo

	// note: create Undo BEFORE binarizing. Undo is keeping a copy of the current raster
	TBinarizeUndo(TXshSimpleLevel *sl, const TFrameId &fid, bool alphaEnabled)
		: m_levelName(sl->getName()), m_fid(fid), m_alphaEnabled(alphaEnabled)
	{
		/* FIXME: clang でコンパイルできなかったのでキャストにしたがこのダウンキャスト本当に大丈夫か? */
		TRasterImageP ri = (TRasterImageP)sl->getFrame(m_fid, false)->cloneImage();
		m_rasId = QString("BinarizeUndo") + QString::number((uintptr_t) this);
		TImageCache::instance()->add(m_rasId, ri);
		m_rasSize = ri->getRaster()->getLx() * ri->getRaster()->getLy() * 4;
	}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:10,代码来源:binarizepopup.cpp


示例8: leftButtonDrag

void FullColorBrushTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e)
{
	m_brushPos = m_mousePos = pos;

	TRasterImageP ri = (TRasterImageP)getImage(true);
	if (!ri)
		return;

	double maxThickness = m_thickness.getValue().second;
	double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
	double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
	TDimension size = m_workRaster->getSize();
	TPointD rasCenter = TPointD(size.lx * 0.5, size.ly * 0.5);
	TThickPoint point(pos + rasCenter, thickness);

	TThickPoint old = m_points.back();
	if (norm2(point - old) < 4)
		return;

	TThickPoint mid((old + point) * 0.5, (point.thick + old.thick) * 0.5);
	m_points.push_back(mid);
	m_points.push_back(point);

	TRect bbox;
	int m = m_points.size();
	TRectD invalidateRect;
	if (m == 3) {
		// ho appena cominciato. devo disegnare un segmento
		TThickPoint pa = m_points.front();
		vector<TThickPoint> points;
		points.push_back(pa);
		points.push_back(mid);
		invalidateRect = ToolUtils::getBounds(points, maxThickness);
		bbox = m_brush->getBoundFromPoints(points);
		updateWorkAndBackupRasters(bbox + m_lastRect);
		m_tileSaver->save(bbox);
		m_brush->addArc(pa, (pa + mid) * 0.5, mid, m_oldOpacity, opacity);
		m_lastRect += bbox;
	} else {
		// caso generale: disegno un arco
		vector<TThickPoint> points;
		points.push_back(m_points[m - 4]);
		points.push_back(old);
		points.push_back(mid);
		invalidateRect = ToolUtils::getBounds(points, maxThickness);
		bbox = m_brush->getBoundFromPoints(points);
		updateWorkAndBackupRasters(bbox + m_lastRect);
		m_tileSaver->save(bbox);
		m_brush->addArc(m_points[m - 4], old, mid, m_oldOpacity, opacity);
		m_lastRect += bbox;
	}
	m_oldOpacity = opacity;
	m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
	invalidate(invalidateRect.enlarge(2) - rasCenter);
	m_strokeRect += bbox;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:56,代码来源:fullcolorbrushtool.cpp


示例9: invalidate

void RasterSelectionTool::leftButtonDrag(const TPointD &pos,
                                         const TMouseEvent &e) {
  if (m_setSaveboxTool && m_modifySavebox.getValue()) {
    m_setSaveboxTool->leftButtonDrag(pos);
    invalidate();
    return;
  }
  if (m_dragTool) {
    m_dragTool->leftButtonDrag(pos, e);
    invalidate();
    return;
  }

  TImageP image    = getImage(true);
  TToonzImageP ti  = (TToonzImageP)image;
  TRasterImageP ri = (TRasterImageP)image;
  if (!ti && !ri) return;

  if (m_selecting) {
    if (m_strokeSelectionType.getValue() == RECT_SELECTION) {
      TDimension imageSize;
      if (ti)
        imageSize = ti->getSize();
      else if (ri)
        imageSize = ri->getRaster()->getSize();
      TPointD p(imageSize.lx % 2 ? 0.5 : 0.0, imageSize.ly % 2 ? 0.5 : 0.0);
      TRectD rectD(tround(std::min(m_firstPos.x, pos.x) - p.x) + p.x,
                   tround(std::min(m_firstPos.y, pos.y) - p.y) + p.y,
                   tround(std::max(m_firstPos.x, pos.x) - p.x) + p.x,
                   tround(std::max(m_firstPos.y, pos.y) - p.y) + p.y);

      m_selectingRect = rectD;
      m_bboxs.clear();
      invalidate();
    } else if (m_strokeSelectionType.getValue() == FREEHAND_SELECTION)
      freehandDrag(pos);
    return;
  }

  double pixelSize        = getPixelSize();
  TTool::Application *app = TTool::getApplication();
  if (!app || m_justSelected || !m_selecting ||
      tdistance2(pos, m_curPos) < 9.0 * pixelSize * pixelSize)
    return;

  m_curPos = pos;

  if (m_strokeSelectionType.getValue() == FREEHAND_SELECTION)
    freehandDrag(pos);
  else if (m_strokeSelectionType.getValue() == RECT_SELECTION) {
    bool selectOverlappingStroke = (m_firstPos.x > pos.x);
    TRectD rect(m_firstPos, pos);
    m_selectingRect = rect;
    invalidate();
  }
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:56,代码来源:rasterselectiontool.cpp


示例10: convertWorldToRaster

TRect TRasterImageUtils::convertWorldToRaster(const TRectD &area, const TRasterImageP ri)
{
	if (area.isEmpty())
		return TRect();
	if (!ri || !ri->getRaster())
		return TRect(tfloor(area.x0), tfloor(area.y0), tfloor(area.x1) - 1, tfloor(area.y1) - 1);
	TRasterP ras = ri->getRaster();
	TRectD rect(area + ras->getCenterD());
	return TRect(tfloor(rect.x0), tfloor(rect.y0), tceil(rect.x1) - 1, tceil(rect.y1) - 1);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:10,代码来源:trasterimageutils.cpp


示例11: convertRasterToWorld

TRectD TRasterImageUtils::convertRasterToWorld(const TRect &area, const TRasterImageP ri)
{
	if (area.isEmpty())
		return TRectD();

	TRectD rect(area.x0, area.y0, area.x1 + 1, area.y1 + 1);
	if (ri && ri->getRaster())
		rect = rect - ri->getRaster()->getCenterD();
	return rect;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:10,代码来源:trasterimageutils.cpp


示例12: leftButtonUp

void FullColorBrushTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e)
{
	m_brushPos = m_mousePos = pos;

	TRasterImageP ri = (TRasterImageP)getImage(true);
	if (!ri)
		return;

	if (m_points.size() != 1) {
		double maxThickness = m_thickness.getValue().second;
		double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
		double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
		TPointD rasCenter = ri->getRaster()->getCenterD();
		TThickPoint point(pos + rasCenter, thickness);
		m_points.push_back(point);
		int m = m_points.size();
		vector<TThickPoint> points;
		points.push_back(m_points[m - 3]);
		points.push_back(m_points[m - 2]);
		points.push_back(m_points[m - 1]);
		TRect bbox = m_brush->getBoundFromPoints(points);
		updateWorkAndBackupRasters(bbox);
		m_tileSaver->save(bbox);
		m_brush->addArc(points[0], points[1], points[2], m_oldOpacity, opacity);
		m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
		TRectD invalidateRect = ToolUtils::getBounds(points, maxThickness);
		invalidate(invalidateRect.enlarge(2) - rasCenter);
		m_strokeRect += bbox;
		m_lastRect.empty();
	}

	if (m_brush) {
		delete m_brush;
		m_brush = 0;
	}

	m_workRaster->unlock();

	if (m_tileSet->getTileCount() > 0) {
		delete m_tileSaver;
		TTool::Application *app = TTool::getApplication();
		TXshLevel *level = app->getCurrentLevel()->getLevel();
		TXshSimpleLevelP simLevel = level->getSimpleLevel();
		TFrameId frameId = getCurrentFid();
		TRasterP ras = ri->getRaster()->extract(m_strokeRect)->clone();
		TUndoManager::manager()->add(new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId,
															m_isFrameCreated, ras, m_strokeRect.getP00()));
	}

	notifyImageChanged();
	m_strokeRect.empty();
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:52,代码来源:fullcolorbrushtool.cpp


示例13: undo

	void undo() const
	{
		TXshSimpleLevel *sl = getLevel();
		if (!sl)
			return;
		TRasterImageP ri = sl->getFrame(m_fid, true);
		if (!ri)
			return;

		TRasterImageP oldRaster = TImageCache::instance()->get(m_rasId, false);
		ri->getRaster()->copy(oldRaster->getRaster());
		notify(sl);
	}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:13,代码来源:binarizepopup.cpp


示例14: getViewer

void FullColorBrushTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e)
{
	m_brushPos = m_mousePos = pos;

	Viewer *viewer = getViewer();
	if (!viewer)
		return;

	TRasterImageP ri = (TRasterImageP)getImage(true);
	if (!ri)
		ri = (TRasterImageP)touchImage();

	if (!ri)
		return;

	TRasterP ras = ri->getRaster();
	TDimension dim = ras->getSize();

	if (!(m_workRaster && m_backUpRas))
		setWorkAndBackupImages();

	m_workRaster->lock();

	double maxThick = m_thickness.getValue().second;
	double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThick;
	double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
	TPointD rasCenter = TPointD(dim.lx * 0.5, dim.ly * 0.5);
	TThickPoint point(pos + rasCenter, thickness);
	TPointD halfThick(maxThick * 0.5, maxThick * 0.5);
	TRectD invalidateRect(pos - halfThick, pos + halfThick);

	m_points.clear();
	m_points.push_back(point);

	m_tileSet = new TTileSetFullColor(ras->getSize());
	m_tileSaver = new TTileSaverFullColor(ras, m_tileSet);
	double hardness = m_hardness.getValue() * 0.01;

	m_brush = new BluredBrush(m_workRaster, maxThick, m_brushPad, hardness == 1.0);
	m_strokeRect = m_brush->getBoundFromPoints(m_points);
	updateWorkAndBackupRasters(m_strokeRect);
	m_tileSaver->save(m_strokeRect);
	m_brush->addPoint(point, opacity);
	m_brush->updateDrawing(ras, m_backUpRas, m_currentColor, m_strokeRect, m_opacity.getValue().second * 0.01);
	m_oldOpacity = opacity;
	m_lastRect = m_strokeRect;

	invalidate(invalidateRect.enlarge(2));
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:49,代码来源:fullcolorbrushtool.cpp


示例15: addGlobalNumbering

void TRasterImageUtils::addGlobalNumbering(const TRasterImageP &ri, const std::wstring &sceneName, int globalIndex)
{
	if (!ri)
		return;
	TRasterP raster = ri->getRaster();
	int lx = raster->getLx(), ly = raster->getLy();
	QColor greyOverlay(100, 100, 100, 140);
	QImage image = rasterToQImage(raster, true, false);
	QPainter p(&image);
	QFont numberingFont = QFont();
	numberingFont.setPixelSize(ly * 0.04);
	numberingFont.setBold(true);
	p.setFont(numberingFont);
	QMatrix matrix;
	p.setMatrix(matrix.translate(0, ly).scale(1, -1), true);
	QFontMetrics fm = p.fontMetrics();
	int fontHeight = fm.height();
	int offset = fontHeight * 0.2;
	QString globalFrame = QString::number(globalIndex);
	while (globalFrame.size() < 4)
		globalFrame.push_front("0");
	QString globalNumberingString = QString::fromStdWString(sceneName) + ": " + globalFrame;

	int globalNumberingWidth = fm.width(globalNumberingString);
	p.setPen(Qt::NoPen);
	p.setBrush(QColor(255, 255, 255, 255));
	p.drawRect(offset, ly - offset - fontHeight, globalNumberingWidth + offset * 2, fontHeight);
	p.setBrush(greyOverlay);
	p.drawRect(offset, ly - offset - fontHeight, globalNumberingWidth + offset * 2, fontHeight);
	p.setPen(Qt::white);
	p.drawText(2 * offset, ly - 2 * offset, globalNumberingString);
	p.end();
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:33,代码来源:trasterimageutils.cpp


示例16: redo

	void redo() const
	{
		TXshSimpleLevel *sl = getLevel();
		if (!sl)
			return;
		TRasterImageP ri = sl->getFrame(m_fid, true);
		if (!ri)
			return;
		TRaster32P ras = ri->getRaster();
		if (!ras)
			return;
		TBinarizer binarizer;
		binarizer.enableAlpha(m_alphaEnabled);
		binarizer.process(ras);
		notify(sl);
	}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:16,代码来源:binarizepopup.cpp


示例17: item

int BinarizePopup::getSelectedFrames()
{
	m_frames.clear();
	TSelection *selection = TSelection::getCurrent();
	TCellSelection *cellSelection;
	TFilmstripSelection *filmstripSelection;
	int count = 0;
	if ((cellSelection = dynamic_cast<TCellSelection *>(selection))) {
		std::set<TRasterImage *> images;
		int r0, c0, r1, c1;
		cellSelection->getSelectedCells(r0, c0, r1, c1);
		TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
		int c, r;
		for (c = c0; c <= c1; c++) {
			for (r = r0; r <= r1; r++) {
				TXshCell cell = xsheet->getCell(r, c);
				TRasterImageP rasImage = cell.getImage(false);
				if (!rasImage || !rasImage->getRaster())
					continue;
				Frames::value_type item(cell.getSimpleLevel(), cell.getFrameId());
				Frames::iterator it;
				it = std::lower_bound(m_frames.begin(), m_frames.end(), item);
				if (it == m_frames.end() || *it != item) {
					m_frames.insert(it, item);
					count++;
				}
			}
		}
	} else if ((filmstripSelection = dynamic_cast<TFilmstripSelection *>(selection))) {
		TXshSimpleLevel *sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();
		if (sl) {
			std::set<TFrameId> fids = filmstripSelection->getSelectedFids();
			std::set<TFrameId>::iterator it;
			for (it = fids.begin(); it != fids.end(); ++it) {
				TRasterImageP rasImage = sl->getFrame(*it, false);
				if (!!rasImage && !!rasImage->getRaster()) {
					m_frames.push_back(std::make_pair(sl, *it));
					count++;
				}
			}
		}
	} else {
	}
	m_frameIndex = 0;
	return count;
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:46,代码来源:binarizepopup.cpp


示例18: undo

	void undo() const
	{
		TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();
		TXshCell cell = xsheet->getCell(m_r, m_c);
		TRasterImageP rasImage = (TRasterImageP)cell.getImage(true);
		if (!rasImage)
			return;
		rasImage->setRaster(((TRasterImageP)TImageCache::instance()->get(m_rasId, true))->getRaster()->clone());
		TXshSimpleLevel *simpleLevel = cell.getSimpleLevel();
		assert(simpleLevel);
		simpleLevel->touchFrame(cell.getFrameId());
		simpleLevel->setDirtyFlag(false);
		IconGenerator::instance()->invalidate(simpleLevel, cell.getFrameId());

		if (m_isLastInBlock) {
			TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
		}
	}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:18,代码来源:brightnessandcontrastpopup.cpp


示例19: assert

TImageP ImageFiller::build(int imFlags, void *extData)
{
	assert(imFlags == ImageManager::none);

	// Fetch image
	assert(extData);

	ImageLoader::BuildExtData *data = (ImageLoader::BuildExtData *)extData;
	assert(data->m_subs == 0);

	const std::string &srcImgId = data->m_sl->getImageId(data->m_fid);

	TImageP img = ImageManager::instance()->getImage(srcImgId, imFlags, extData);
	if (img) {
		TRasterImageP ri = img;
		if (ri) {
			TRaster32P ras = ri->getRaster();
			if (ras) {
				TRaster32P newRas = ras->clone();
				FullColorAreaFiller filler(newRas);

				TPaletteP palette = new TPalette();
				int styleId = palette->getPage(0)->addStyle(TPixel32::White);

				FillParameters params;
				params.m_palette = palette.getPointer();
				params.m_styleId = styleId;
				params.m_minFillDepth = 0;
				params.m_maxFillDepth = 15;
				filler.rectFill(newRas->getBounds(), params, false);

				TRasterImageP ri = TRasterImageP(newRas);
				return ri;
			}
		}
	}

	// Error case: return a dummy image (is it really required?)

	TRaster32P ras(10, 10);
	ras->fill(TPixel32(127, 0, 127, 127));

	return TRasterImageP(ras);
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:44,代码来源:imagebuilders.cpp


示例20: get_virtual_buffer

static void get_virtual_buffer(const TRasterImageP &image,
							   int *p_lx, int *p_ly, int *p_wrap,
							   UCHAR **p_buffer)
{
	int x0, y0, x1, y1;
	int x_margin, y_margin;
	int lx, ly, wrap;
	UCHAR *buffer;

	TRasterGR8P ras8(image->getRaster());

	assert(ras8);
	double xdpi, ydpi;
	image->getDpi(xdpi, ydpi);

	/* BORDO DI MEZZO CENTIMETRO */
	x_margin = troundp(mmToPixel(5.0, xdpi));
	y_margin = troundp(mmToPixel(5.0, ydpi));
	x0 = Window_x0 + x_margin;
	y0 = Window_y0 + y_margin;
	x1 = Window_x1 - x_margin;
	y1 = Window_y1 - y_margin;
	notLessThan(x0 + 9, x1);
	notLessThan(y0 + 9, y1);
	notLessThan(0, x0);
	notMoreThan(ras8->getLx() - 1, x0);
	notLessThan(0, y0);
	notMoreThan(ras8->getLy() - 1, y0);
	notLessThan(0, x1);
	notMoreThan(ras8->getLx() - 1, x1);
	notLessThan(0, y1);
	notMoreThan(ras8->getLy() - 1, y1);

	lx = x1 - x0 + 1;
	ly = y1 - y0 + 1;
	wrap = ras8->getWrap();
	buffer = (UCHAR *)ras8->getRawData() + x0 + y0 * wrap;

	*p_lx = lx;
	*p_ly = ly;
	*p_wrap = wrap;
	*p_buffer = buffer;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:43,代码来源:autoadjust.cpp



注:本文中的TRasterImageP类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TRasterP类代码示例发布时间:2022-05-31
下一篇:
C++ TRasterCM32P类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap