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


C++ CreateSurface函数代码示例

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


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

示例1: CreateSurface

Surface Font::Render(const std::string & txt,
                     const Color & color,
                     bool cache)
{
  Surface surface;

  if (cache) {
    txt_iterator p = surface_text_table.find(txt);
    if( p == surface_text_table.end() ){
      if( surface_text_table.size() > 5 ){
        //SDL_FreeSurface( surface_text_table.begin()->second );
        surface_text_table.erase( surface_text_table.begin() );
      }
      surface = CreateSurface(txt, color);
      surface_text_table.insert( txt_sample(txt, surface) );
    } else {
      txt_iterator p2 = surface_text_table.find( txt );
      surface = p2->second;
    }
  } else {
    surface = CreateSurface(txt, color);
  }

  ASSERT( !surface.IsNull() );
  return surface;
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:26,代码来源:font.cpp

示例2: CreateSlab

Slab CreateSlab(GLsizei width, GLsizei height, int numComponents)
{
    Slab slab;
    slab.Ping = CreateSurface(width, height, numComponents);
    slab.Pong = CreateSurface(width, height, numComponents);
    return slab;
}
开发者ID:cycheng,项目名称:ThreadedMoviePlayback,代码行数:7,代码来源:CreateSlab.cpp

示例3: CreatePPSurface

PPSurface CreatePPSurface(GLsizei width, GLsizei height, int Components)
{
	PPSurface ppsurface;
	ppsurface.Ping = CreateSurface(width, height, Components);
	ppsurface.Pong = CreateSurface(width, height, Components);
	
	return ppsurface;

}
开发者ID:raghava-sudana,项目名称:FluidSimulation,代码行数:9,代码来源:Implementation.cpp

示例4: CRendererInputPin

CNullVideoRendererInputPin::CNullVideoRendererInputPin(CBaseRenderer *pRenderer, HRESULT *phr, LPCWSTR Name)
	: CRendererInputPin(pRenderer, phr, Name)
{
	HMODULE		hLib;

	CreateSurface();

	hLib = LoadLibrary (L"dxva2.dll");
	pfDXVA2CreateDirect3DDeviceManager9	= hLib ? (PTR_DXVA2CreateDirect3DDeviceManager9) GetProcAddress (hLib, "DXVA2CreateDirect3DDeviceManager9") : NULL;
	pfDXVA2CreateVideoService			= hLib ? (PTR_DXVA2CreateVideoService)           GetProcAddress (hLib, "DXVA2CreateVideoService") : NULL;


	if (hLib != NULL)
	{
		pfDXVA2CreateDirect3DDeviceManager9 (&m_nResetTocken, &m_pD3DDeviceManager);
	}

	// Initialize Device Manager with DX surface
	if (m_pD3DDev)
	{
		HRESULT hr;
		hr = m_pD3DDeviceManager->ResetDevice (m_pD3DDev, m_nResetTocken);
		hr = m_pD3DDeviceManager->OpenDeviceHandle(&m_hDevice);
	}
}
开发者ID:DieBagger,项目名称:MediaPortal-1,代码行数:25,代码来源:NullRenderers.cpp

示例5: FreeSurface

void Surface::Set(const void* pixels, unsigned int width, unsigned int height, unsigned char bytes_per_pixel, bool amask0)
{
    FreeSurface(*this);

    switch(bytes_per_pixel)
    {
	case 1:
	    CreateSurface(width, height, 8, false);
	    LoadPalette();
	    Lock();
	    std::memcpy(surface->pixels, pixels, width * height);
	    Unlock();
	    break;

	default:
	{
	    u32 rmask, gmask, bmask, amask;
	    GetRGBAMask(bytes_per_pixel * 8, rmask, gmask, bmask, amask);
	    surface = SDL_CreateRGBSurfaceFrom(const_cast<void *>(pixels), width, height, 8 * bytes_per_pixel, width * bytes_per_pixel,
		rmask, gmask, bmask, (amask0 ? amask : 0));
	}
	break;
    }

    if(!surface)
	Error::Except(__FUNCTION__, SDL_GetError());
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:27,代码来源:surface.cpp

示例6: FixLilEndian

RageSurface *RageMovieTextureDriver_FFMpeg::AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt, MovieDecoderPixelFormatYCbCr &fmtout )
{
	FixLilEndian();

	int iAVTexfmtIndex = FindCompatibleAVFormat( bPreferHighColor );
	if( iAVTexfmtIndex == -1 )
		iAVTexfmtIndex = FindCompatibleAVFormat( !bPreferHighColor );

	if( iAVTexfmtIndex == -1 )
	{
		/* No dice.  Use the first avcodec format of the preferred bit depth,
		 * and let the display system convert. */
		for( iAVTexfmtIndex = 0; AVPixelFormats[iAVTexfmtIndex].bpp; ++iAVTexfmtIndex )
			if( AVPixelFormats[iAVTexfmtIndex].bHighColor == bPreferHighColor )
				break;
		ASSERT( AVPixelFormats[iAVTexfmtIndex].bpp != 0 );
	}
	
	const AVPixelFormat_t *pfd = &AVPixelFormats[iAVTexfmtIndex];
	iAVTexfmt = pfd->pf;
	fmtout = pfd->YUV;

	LOG->Trace( "Texture pixel format: %i %i (%ibpp, %08x %08x %08x %08x)", iAVTexfmt, fmtout,
		pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );

	if( pfd->YUV == PixelFormatYCbCr_YUYV422 )
		iTextureWidth /= 2;

	return CreateSurface( iTextureWidth, iTextureHeight, pfd->bpp,
		pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
}
开发者ID:InuSasha,项目名称:stepmania,代码行数:31,代码来源:MovieTexture_FFMpeg.cpp

示例7: CreateSurface

wxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface()
{
    DFBSurfaceDescription desc;
    desc.flags = DSDESC_CAPS;
    desc.caps = DSCAPS_PRIMARY;
    return CreateSurface(&desc);
}
开发者ID:hgwells,项目名称:tive,代码行数:7,代码来源:wrapdfb.cpp

示例8: RageMovieTexture

MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
{
	LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)");
	texHandle = 0;

	RageTextureID actualID = GetID();

	actualID.iAlphaBits = 0;
	int size = 64;
	m_iSourceWidth = size;
	m_iSourceHeight = size;
	m_iImageWidth = size;
	m_iImageHeight = size;
	m_iTextureWidth = power_of_two(size);
	m_iTextureHeight = m_iTextureWidth;
	m_iFramesWide = 1;
	m_iFramesHigh = 1;

	CreateFrameRects();

	RagePixelFormat pixfmt = RagePixelFormat_RGBA4;
	if( !DISPLAY->SupportsTextureFormat(pixfmt) )
		pixfmt = RagePixelFormat_RGBA8;
	ASSERT( DISPLAY->SupportsTextureFormat(pixfmt) );

	const RageDisplay::RagePixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
	RageSurface *img = CreateSurface( size, size, pfd->bpp,
		pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
	memset( img->pixels, 0, img->pitch*img->h );

	texHandle = DISPLAY->CreateTexture( pixfmt, img, false );

	delete img;
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:34,代码来源:MovieTexture_Null.cpp

示例9: CreateSurface

HSURFACE CTextHelper::CreateSurfaceFromString (ILTClient* pClientDE, FONT* pFontDef, int strID, HLTCOLOR foreColor, HLTCOLOR backColor, LTBOOL bCropped, int nExtraX, int nExtraY)
{
	if (!pClientDE) return LTNULL;

	HLTFONT hFont = pClientDE->CreateFont (pFontDef->strFontName, 
										   pFontDef->nWidth,
										   pFontDef->nHeight,
										   pFontDef->bItalic,
										   pFontDef->bUnderline,
										   pFontDef->bBold);
	if (!hFont) return LTNULL;

	HSTRING hString = pClientDE->FormatString (strID);
	if (!hString)
	{
		pClientDE->DeleteFont (hFont);
		return LTNULL;
	}

	HSURFACE hSurface = CreateSurface (pClientDE, hFont, hString, foreColor, backColor, bCropped, nExtraX, nExtraY);

	pClientDE->DeleteFont (hFont);
	pClientDE->FreeString (hString);

	return hSurface;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:26,代码来源:TextHelper.cpp

示例10: mitkThrow

void mitk::ImageToSurfaceFilter::GenerateData()
{
  mitk::Surface *surface = this->GetOutput();
  mitk::Image * image        =  (mitk::Image*)GetInput();
  if(image == NULL || !image->IsInitialized())
    mitkThrow() << "No input image set, please set an valid input image!";

  mitk::Image::RegionType outputRegion = image->GetRequestedRegion();

  int tstart=outputRegion.GetIndex(3);
  int tmax=tstart+outputRegion.GetSize(3); //GetSize()==1 - will aber 0 haben, wenn nicht zeitaufgeloest

  if ((tmax-tstart) > 0)
  {
    ProgressBar::GetInstance()->AddStepsToDo( 4 * (tmax - tstart)  );
  }


  int t;
  for( t=tstart; t < tmax; ++t)
  {
    vtkImageData *vtkimagedata =  image->GetVtkImageData(t);
    CreateSurface(t,vtkimagedata,surface,m_Threshold);
    ProgressBar::GetInstance()->Progress();
  }
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:26,代码来源:mitkImageToSurfaceFilter.cpp

示例11: InitD3D

//-----------------------------------------------------------------------------
// Name: InitD3D()
// Desc: Initializes Direct3D
//-----------------------------------------------------------------------------
HRESULT InitD3D( HWND hWnd )
{
    // Create the D3D object.
    if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
        return E_FAIL;

    // Set up the structure used to create the D3DDevice. Since we are now
    // using more complex geometry, we will create a device with a zbuffer.
    D3DPRESENT_PARAMETERS d3dpp;
    ZeroMemory( &d3dpp, sizeof( d3dpp ) );
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
    d3dpp.EnableAutoDepthStencil = TRUE;
    d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

    // Create the D3DDevice
    if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
                                      D3DCREATE_SOFTWARE_VERTEXPROCESSING | 
									  D3DCREATE_MULTITHREADED | 
									  D3DCREATE_FPU_PRESERVE, 
                                      &d3dpp, &g_pd3dDevice ) ) )
    {
        return E_FAIL;
    }
	if (FAILED(CreateSurface(SCREEN_WIDTH, SCREEN_HEIGHT))) 
		return E_FAIL;
    // Turn on the zbuffer
    g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );

    // Turn on ambient lighting 
    g_pd3dDevice->SetRenderState( D3DRS_AMBIENT, 0xffffffff );

    return S_OK;
}
开发者ID:Narinyir,项目名称:WPF-DirectX,代码行数:39,代码来源:D3DRenderer.cpp

示例12: CRendererInputPin

CNullVideoRendererInputPin::CNullVideoRendererInputPin(CBaseRenderer* pRenderer, HRESULT* phr, LPCWSTR Name)
    : CRendererInputPin(pRenderer, phr, Name)
    , m_hDXVA2Lib(nullptr)
    , pfDXVA2CreateDirect3DDeviceManager9(nullptr)
    , pfDXVA2CreateVideoService(nullptr)
    , m_pD3DDev(nullptr)
    , m_pD3DDeviceManager(nullptr)
    , m_nResetToken(0)
    , m_hDevice(INVALID_HANDLE_VALUE)
{
    CreateSurface();

    m_hDXVA2Lib = LoadLibrary(L"dxva2.dll");
    if (m_hDXVA2Lib) {
        pfDXVA2CreateDirect3DDeviceManager9 = reinterpret_cast<PTR_DXVA2CreateDirect3DDeviceManager9>(GetProcAddress(m_hDXVA2Lib, "DXVA2CreateDirect3DDeviceManager9"));
        pfDXVA2CreateVideoService = reinterpret_cast<PTR_DXVA2CreateVideoService>(GetProcAddress(m_hDXVA2Lib, "DXVA2CreateVideoService"));
        pfDXVA2CreateDirect3DDeviceManager9(&m_nResetToken, &m_pD3DDeviceManager);
    }

    // Initialize Device Manager with DX surface
    if (m_pD3DDev) {
        m_pD3DDeviceManager->ResetDevice(m_pD3DDev, m_nResetToken);
        m_pD3DDeviceManager->OpenDeviceHandle(&m_hDevice);
    }
}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:25,代码来源:NullRenderers.cpp

示例13: RestoreSurface

WSERR WSurface::RestoreSurface()
{
	LPDIRECTDRAWSURFACE left_buffer=data->LeftBuffer;
	LPDIRECTDRAWSURFACE right_buffer=data->RightBuffer;

	HRESULT hr=DD_OK;
	bool need_restore=false;

	if (data->screen->IsLost()) {
		hr=data->screen->Restore();
		need_restore=true;
	}
	if (hr==DD_OK && left_buffer->IsLost()) {
		hr=left_buffer->Restore();
		need_restore=true;
	}
	if (hr==DD_OK && right_buffer->IsLost()) {
		hr=right_buffer->Restore();
		need_restore=true;
	}

	if (hr!=DD_OK) {
		WSERR err=CreateSurface();
		if (err!=WS_OK) return err;
		need_restore=false;
	}

	if (need_restore) {
		Refresh();
	}
	return WS_OK;
}
开发者ID:eastany,项目名称:eastany.github.com,代码行数:32,代码来源:wsurface.cpp

示例14: defined

RageSurface* RageDisplay_D3D::CreateScreenshot()
{
#if defined(XBOX)
	return NULL;
#else
	RageSurface * result = NULL;

	// Get the back buffer.
	IDirect3DSurface9* pSurface;
	if( SUCCEEDED( g_pd3dDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pSurface ) ) )
	{
		// Get the back buffer description.
		D3DSURFACE_DESC desc;
		pSurface->GetDesc( &desc );

		// Copy the back buffer into a surface of a type we support.
		IDirect3DSurface9* pCopy;
		if( SUCCEEDED( g_pd3dDevice->CreateOffscreenPlainSurface( desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pCopy, NULL ) ) )
		{
			if( SUCCEEDED( D3DXLoadSurfaceFromSurface( pCopy, NULL, NULL, pSurface, NULL, NULL, D3DX_FILTER_NONE, 0) ) )
			{
				// Update desc from the copy.
				pCopy->GetDesc( &desc );

				D3DLOCKED_RECT lr;

				{
					RECT rect;
					rect.left = 0;
					rect.top = 0;
					rect.right = desc.Width;
					rect.bottom = desc.Height;

					pCopy->LockRect( &lr, &rect, D3DLOCK_READONLY );
				}

				RageSurface *surface = CreateSurfaceFromPixfmt( FMT_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
				ASSERT( surface != NULL );

				// We need to make a copy, since lr.pBits will go away when we call UnlockRect().
				result = 
					CreateSurface( surface->w, surface->h,
						surface->format->BitsPerPixel,
						surface->format->Rmask, surface->format->Gmask,
						surface->format->Bmask, surface->format->Amask );
				RageSurfaceUtils::CopySurface( surface, result );
				delete surface;

				pCopy->UnlockRect();
			}

			pCopy->Release();
		}

		pSurface->Release();
	}

	return result;
#endif
}
开发者ID:augustg,项目名称:openitg,代码行数:60,代码来源:RageDisplay_D3D.cpp

示例15: TRACE

void CChildView::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
    if (m_hWnd && cx && cy) {
        TRACE("OnSize: width == %d, height == %d\n", cx, cy);

		// Initialize screen format
		// First time init with an hwnd
		if (m_eSurf == eNone) {
			CClientDC dc(this);
			int pixels;
			bool bWarnDepth = false;
			bool bWarnDebug = false;

			SetTimer(m_kTimerID, m_kTimerDelay, NULL);
			pixels = dc.GetDeviceCaps(BITSPIXEL) * dc.GetDeviceCaps(PLANES);
			switch (pixels) {
				case 16:
					m_eSurf = IsSSE2() ? e16BitSSE2Intrin :
						IsMMX() ? e16BitMMXIntrin : e16BitGeneric;
					break;
				case 24:
					m_eSurf =  IsSSE2() ? e24BitSSE2Intrin :
						IsMMX() ? e24BitMMXIntrin : e24BitGeneric;
					break;
				case 32:
					m_eSurf =  IsSSE2() ? e32BitSSE2Intrin :
						IsMMX() ? e32BitMMXIntrin : e32BitGeneric;
					break;
				default:
					bWarnDepth = true;
					m_eSurf =  IsSSE2() ? e32BitSSE2Intrin :
						IsMMX() ? e32BitMMXIntrin : e32BitGeneric;
					break;
			}
#ifdef _DEBUG
			bWarnDebug = true;
#endif
			if (bWarnDepth || bWarnDebug) {
				CString fmt;
				if (bWarnDepth) {
					fmt.LoadString(IDS_WARNING_BITDEPTH);
				}
				if (bWarnDepth && bWarnDebug) {
					fmt += "\n";
				}
				if (bWarnDebug) {
					CString temp;
					temp.LoadString(IDS_WARNING_DEBUG);
					fmt += temp;
				}
				::AfxMessageBox(fmt, MB_ICONINFORMATION);
			}

		}

		m_bSizeChanged = true;
		CreateSurface();
    }
}
开发者ID:jetlive,项目名称:skiaming,代码行数:60,代码来源:ChildView.cpp


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