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


C++ GetGWorldPixMap函数代码示例

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


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

示例1: UnlockPixels

void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{
    if ( m_selected.Ok() )
    {
        UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
    }
    m_selected = bitmap;
    if (m_selected.Ok())
    {
        if ( m_selected.GetHBITMAP() )
        {
            m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
            LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
            wxMask * mask = bitmap.GetMask() ;
            if ( mask )
            {
                m_macMask = mask->GetMaskBitmap() ;
            }
            SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
            CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
            m_ok = TRUE ;
        }
        else
        {
            m_ok = FALSE;
        }
    }
    else
    {
        m_ok = FALSE;
    }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:32,代码来源:dcmemory.cpp

示例2: GetPixBaseAddr

//--------------------------------------------------------
void ofQtVideoSaver::setGworldPixel( GWorldPtr gwPtr, int r, int g, int b, short x, short y){
	Ptr    gwAddress, gwAddressBase;
    long   gwWidth;
    char   red, blue, green;
    gwAddressBase = GetPixBaseAddr( GetGWorldPixMap( gwPtr ) );   /* Get head address of offscreen      */
    gwWidth = ( **GetGWorldPixMap( gwPtr ) ).rowBytes & 0x3fff;   /* Get with of offscreen              */
    gwAddress = gwAddressBase + ( x * 3 ) + ( y * gwWidth );  /* Get adress for current pixel       */
    *gwAddress = (unsigned char)r;                        /* Put red and move address forward   */
    *(gwAddress+1) = (unsigned char)g;                /* Put green and move address forward */
    *(gwAddress+2)   = (unsigned char)b;                       /* Put blue                           */
}
开发者ID:jphutson,项目名称:dynamic-images-and-eye-movements,代码行数:12,代码来源:ofQtVideoSaver.cpp

示例3: QTNewGWorldFromPtr

// Create the offscreen GWorld (using Image  as target memory)
void QuicktimeLiveImageStream::createGWorld()
{
    Rect         destinationBounds;
    OSStatus     err;
    GDHandle     origDevice;
    CGrafPtr     origPort;
    destinationBounds.left   = 0;
    destinationBounds.top    = 0;
    destinationBounds.right  = m_videoRectWidth;
    destinationBounds.bottom = m_videoRectHeight;
    err = QTNewGWorldFromPtr(&m_gw, k32ARGBPixelFormat, &destinationBounds,
                             NULL, NULL, 0, (Ptr)data(), 4*m_videoRectWidth);
    if (err !=0 )
    {
        OSG_DEBUG << "Could not create gWorld" << std::endl;
    }
    else
    {
        // Query
        GetGWorld (&origPort, &origDevice);
        SetGWorld (m_gw, NULL); // set current graphics port to offscreen
        m_pixmap = GetGWorldPixMap(m_gw);
        if (m_pixmap)
         {
             if (!LockPixels (m_pixmap)) // lock offscreen pixel map
             {
                 OSG_FATAL << "Could not lock PixMap" << std::endl;
             }
         }
        // Set back
        SetGWorld(origPort, origDevice);
    }
}
开发者ID:aalex,项目名称:osg,代码行数:34,代码来源:QuicktimeLiveImageStream.cpp

示例4: defined

void ofQuickTimePlayer::createImgMemAndGWorld(){
	Rect movieRect;
	movieRect.top 			= 0;
	movieRect.left 			= 0;
	movieRect.bottom 		= height;
	movieRect.right 		= width;
    if (pixelFormat == OF_PIXELS_RGBA) {
        pixels.allocate(width, height, OF_IMAGE_COLOR_ALPHA);
    } 
    else {
        pixels.allocate(width, height, OF_IMAGE_COLOR);
    }

	#if defined(TARGET_OSX) && defined(__BIG_ENDIAN__)
		offscreenGWorldPixels = new unsigned char[4 * width * height + 32];
		QTNewGWorldFromPtr (&(offscreenGWorld), k32ARGBPixelFormat, &(movieRect), NULL, NULL, 0, (offscreenGWorldPixels), 4 * width);		
	#else
        if (pixelFormat == OF_PIXELS_RGBA) {
            QTNewGWorldFromPtr (&(offscreenGWorld), k32RGBAPixelFormat, &(movieRect), NULL, NULL, 0, (pixels.getPixels()), 4 * width);
        }
        else {
            QTNewGWorldFromPtr (&(offscreenGWorld), k24RGBPixelFormat, &(movieRect), NULL, NULL, 0, (pixels.getPixels()), 3 * width);
        }
	#endif

	LockPixels(GetGWorldPixMap(offscreenGWorld));
	SetGWorld (offscreenGWorld, NULL);
	SetMovieGWorld (moviePtr, offscreenGWorld, nil);

}
开发者ID:ColoursAndNumbers,项目名称:openFrameworks,代码行数:30,代码来源:ofQuickTimePlayer.cpp

示例5: UnlockPixels

void _HYPlatformGraphicPane::_EndDraw	 (void)
{
	UnlockPixels (GetGWorldPixMap(thePane));
	SetGWorld 	 (savedPort,savedDevice);
	RGBForeColor (&saveFG);
	RGBBackColor (&saveBG);
}				
开发者ID:mdsmith,项目名称:OCLHYPHY,代码行数:7,代码来源:HYPlatformGraphicPane.cpp

示例6: defined

void ofxAlphaVideoPlayer::createImgMemAndGWorld(){
	Rect movieRect;
	movieRect.top 			= 0;
	movieRect.left 			= 0;
	movieRect.bottom 		= height;
	movieRect.right 		= width;
	offscreenGWorldPixels 	= new unsigned char[4 * width * height + 32];
	pixels					= new unsigned char[width*height*4]; // 4 =>rgba

	#if defined(TARGET_OSX) && defined(__BIG_ENDIAN__)
		//cout << "with Big Endian"<<endl;
		QTNewGWorldFromPtr (&(offscreenGWorld), k32ARGBPixelFormat, &(movieRect), NULL, NULL, 0, (offscreenGWorldPixels), 4 * width);		
	#else
		//cout << "no Big Endian"<<endl;
		QTNewGWorldFromPtr (&(offscreenGWorld), k32RGBAPixelFormat, &(movieRect), NULL, NULL, 0, (pixels), 4 * width);
	#endif
	/** POSSIBLE PIXEL FORMATS 
	k32BGRAPixelFormat            = 'BGRA', // 32 bit bgra    (Matrox)
	k32ABGRPixelFormat            = 'ABGR', // 32 bit abgr   
	k32RGBAPixelFormat            = 'RGBA', // 32 bit rgba   	
	 ***********/
	LockPixels(GetGWorldPixMap(offscreenGWorld));
	SetGWorld (offscreenGWorld, NULL);
	SetMovieGWorld (moviePtr, offscreenGWorld, nil);
	//------------------------------------ texture stuff:
	if (bUseTexture){
		// create the texture, set the pixels to black and
		// upload them to the texture (so at least we see nothing black the callback)
		tex.allocate(width,height,GL_RGBA);
		memset(pixels, 0, width*height*4);
		tex.loadData(pixels, width, height, GL_RGBA);
		allocated = true;
	}
}
开发者ID:runemadsen,项目名称:Ohland-Balloons-P3,代码行数:34,代码来源:ofxAlphaVideoPlayer.cpp

示例7: defined

void ofQuickTimePlayer::createImgMemAndGWorld() {
    Rect movieRect;
    movieRect.top 			= 0;
    movieRect.left 			= 0;
    movieRect.bottom 		= height;
    movieRect.right 		= width;
    offscreenGWorldPixels = new unsigned char[4 * width * height + 32];
    pixels.allocate(width,height,OF_IMAGE_COLOR);

#if defined(TARGET_OSX) && defined(__BIG_ENDIAN__)
    QTNewGWorldFromPtr (&(offscreenGWorld), k32ARGBPixelFormat, &(movieRect), NULL, NULL, 0, (offscreenGWorldPixels), 4 * width);
#else
    QTNewGWorldFromPtr (&(offscreenGWorld), k24RGBPixelFormat, &(movieRect), NULL, NULL, 0, (pixels.getPixels()), 3 * width);
#endif

    LockPixels(GetGWorldPixMap(offscreenGWorld));

    // from : https://github.com/openframeworks/openFrameworks/issues/244
    // SetGWorld do not seems to be necessary for offscreen rendering of the movie
    // only SetMovieGWorld should be called
    // if both are called, the app will crash after a few ofVideoPlayer object have been deleted

#ifndef TARGET_WIN32
    SetGWorld (offscreenGWorld, NULL);
#endif
    SetMovieGWorld (moviePtr, offscreenGWorld, nil);

}
开发者ID:qingchen1984,项目名称:3DPhotography,代码行数:28,代码来源:ofQuickTimePlayer.cpp

示例8: MacSetRect

void pxBuffer::blit(pxSurfaceNative s, int dstLeft, int dstTop, int dstWidth, int dstHeight, 
    int srcLeft, int srcTop)
{
		Rect pr;
		MacSetRect(&pr, 0, 0, width(), height());	
		
		GWorldPtr gworld;
		NewGWorldFromPtr (&gworld, 32, &pr, NULL, NULL, 0, (char*)base(), 4*width());

		Rect dr, sr;
		MacSetRect(&dr, dstLeft, dstTop, dstLeft + dstWidth, dstTop + dstHeight);
		MacSetRect(&sr, srcLeft, srcTop, srcLeft + dstWidth, srcTop + dstHeight);
		CopyBits((BitMapPtr)*GetGWorldPixMap(gworld),(BitMapPtr)*GetGWorldPixMap(s),&sr,&dr,srcCopy,NULL);
	
		DisposeGWorld(gworld);
}
开发者ID:codemodo,项目名称:pxCore,代码行数:16,代码来源:pxBufferNative.cpp

示例9: QutTexture_CreateCompressedTextureObjectFromFile

//=============================================================================
//		QutTexture_CreateCompressedTextureObjectFromFile :	Create a QD3D 
//															compressed texture.
//-----------------------------------------------------------------------------
TQ3TextureObject		
QutTexture_CreateCompressedTextureObjectFromFile(
									const FSSpec *	theFSSpec,
									TQ3PixelType	pixelType,
									TQ3Boolean		wantMipMaps)
{
	TQ3TextureObject	theTexture	= NULL;
	GWorldPtr			theGWorld	= NULL;
	PixMapHandle		thePixmap	= NULL;



	// Load the image, then create a texture from it
	theGWorld = QutTexture_CreateGWorldFromFile(theFSSpec, pixelType);
	if (theGWorld != NULL)
	{
		thePixmap	= GetGWorldPixMap(theGWorld);
		
		if( thePixmap != NULL)
		{
			theTexture = QutTexture_CreateCompressedTextureObjectFromPixmap(thePixmap, pixelType, wantMipMaps);
			DisposeGWorld(theGWorld);
		}
	}
	
	return(theTexture);
}
开发者ID:refnum,项目名称:quesa,代码行数:31,代码来源:QutTexture.c

示例10: pict_from_gworld

PRIVATE PicHandle
pict_from_gworld (GWorldPtr gp, int *lenp)
{
  PicHandle retval;

  if (!gp)
    retval = NULL;
  else
    {
      Rect pict_frame;
      PixMapHandle pm;

      pm = GetGWorldPixMap (gp);
      pict_frame = PIXMAP_BOUNDS (pm);
      retval = OpenPicture (&pict_frame);
      if (retval)
	{
	  ClipRect (&pict_frame);
	  HLock ((Handle) pm);
	  CopyBits ((BitMap *) STARH (pm), PORT_BITS_FOR_COPY (thePort),
		    &pict_frame, &pict_frame, srcCopy, NULL);
	  HUnlock ((Handle) pm);
	  ClosePicture ();
	}
    }
  return retval;
}
开发者ID:LarBob,项目名称:executor,代码行数:27,代码来源:scrap.c

示例11: EraseRectAndAlpha

void EraseRectAndAlpha(GWorldPtr gWorld, Rect *pRect)
{
	PixMapHandle	pixMap = GetGWorldPixMap(gWorld);
	long			rows;
	Ptr				rowBaseAddr;


    LockPixels(pixMap);
	rows = pRect->bottom - pRect->top;
    
    rowBaseAddr = GetPixBaseAddr(pixMap) + (GetPixRowBytes(pixMap) & 0x3fff) * pRect->top + pRect->left * GetPixDepth(pixMap) / 8;
	do
	{
		long	cols;
		UInt32	*baseAddr;
		
		cols = pRect->right - pRect->left;
		baseAddr = (UInt32*)rowBaseAddr;
		rowBaseAddr += (**pixMap).rowBytes & 0x3fff;
		do
		{
			*baseAddr++ = 0;
		} while (--cols);
	} while (--rows);

    UnlockPixels(pixMap);

} // EraseRectAndAlpha
开发者ID:fruitsamples,项目名称:VideoProcessing,代码行数:28,代码来源:QTUtilities.c

示例12: CreateDecompSeqForGWorldData

OSErr CreateDecompSeqForGWorldData(GWorldPtr srcGWorld, Rect *srcBounds, MatrixRecordPtr mr, GWorldPtr imageDestination, ImageSequence *imageSeqID)
{
    OSErr err;
    
    ImageDescriptionHandle imageDesc = (ImageDescriptionHandle)NewHandle(sizeof(ImageDescription));
    if (imageDesc)
    {
        err = MakeImageDescriptionForPixMap (GetGWorldPixMap(srcGWorld), &imageDesc);
        err = DecompressSequenceBegin(	imageSeqID, 
                                        imageDesc, 
                                        imageDestination, 
                                        0, 
                                        srcBounds, 
                                        mr, 
                                        srcCopy, 
                                        nil, 
                                        0, 
                                        codecNormalQuality, 
                                        bestSpeedCodec);
        DisposeHandle((Handle)imageDesc);
    }
    else
    {
        err = MemError();
    }
    
    return err;
}
开发者ID:fruitsamples,项目名称:VideoProcessing,代码行数:28,代码来源:QTUtilities.c

示例13: RGB2IndexGW

// Same as above except that it quickly uses a gworld to allow the systems excellent routines to do
// the business instead.
short RGB2IndexGW(CTabHandle theTable,RGBColor *theCol)
{
	Boolean		openWorld=false;
	short		index=-1;
	
	if (gBL_TintWorld==0L)
	{
		openWorld=true;
		OpenTintWorld(theTable);
	}
	
	if (gBL_TintWorld)
	{
		CGrafPtr	origPort;
		GDHandle	origGD;
		
		GetGWorld(&origPort,&origGD);
		SetGWorld(gBL_TintWorld,0L);
		SetCPixel(0,0,theCol);
		index=GPixelColour(GetGWorldPixMap(gBL_TintWorld),0,0);
		SetGWorld(origPort,origGD);
	}
	else
		return -1;

	if (openWorld)
		CloseTintWorld();

	return index;
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:32,代码来源:BLAST+Tint.c

示例14: ROM_UnsetVideoMode

static void ROM_UnsetVideoMode(_THIS, SDL_Surface *current)
{
	/* Free the current window, if any */
	if ( SDL_Window != nil ) {
		GWorldPtr memworld;
		
		/* Handle OpenGL support */
		Mac_GL_Quit(this);

		memworld = (GWorldPtr)GetWRefCon(SDL_Window);
		if ( memworld != nil ) {
			UnlockPixels(GetGWorldPixMap(memworld));
			DisposeGWorld(memworld);
		}
		if ( (current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
#if USE_QUICKTIME
			EndFullScreen(fullscreen_ctx, nil);
			SDL_Window = nil;
#else
			ROM_ShowMenuBar(this);
#endif
		}
	}
	current->pixels = NULL;
	current->flags &= ~(SDL_HWSURFACE|SDL_FULLSCREEN);
}
开发者ID:3bu1,项目名称:crossbridge,代码行数:26,代码来源:SDL_romvideo.c

示例15: defined

void ofVideoPlayer::createImgMemAndGWorld(){
	Rect movieRect;
	movieRect.top 			= 0;
	movieRect.left 			= 0;
	movieRect.bottom 		= height;
	movieRect.right 		= width;
	offscreenGWorldPixels 	= new unsigned char[4 * width * height + 32];
	pixels					= new unsigned char[width*height*3];

	#if defined(TARGET_OSX) && defined(__BIG_ENDIAN__)
		QTNewGWorldFromPtr (&(offscreenGWorld), k32ARGBPixelFormat, &(movieRect), NULL, NULL, 0, (offscreenGWorldPixels), 4 * width);		
	#else
		QTNewGWorldFromPtr (&(offscreenGWorld), k24RGBPixelFormat, &(movieRect), NULL, NULL, 0, (pixels), 3 * width);
	#endif

	LockPixels(GetGWorldPixMap(offscreenGWorld));
	SetGWorld (offscreenGWorld, NULL);
	SetMovieGWorld (moviePtr, offscreenGWorld, nil);
	//------------------------------------ texture stuff:
	if (bUseTexture){
		// create the texture, set the pixels to black and
		// upload them to the texture (so at least we see nothing black the callback)
		tex.allocate(width,height,GL_RGB);
		memset(pixels, 0, width*height*3);
		tex.loadData(pixels, width, height, GL_RGB);
		allocated = true;
	}
}
开发者ID:alejandroflores,项目名称:openFrameworks,代码行数:28,代码来源:ofVideoPlayer.cpp


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