这篇教程C++ CreateSurface函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CreateSurface函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateSurface函数的具体用法?C++ CreateSurface怎么用?C++ CreateSurface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CreateSurface函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CreateSurfaceSurface 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,
示例2: CreateSlabSlab 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,
示例3: CreatePPSurfacePPSurface 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,
示例4: CRendererInputPinCNullVideoRendererInputPin::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,
示例5: FreeSurfacevoid 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,
示例6: FixLilEndianRageSurface *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,
示例7: CreateSurfacewxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface(){ DFBSurfaceDescription desc; desc.flags = DSDESC_CAPS; desc.caps = DSCAPS_PRIMARY; return CreateSurface(&desc);}
开发者ID:hgwells,项目名称:tive,代码行数:7,
示例8: RageMovieTextureMovieTexture_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,
示例9: CreateSurfaceHSURFACE 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,
示例10: mitkThrowvoid 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,
示例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,
示例12: CRendererInputPinCNullVideoRendererInputPin::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,
示例13: RestoreSurfaceWSERR 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,
示例14: definedRageSurface* 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,
示例15: TRACEvoid 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,
示例16: WaitThreadEndBOOL CMovie::OpenMovie(char *fname,int music,BOOL loop){ int size; Chunk aviFileHead; Chunk aviInfo; AVIMAINHEADER aviMainHead; WaitThreadEnd(); stream = readFile->StreamOpenFile(pack_sound,fname,size); if((-1)==stream) return FALSE; readFile->StreamReadFile(pack_sound,stream,(char *)&aviFileHead,sizeof(Chunk)); if(MAKEFOURCC('R','I','F','F')!=aviFileHead.ckID){ readFile->StreamCloseFile(pack_sound,stream); stream = -1; return FALSE; } readFile->StreamReadFile(pack_sound,stream,(char *)&aviInfo,sizeof(Chunk)); readFile->StreamReadFile(pack_sound,stream,(char *)&aviMainHead,sizeof(AVIMAINHEADER)); readFile->StreamSeekFile(pack_sound,stream,0,FILE_BEGIN); fpms = aviMainHead.dwMicroSecPerFrame; srcWidth = aviMainHead.dwWidth; srcHeight = aviMainHead.dwHeight; HDC hDC = ::GetDC(sysInf.hWnd); HBRUSH brush = CreateSolidBrush(RGB(0, 0, 8)); HBRUSH old_brush = (HBRUSH)SelectObject(hDC,brush); PatBlt(hDC,0,0,wWidth,wHeight,PATCOPY); SelectObject(hDC,old_brush); DeleteObject(brush); ::ReleaseDC(sysInf.hWnd,hDC); if(FALSE == CreateSurface() ){ } buffer_size = srcWidth*srcHeight*2; readBuf = (LPBYTE)malloc(buffer_size); xvidDec.Start_XviD(srcWidth,srcHeight,overlay_forcc[forccNum]); read_size = readFile->StreamReadFile(pack_sound,stream,(char *)readBuf,buffer_size); frame_cnt = 0; old_frame = 0; start_time = 0; old_time = 0; skip_cnt = 0; total_skip_cnt = 0; bPause = FALSE; if(NULL==lpSoundDS)lpSoundDS = new ClSoundDS(sysInf.hWnd,readFile,FALSE); bPlay = TRUE; bLoop = loop; changeExecMode( movie_mode ); musicNum = music; DWORD dwThreadID; hMovieThread = CreateThread(NULL,0,movieThread,this,0,&dwThreadID); bExitMovieThread = FALSE; return TRUE;} // CMovie::OpenMovie
开发者ID:0xrofi,项目名称:Aquaplus,代码行数:59,
示例17: connectvoid QmitkIsoSurface::CreateConnections(){ if ( m_Controls ) { connect( m_Controls->m_ImageSelector, SIGNAL(OnSelectionChanged(const mitk::DataNode*)), this, SLOT(ImageSelected(const mitk::DataNode*)) ); connect( m_Controls->createSurfacePushButton, SIGNAL(clicked()), this, SLOT(CreateSurface()) ); }}
开发者ID:david-guerrero,项目名称:MITK,代码行数:8,
|