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

C++ ImagePtr函数代码示例

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

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



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

示例1: imageSize

TexturePtr TextureManager::loadTexture(std::stringstream& file)
{
    TexturePtr texture;

    apng_data apng;
    if(load_apng(file, &apng) == 0) {
        Size imageSize(apng.width, apng.height);
        if(apng.num_frames > 1) { // animated texture
            std::vector<ImagePtr> frames;
            std::vector<int> framesDelay;
            for(uint i=0;i<apng.num_frames;++i) {
                uchar *frameData = apng.pdata + ((apng.first_frame+i) * imageSize.area() * apng.bpp);
                int frameDelay = apng.frames_delay[i];

                framesDelay.push_back(frameDelay);
                frames.push_back(ImagePtr(new Image(imageSize, apng.bpp, frameData)));
            }
            AnimatedTexturePtr animatedTexture = new AnimatedTexture(imageSize, frames, framesDelay);
            m_animatedTextures.push_back(animatedTexture);
            texture = animatedTexture;
        } else {
            ImagePtr image = ImagePtr(new Image(imageSize, apng.bpp, apng.pdata));
            texture = TexturePtr(new Texture(image));
        }
        free_apng(&apng);
    }

    return texture;
}
开发者ID:Ablankzin,项目名称:otclient,代码行数:29,代码来源:texturemanager.cpp


示例2: assert

std::pair<ImagePtr, RectD>
TrackMarker::getMarkerImage(TimeValue time,
                            const RectD& roi) const
{

    assert( !roi.isNull() );

    NodePtr node = getModel()->getNode();
    NodePtr input = node->getInput(0);
    if (!input) {
        return std::make_pair(ImagePtr(), roi);
    }

    TreeRender::CtorArgsPtr args(new TreeRender::CtorArgs);
    {
        args->treeRootEffect = input->getEffectInstance();
        args->time = time;
        args->view = ViewIdx(0);

        // Render default plane
        args->plane = 0;
        args->mipMapLevel = 0;
        args->proxyScale = RenderScale(1.);
        args->canonicalRoI = &roi;
        args->draftMode = false;
        args->playback = false;
        args->byPassCache = false;
    }

    TreeRenderPtr render = TreeRender::create(args);

    FrameViewRequestPtr outputRequest;
    ActionRetCodeEnum stat = render->launchRender(&outputRequest);
    if (isFailureRetCode(stat)) {
        return std::make_pair(ImagePtr(), roi);
    }
    ImagePtr sourceImage = outputRequest->getRequestedScaleImagePlane();

    // Make sure the Natron image rendered is RGBA full rect and on CPU, we don't support other formats
    if (sourceImage->getStorageMode() != eStorageModeRAM) {
        Image::InitStorageArgs initArgs;
        initArgs.bounds = sourceImage->getBounds();
        initArgs.plane = sourceImage->getLayer();
        initArgs.bufferFormat = eImageBufferLayoutRGBAPackedFullRect;
        initArgs.storage = eStorageModeRAM;
        initArgs.bitdepth = sourceImage->getBitDepth();
        ImagePtr tmpImage = Image::create(initArgs);
        if (!tmpImage) {
            return std::make_pair(ImagePtr(), roi);
        }
        Image::CopyPixelsArgs cpyArgs;
        cpyArgs.roi = initArgs.bounds;
        tmpImage->copyPixels(*sourceImage, cpyArgs);
        sourceImage = tmpImage;
        
    }

    return std::make_pair(sourceImage, roi);
} // TrackMarker::getMarkerImage
开发者ID:kcotugno,项目名称:Natron,代码行数:59,代码来源:TrackMarker.cpp


示例3: ImagePtr

void PeerData::updateUserpic(
		PhotoId photoId,
		const MTPFileLocation &location) {
	const auto size = kUserpicSize;
	const auto loc = StorageImageLocation::FromMTP(size, size, location);
	const auto photo = loc.isNull() ? ImagePtr() : ImagePtr(loc);
	setUserpicChecked(photoId, loc, photo);
}
开发者ID:zhangsoledad,项目名称:tdesktop,代码行数:8,代码来源:data_peer.cpp


示例4: ImagePtr

ImagePtr TrackedStream::getChangingImage()
{
	if(!mVideoSource)
		return ImagePtr();
	if (!mImage)
		mImage = ImagePtr(new Image(this->getUid()+"_TrackedStreamHelper", mVideoSource->getVtkImageData(), this->getName()+"_TrackedStreamHelper"));
	return mImage;
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:8,代码来源:cxTrackedStream.cpp


示例5: ImagePtr

void BackgroundInner::gotWallpapers(const MTPVector<MTPWallPaper> &result) {
	App::WallPapers wallpapers;

	wallpapers.push_back(App::WallPaper(0, ImagePtr(st::msgBG0), ImagePtr(st::msgBG0)));
	const QVector<MTPWallPaper> &v(result.c_vector().v);
	for (int i = 0, l = v.size(); i < l; ++i) {
		const MTPWallPaper w(v.at(i));
		switch (w.type()) {
		case mtpc_wallPaper: {
			const MTPDwallPaper &d(w.c_wallPaper());
			const QVector<MTPPhotoSize> &sizes(d.vsizes.c_vector().v);
			const MTPPhotoSize *thumb = 0, *full = 0;
			int32 thumbLevel = -1, fullLevel = -1;
			for (QVector<MTPPhotoSize>::const_iterator j = sizes.cbegin(), e = sizes.cend(); j != e; ++j) {
				char size = 0;
				int32 w = 0, h = 0;
				switch (j->type()) {
				case mtpc_photoSize: {
					const string &s(j->c_photoSize().vtype.c_string().v);
					if (s.size()) size = s[0];
					w = j->c_photoSize().vw.v;
					h = j->c_photoSize().vh.v;
				} break;

				case mtpc_photoCachedSize: {
					const string &s(j->c_photoCachedSize().vtype.c_string().v);
					if (s.size()) size = s[0];
					w = j->c_photoCachedSize().vw.v;
					h = j->c_photoCachedSize().vh.v;
				} break;
				}
				if (!size || !w || !h) continue;

				int32 newThumbLevel = qAbs((st::backgroundSize.width() * cIntRetinaFactor()) - w), newFullLevel = qAbs(2560 - w);
				if (thumbLevel < 0 || newThumbLevel < thumbLevel) {
					thumbLevel = newThumbLevel;
					thumb = &(*j);
				}
				if (fullLevel < 0 || newFullLevel < fullLevel) {
					fullLevel = newFullLevel;
					full = &(*j);
				}
			}
			if (thumb && full && full->type() != mtpc_photoSizeEmpty) {
				wallpapers.push_back(App::WallPaper(d.vid.v ? d.vid.v : INT_MAX, App::image(*thumb), App::image(*full)));
			}
		} break;

		case mtpc_wallPaperSolid: {
			const MTPDwallPaperSolid &d(w.c_wallPaperSolid());
		} break;
		}
	}

	App::cSetServerBackgrounds(wallpapers);
	updateWallpapers();
}
开发者ID:3ngineer,项目名称:tdesktop,代码行数:57,代码来源:backgroundbox.cpp


示例6: glTexImage2D

void Texture::upload() {
	if (!_img)
		return;
	if (_img->isLoaded()) {
		const GLenum mode = _img->hasAlpha() ? GL_RGBA : GL_RGB;
		glTexImage2D(GL_TEXTURE_2D, 0, mode, _img->width(), _img->height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, _img->data());
		_img = ImagePtr();
		_state = io::IOSTATE_LOADED;
	} else if (_img->isFailed()) {
		_state = io::IOSTATE_FAILED;
		_img = ImagePtr();
	}
}
开发者ID:mgerhardy,项目名称:engine,代码行数:13,代码来源:Texture.cpp


示例7: img

ImagePtr Client::nextImage() {
    if (shared_mem_client_.initialized())
    {
        ImagePtr img(new Image); // TODO
        if (shared_mem_client_.nextImage(*img))
            return img;
        else
            return ImagePtr();
    }

    image_ptr_ = 0;
    cb_queue_.callAvailable();
    return ImagePtr(image_ptr_);
}
开发者ID:ChingHengWang,项目名称:rgbd,代码行数:14,代码来源:Client.cpp


示例8: r

void StickerSetInner::paintEvent(QPaintEvent *e) {
	QRect r(e->rect());
	Painter p(this);

	if (_pack.isEmpty()) return;

	int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0);
	int32 from = qFloor(e->rect().top() / st::stickersSize.height()), to = qFloor(e->rect().bottom() / st::stickersSize.height()) + 1;

	for (int32 i = from; i < to; ++i) {
		for (int32 j = 0; j < StickerPanPerRow; ++j) {
			int32 index = i * StickerPanPerRow + j;
			if (index >= _pack.size()) break;

			DocumentData *doc = _pack.at(index);
			QPoint pos(st::stickerPanPadding + j * st::stickersSize.width(), i * st::stickersSize.height());

			bool goodThumb = !doc->thumb->isNull() && ((doc->thumb->width() >= 128) || (doc->thumb->height() >= 128));
			if (goodThumb) {
				doc->thumb->load();
			} else {
				bool already = !doc->already().isEmpty(), hasdata = !doc->data.isEmpty();
				if (!doc->loader && doc->status != FileFailed && !already && !hasdata) {
					doc->save(QString());
				}
				if (doc->sticker->img->isNull() && (already || hasdata)) {
					if (already) {
						doc->sticker->img = ImagePtr(doc->already());
					} else {
						doc->sticker->img = ImagePtr(doc->data);
					}
				}
			}

			float64 coef = qMin((st::stickersSize.width() - st::msgRadius * 2) / float64(doc->dimensions.width()), (st::stickersSize.height() - st::msgRadius * 2) / float64(doc->dimensions.height()));
			if (coef > 1) coef = 1;
			int32 w = qRound(coef * doc->dimensions.width()), h = qRound(coef * doc->dimensions.height());
			if (w < 1) w = 1;
			if (h < 1) h = 1;
			QPoint ppos = pos + QPoint((st::stickersSize.width() - w) / 2, (st::stickersSize.height() - h) / 2);
			if (goodThumb) {
				p.drawPixmapLeft(ppos, width(), doc->thumb->pix(w, h));
			} else if (!doc->sticker->img->isNull()) {
				p.drawPixmapLeft(ppos, width(), doc->sticker->img->pix(w, h));
			}
		}
	}
	p.fillRect(0, _bottom - st::stickersAddOrShare, width(), st::stickersAddOrShare, st::emojiPanHeaderBg->b);
}
开发者ID:S-A-M-H,项目名称:Telegraph,代码行数:49,代码来源:stickersetbox.cpp


示例9: D3DXCreateTexture

ImagePtr D3D9VideoBufferManager::CreateImage(int iWidth, int iHeight, FORMAT Format)
{
    IDirect3DTexture9 * texture;
    HRESULT hr = D3DXCreateTexture(mD3D9Device, 
                                   iWidth,
                                   iHeight,
                                   1,
                                   0,
                                   D3D9Mapping::GetD3DFormat(Format),
                                   D3DPOOL_SYSTEMMEM,
                                   &texture);

    D3DErrorExceptionFunction(D3DXCreateTexture, hr);

    IDirect3DSurface9 * surface;
    texture->GetSurfaceLevel(0, &surface);
    D3DSURFACE_DESC desc;
    surface->GetDesc(&desc);

    D3D9Image * image = new D3D9Image();

    image->mWidth = desc.Width;
    image->mHeight = desc.Height;
    image->mSrcWidth = iWidth;
    image->mSrcHeight = iHeight;
    image->mFormat = D3D9Mapping::GetFormat(desc.Format);
    image->mMipmapLevel = texture->GetLevelCount();
    image->mD3D9Texture = texture;

    surface->Release();

    return ImagePtr(image);
}
开发者ID:ak4hige,项目名称:myway3d,代码行数:33,代码来源:MWD3D9VideoBufferManager.cpp


示例10: greenptr

/**
 * \brief Combine image, mask and center into a color image
 */
ImagePtr	VCurveFocusWork::combine(ImagePtr image, FWHMInfo& fwhminfo) {
	// first build the red channel from the mask
	Image<unsigned char>	*red
		= dynamic_cast<Image<unsigned char> *>(&*fwhminfo.mask);
	if (NULL == red) {
		throw std::logic_error("internal error, mask has not 8bit pixel type");
	}

	// then build the green channel from the original image
	Image<unsigned char>	*green = FocusWork::green(image);
	ImagePtr	greenptr(green);

	// create the blue image
	CrosshairAdapter<unsigned char>	crosshair(image->size(), fwhminfo.maxpoint, 20);
	CircleAdapter<unsigned char>	circle(image->size(), fwhminfo.center,
						fwhminfo.radius);
	MaxAdapter<unsigned char>	blue(crosshair, circle);

	// now use a combination adapter to put all these images together
	// into a single color image
	CombinationAdapter<unsigned char>	combinator(*red, *green, blue);
	Image<RGB<unsigned char> >	*result
		= new Image<RGB<unsigned char> >(combinator);

	return ImagePtr(result);
}
开发者ID:felipebetancur,项目名称:AstroPhotography-2,代码行数:29,代码来源:VCurveFocusWork.cpp


示例11: setImage

void VolumetricRep::setImage(ImagePtr image)
{
	if (image==mImage)
	{
		return;
	}

	if (mImage)
	{
		mVolumeProperty->setImage(ImagePtr());
		disconnect(mImage.get(), &Image::vtkImageDataChanged, this, &VolumetricRep::vtkImageDataChangedSlot);
		disconnect(mImage.get(), &Image::transformChanged, this, &VolumetricRep::transformChangedSlot);
		mMonitor.reset();
		mMapper->SetInputData( (vtkImageData*)NULL );
	}

	mImage = image;

	if (mImage)
	{
		connect(mImage.get(), &Image::vtkImageDataChanged, this, &VolumetricRep::vtkImageDataChangedSlot);
		connect(mImage.get(), &Image::transformChanged, this, &VolumetricRep::transformChangedSlot);
		mVolumeProperty->setImage(mImage);
		this->vtkImageDataChangedSlot();
		mMonitor = ImageMapperMonitor::create(mVolume, mImage);
	}
}
开发者ID:c0ns0le,项目名称:CustusX,代码行数:27,代码来源:cxVolumetricRep.cpp


示例12: ImagePtr

ImagePtr PixelStreamSynchronizer::getTileImage( const uint tileIndex ) const
{
    if( !_updater )
        return ImagePtr();

    return _updater->getTileImage( tileIndex );
}
开发者ID:eile,项目名称:Tide,代码行数:7,代码来源:PixelStreamSynchronizer.cpp


示例13: ImagePtr

ImagePtr Image::copy()
{
	vtkImageDataPtr baseImageDataCopy;
	if(mBaseImageData)
	{
		baseImageDataCopy = vtkImageDataPtr::New();
		baseImageDataCopy->DeepCopy(mBaseImageData);
	}

	ImagePtr retval = ImagePtr(new Image(mUid, baseImageDataCopy, mName));

	retval->mUnsigned = mUnsigned;
	retval->mModality = mModality;
	retval->mImageType = mImageType;
	retval->mMaxRGBIntensity = mMaxRGBIntensity;
	retval->mInterpolationType = mInterpolationType;
	retval->mImageLookupTable2D = mImageLookupTable2D;
	retval->mImageTransferFunctions3D = mImageTransferFunctions3D;
	retval->mInitialWindowWidth = mInitialWindowWidth;
	retval->mInitialWindowLevel = mInitialWindowLevel;

	//From cx::Data
	retval->mRegistrationStatus = mRegistrationStatus;
	retval->m_rMd_History = m_rMd_History;

	return retval;
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:27,代码来源:cxImage.cpp


示例14: ImagePtr

TexturePtr LightView::generateLightBubble(float centerFactor)
{
    int bubbleRadius = 256;
    int centerRadius = bubbleRadius * centerFactor;
    int bubbleDiameter = bubbleRadius * 2;
    ImagePtr lightImage = ImagePtr(new Image(Size(bubbleDiameter, bubbleDiameter)));

    for(int x = 0; x < bubbleDiameter; x++) {
        for(int y = 0; y < bubbleDiameter; y++) {
            float radius = std::sqrt((bubbleRadius - x)*(bubbleRadius - x) + (bubbleRadius - y)*(bubbleRadius - y));
            float intensity = stdext::clamp<float>((bubbleRadius - radius) / (float)(bubbleRadius - centerRadius), 0.0f, 1.0f);

            // light intensity varies inversely with the square of the distance
            intensity = intensity * intensity;
            uint8_t colorByte = intensity * 0xff;

            uint8_t pixel[4] = {colorByte,colorByte,colorByte,0xff};
            lightImage->setPixel(x, y, pixel);
        }
    }

    TexturePtr tex = TexturePtr(new Texture(lightImage, true));
    tex->setSmooth(true);
    return tex;
}
开发者ID:DSpeichert,项目名称:otclient,代码行数:25,代码来源:lightview.cpp


示例15: info

/** Create object from file.
  * If file or file+.mhd exists, use this,
  * Otherwise assume input is split over several
  * files and try to load all mhdFile + i + ".mhd".
  * forall i.
  */
USFrameDataPtr USFrameData::create(QString inputFilename)
{
	QFileInfo info(inputFilename);

	TimeKeeper timer;
	QString mhdSingleFile = info.absolutePath()+"/"+info.completeBaseName()+".mhd";

	if (QFileInfo(mhdSingleFile).exists())
	{
		vtkImageDataPtr image = MetaImageReader().loadVtkImageData(mhdSingleFile);
		// load from single file
		USFrameDataPtr retval = USFrameData::create(ImagePtr(new Image(mhdSingleFile, image)));
		retval->mName = QFileInfo(mhdSingleFile).completeBaseName();
		timer.printElapsedms(QString("Loading single %1").arg(inputFilename));
		return retval;
	}
	else
	{
		USFrameDataPtr retval(new USFrameData());
		retval->mName = QFileInfo(inputFilename).completeBaseName();
		retval->mImageContainer.reset(new cx::CachedImageDataContainer(inputFilename, -1));
		retval->resetRemovedFrames();
		return retval;
	}
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:31,代码来源:cxUSFrameData.cpp


示例16: mutex

ImagePtr EglDisplay::getImage(EGLImageKHR img) const {
    emugl::Mutex::AutoLock mutex(m_lock);
    /* img is "key" in map<unsigned int, ImagePtr>. */
    unsigned int hndl = SafeUIntFromPointer(img);
    ImagesHndlMap::const_iterator i( m_eglImages.find(hndl) );
    return (i != m_eglImages.end()) ? (*i).second :ImagePtr(NULL);
}
开发者ID:Dorahe,项目名称:platform_external_qemu,代码行数:7,代码来源:EglDisplay.cpp


示例17: PhotoId

void PeerData::clearUserpic() {
	const auto photoId = PhotoId(0);
	const auto loc = StorageImageLocation();
	const auto photo = [&] {
		if (id == peerFromUser(ServiceUserId)) {
			auto image = Messenger::Instance().logoNoMargin().scaledToWidth(
				kUserpicSize,
				Qt::SmoothTransformation);
			auto pixmap = App::pixmapFromImageInPlace(std::move(image));
			return _userpic
				? _userpic
				: ImagePtr(std::move(pixmap), "PNG");
		}
		return ImagePtr();
	}();
	setUserpicChecked(photoId, loc, photo);
}
开发者ID:zhangsoledad,项目名称:tdesktop,代码行数:17,代码来源:data_peer.cpp


示例18: ImagePtr

	ImagePtr Image::create( int width, int height )
	{
		ImagePtr img = ImagePtr( new Image() );
		img->m_data = (unsigned char *)malloc( width*height*4*sizeof(char) );
		img->m_width = width;
		img->m_height = height;
		return img;
	}
开发者ID:skydave,项目名称:base,代码行数:8,代码来源:Image.cpp


示例19: debug

/**
 * \brief Refresh by creating a copy of the image, and updating the offset
 */
void	RefreshingTracker::refresh(const ConstImageAdapter<double>& adapter,
		const Point offset) {
	_image = new Image<double>(adapter);
	debug(LOG_DEBUG, DEBUG_LOG, 0, "refreshing with image %s",
		_image->size().toString().c_str());
	_imageptr = ImagePtr(_image);
	_offset = _offset + offset;
	_lastimagetime = Timer::gettime();
}
开发者ID:AndreasFMueller,项目名称:AstroPhotography,代码行数:12,代码来源:RefreshingTracker.cpp


示例20: LoadImage

	ImagePtr LoadImage(const std::string& name)
	{
		int width, height, comp;
		uint8_t* rawData = stbi_load(name.c_str(), &width, &height, &comp, STBI_rgb);

		if (!rawData)
		{
			printf("Failed to open image file %s - %s\n", name.c_str(), stbi_failure_reason());
			// TODO : return default texture
			return ImagePtr();
		}

		std::vector<uint8_t> data;
		data.assign(rawData, rawData + (width * height * comp));
		stbi_image_free(rawData);

		return ImagePtr(new ImageData(data, width, height, comp));
	}
开发者ID:strelkovsky,项目名称:Eugenix,代码行数:18,代码来源:Image.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ImmGetContext函数代码示例发布时间:2022-05-30
下一篇:
C++ ImageList_Destroy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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