当前位置: 首页>>代码示例>>C++>>正文


C++ CImagePtr类代码示例

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


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

示例1: main

int
main(int argc, char **argv)
{
  if (argc != 4) {
    std::cerr << "Usage: test_convert <file> <index_file> <rgb_file>" << std::endl;
    exit(1);
  }

  CFile *ifile  = new CFile(argv[1]);
  CFile *ofile1 = new CFile(argv[2]);
  CFile *ofile2 = new CFile(argv[3]);

  CImageFileSrc src(*ifile);

  CImagePtr image = CImageMgrInst->createImage(src);

  if (! image)
    exit(1);

  image->convertToColorIndex();

  image->writeXPM(ofile1);

  image->convertToRGB();

  image->writeBMP(ofile2);

  delete ifile;
  delete ofile1;
  delete ofile2;

  exit(0);
}
开发者ID:colinw7,项目名称:CImageLib,代码行数:33,代码来源:test_image_convert.cpp

示例2: filterImage

CImagePtr
CSVGFeImage::
filterImage(CImagePtr src_image)
{
  if (! src_image.isValid()) return CImagePtr();

  CImagePtr dst_image = src_image->dup();

  CSVGFilter *filter = NULL;

  CSVGObject *parent = parent_;

  while (parent != NULL) {
    filter = dynamic_cast<CSVGFilter *>(parent);

    if (filter != NULL) break;
  }

  if (filter) {
    CBBox2D bbox;

    filter->getObject()->getBBox(bbox);

    if (bbox.isSet())
      dst_image->reshape(bbox.getWidth(), bbox.getHeight());
  }

  return dst_image;
}
开发者ID:chagge,项目名称:CSVG,代码行数:29,代码来源:CSVGFeImage.cpp

示例3: main

int
main(int argc, char **argv)
{
  CArgs args("-file:s (Image file");

  args.parse(&argc, argv);

  std::string filename = args.getStringArg("-file");

  if (! CFile::exists(filename) || ! CFile::isRegular(filename)) {
    args.usage("CXRootImage");
    exit(1);
  }

  CXMachineInst->openDisplay("");

  CImageFileSrc src(filename);

  CImagePtr image = CImageMgrInst->lookupImage(src);

  if (! image.isValid()) {
    args.usage("CXRootImage");
    exit(1);
  }

  setRootImage(image);

  return 0;
}
开发者ID:colinw7,项目名称:CXLib,代码行数:29,代码来源:CXRootImage.cpp

示例4: setRootImage

extern void
setRootImage(CImagePtr &image)
{
  Pixel bg = CXMachineInst->getBlackPixel();
  Pixel fg = CXMachineInst->getWhitePixel();

  GC gc = CXMachineInst->createGC(fg, bg);

  int w = CXMachineInst->getWidth ();
  int h = CXMachineInst->getHeight();

  Pixmap pixmap = CXMachineInst->createXPixmap(w, h);

  CXMachineInst->fillRectangle(pixmap, gc, 0, 0, w, h);

  CXImage *cximage = image.cast<CXImage>();

  if (cximage == NULL)
    exit(1);

  XImage *ximage = cximage->getXImage();

  int iw = image->getWidth ();
  int ih = image->getHeight();

  if (iw > w) w = iw;
  if (ih > h) h = ih;

  int dst_x = (w - iw)/2;
  int dst_y = (h - ih)/2;

  Window root = CXMachineInst->getRoot();

  CXMachineInst->putImage(pixmap, gc, ximage, 0, 0,
                          dst_x, dst_y, (uint) iw, (uint) ih);
  CXMachineInst->putImage(root  , gc, ximage, 0, 0,
                          dst_x, dst_y, (uint) iw, (uint) ih);

  CXMachineInst->setWindowBackgroundPixmap(root, pixmap);

  CXMachineInst->freeGC(gc);

  CXMachineInst->freeXPixmap(pixmap);

  CXMachineInst->clearWindow(root);

  CXMachineInst->flushEvents();

  const CXAtom &atom = CXMachineInst->getXSetRootIdAtom();

  Pixmap pixmap1;

  if (CXMachineInst->getPixmapProperty(root, atom, &pixmap1)) // delete ?
    CXMachineInst->killClient(pixmap1);

  CXMachineInst->deleteProperty(root, atom);

  CXMachineInst->flushEvents();
}
开发者ID:colinw7,项目名称:CXLib,代码行数:59,代码来源:CXRootImage.cpp

示例5: LoadImageFromFile

	CImagePtr LoadImageFromFile(const nstring & file)
	{
		CImagePtr image = CImageManager::GetSingelton().CreateNewImage(file, nstring("manual"),
			file, CImageFormats::NF_DEFAULT);

		image->BackHeigth();
		return image;
	}
开发者ID:testsirius,项目名称:NovaEngine,代码行数:8,代码来源:image_sample_main.cpp

示例6: assert

//////////////////////////////////////////////////////////////////////////
// thread
unsigned __stdcall CImageManager::_LoadThread (void *param) {
	CImageManager *pThis = (CImageManager *)param;
	assert(pThis != NULL);
	HANDLE hEvent = pThis->m_hEvents[THREAD_LOAD];

	CImageLoader *pImageLoader = CImageLoader::getInstance();

	for (;;) {
		::WaitForSingleObject(hEvent, INFINITE);
		if (pThis->m_exiting) {
			break;
		}

		xl::CScopeLock lock(pThis);
		xl::tstring fileName = pThis->getCurrentFileName();
		int currIndex = pThis->getCurrIndex();
		CLoadingCallback callback(currIndex, pThis);
		CCachedImagePtr cachedImage = pThis->getCurrentCachedImage();
		bool preloadThumbnail = cachedImage->getCachedImage() == NULL;
		if (!preloadThumbnail) {
			cachedImage.reset();
		}
		lock.unlock();

		if (preloadThumbnail) {
			xl::CTimerLogger logger(_T("Load thumbnail %s cost"), fileName.c_str());
			if (cachedImage->loadThumbnail(true, &callback)) {
				lock.lock(pThis);
				if (!callback.shouldStop()) {
					preloadThumbnail = false;
					pThis->_TriggerEvent(EVT_THUMBNAIL_LOADED, &currIndex);
				}
				lock.unlock();
			}
		}

		xl::CTimerLogger logger(_T("Load %s cost"), fileName.c_str());
		CImagePtr image = pImageLoader->load(fileName, &callback);
		if (image == NULL) {
			// assert(callback.shouldStop());
			XLTRACE(_T("**** load %s failed\n"), fileName.c_str());
		} else {
			lock.lock(pThis);
			if (currIndex == pThis->getCurrIndex()) { // make sure the image is the "current" one
				pThis->_TriggerEvent(EVT_IMAGE_LOADED, &image);
			}
			lock.unlock();
			image.reset();
		}
	}

	return 0;
}
开发者ID:cyberscorpio,项目名称:xlview,代码行数:55,代码来源:ImageManager.cpp

示例7: Start

	void Start()
	{
		StartUpEngine(ST_INIT_YOURSELF);
		MyImageExampleListener *listener = new MyImageExampleListener();

		CImageManager::GetSingelton().AddDefaultListener(listener);

		CImagePtr MainImage = LoadImageFromFile("Test.jpg");

		CImagePtr Image1 = CopyImage(MainImage);

		Image1->Negativity();
		SaveImage(nstring("Image1.png"), Image1);
		SaveImage(nstring("Image1.jpg"), Image1);
		SaveImage(nstring("Image1.bmp"), Image1);
		SaveImage(nstring("Image1.tif"), Image1);
		SaveImage(nstring("Image1.tga"), Image1);

		CImagePtr Image2 = CopyImage(Image1);
		Image2->Blurring(3);

		SaveImage(nstring("Image2.png"), Image2);
		SaveImage(nstring("Image2.jpg"), Image2);
		SaveImage(nstring("Image2.bmp"), Image2);
		SaveImage(nstring("Image2.tif"), Image2);
		SaveImage(nstring("Image2.tga"), Image2);

		CImagePtr Image3 = CopyImage(Image2);
		Image3->Negativity();
		Image3->Gamma(0.5f);

		SaveImage(nstring("Image3.png"), Image3);
		SaveImage(nstring("Image3.jpg"), Image3);
		SaveImage(nstring("Image3.bmp"), Image3);
		SaveImage(nstring("Image3.tif"), Image3);
		SaveImage(nstring("Image3.tga"), Image3);

		MainImage->Alienifying();

		SaveImage(nstring("MainImage.png"), MainImage);
		SaveImage(nstring("MainImage.jpg"), MainImage);
		SaveImage(nstring("MainImage.bmp"), MainImage);
		SaveImage(nstring("MainImage.tif"), MainImage);
		SaveImage(nstring("MainImage.tga"), MainImage);

		CImageManager::GetSingelton().UnloadResourceFromHash(MainImage);
		CImageManager::GetSingelton().UnloadResourceFromHash(Image1);
		CImageManager::GetSingelton().UnloadResourceFromHash(Image2);
		CImageManager::GetSingelton().UnloadResourceFromHash(Image3);
	}
开发者ID:testsirius,项目名称:NovaEngine,代码行数:50,代码来源:image_sample_main.cpp

示例8: filterImage

CImagePtr
CSVGFeTile::
filterImage(CImagePtr src_image)
{
  CImagePtr dst_image = src_image->dup();

  return dst_image;
}
开发者ID:chagge,项目名称:CSVG,代码行数:8,代码来源:CSVGFeTile.cpp

示例9: filterImage

CImagePtr
CSVGFeDiffuseLighting::
filterImage(CImagePtr src_image)
{
  CImagePtr dst_image = src_image->dup();

  return dst_image;
}
开发者ID:chagge,项目名称:CSVG,代码行数:8,代码来源:CSVGFeDiffuseLighting.cpp

示例10: reset

void
CSVGBuffer::
reset()
{
  CSVGRenderer *renderer = getRenderer();

  renderer->setDataRange(0, 0, 1, 1);

  renderer->setViewMatrix(CMatrix2D(CMATRIX_TYPE_IDENTITY));

  //------

  CImagePtr image = renderer->getImage();

  if (image.isValid())
    image->setRGBAData(CRGBA(0,0,0,0));

  //------

  renderer->setStrokeColor(CRGBA(0,0,0,1));
  renderer->setFillColor  (CRGBA(0,0,0,1));
}
开发者ID:chagge,项目名称:CSVG,代码行数:22,代码来源:CSVGBuffer.cpp

示例11: AddSubTexture

void CTexture::AddSubTexture(CImagePtr & image, nova::nUInt32 level, nInt32 face,
	nova::nUInt32 xoff, nova::nUInt32 yoff, nova::nUInt32 zoff)
{
	if(!isReady)
		throw NOVA_EXP("CTexture::CreateTexture - resource not created!", BAD_OPERATION);

	CTextureSurfaceListPtr plane = GetSurfaceList(face);
	CHardwarePixelBufferPtr surface = plane->GetSurface(level);

	CMemoryBuffer lock = surface->Lock(xoff, yoff, zoff,
		image->GetWidth(), image->GetHeight(), image->GetDepth(), HWB_DYNAMIC);

	image->GetBits().CopyTo(lock, image->GetBits().GetBufferSize(), 0);
	surface->Unlock(lock);


	for(nova::nUInt32 i = 0; i < GetListenersCount(); i++)
	{
		CTextureListener * lis =
			dynamic_cast<CTextureListener *>(GetListener(i));
		lis->AddSubTextureListener(this);
	}
}
开发者ID:testsirius,项目名称:NovaEngine,代码行数:23,代码来源:nova_textures.cpp

示例12: memBmp

void CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers(double At, wxPaintDC &dc)
{
	if (m_win3D) m_win3D->internal_setRenderingFPS(At>0 ? 1.0/At : 1e9);

	// If we are requested to do so, grab images to disk as they are rendered:
	string grabFile = m_win3D->grabImageGetNextFile();
	if (m_win3D && (!grabFile.empty() || m_win3D->isCapturingImgs()) )
	{
		int w,h;
		dc.GetSize(&w, &h);

		// create a memory DC and bitmap to capture the DC
		wxMemoryDC memDC;
		wxBitmap memBmp(w, h);
		memDC.SelectObject(memBmp);
		memDC.Blit(0,0, w,h, &dc, 0,0);

		if (!grabFile.empty())
		{
			memBmp.SaveFile( _U(grabFile.c_str()) , wxBITMAP_TYPE_PNG );
			m_win3D->internal_emitGrabImageEvent(grabFile);
		}

		if (m_win3D->isCapturingImgs())
		{
			wxImage img = memBmp.ConvertToImage();
			CImagePtr pimg = mrpt::gui::wxImage2MRPTImagePtr(img);

			{
				mrpt::synch::CCriticalSectionLocker	lock(& m_win3D->m_last_captured_img_cs );
				m_win3D->m_last_captured_img = pimg;
				pimg.clear_unique();
			}
		}
	}
}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:36,代码来源:CDisplayWindow3D.cpp

示例13: readHeader

bool
CImageGIF::
readHeader(CFile *file, CImagePtr &image)
{
  file->rewind();

  try {
    CImageGIFHeader header;

    readHeader(file, image, &header);

    //------

    image->setType(CFILE_TYPE_IMAGE_GIF);

    image->setSize(header.width, header.height);
  }
  catch (...) {
    CImage::errorMsg("Failed to read GIF file");
    return false;
  }

  return true;
}
开发者ID:colinw7,项目名称:CImageLib,代码行数:24,代码来源:CImageGIF.cpp

示例14: testCreateMask

static void
testCreateMask()
{
  CFile *ifile = new CFile("data/transparent.xpm");

  CFile *ofile = new CFile("test_mask.xpm");

  CImageFileSrc src(*ifile);

  CImagePtr image = CImageMgrInst->createImage(src);

  if (! image)
    exit(1);

  CImagePtr image1 = image->createMask();

  if (! image1)
    exit(1);

  image1->writeXPM(ofile);

  delete ifile;
  delete ofile;
}
开发者ID:colinw7,项目名称:CImageLib,代码行数:24,代码来源:test_image_mask.cpp

示例15: CopyImage

	CImagePtr CopyImage(const CImagePtr &image_ptr)
	{
		nstring name("copy_");
		name.append(image_ptr->GetResName());

		CImagePtr image = CImageManager::GetSingelton().CreateNewImage(name, nstring("manual"),
			image_ptr->GetBits(), image_ptr->GetWidth(), image_ptr->GetHeight(), 
			image_ptr->GetDepth(), image_ptr->GetPixelFormat());

		return image;
	}
开发者ID:testsirius,项目名称:NovaEngine,代码行数:11,代码来源:image_sample_main.cpp


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