All pastes #216767 Raw Edit

Untitled

public cpp v1 · immutable
#216767 ·published 2006-10-23 08:51 UTC
rendered paste body
void PhotoBox::RenderCamera(){	ARUint8* buffer = NULL;	buffer = arVideoGetImage();	static unsigned char** ss_rows;	if (buffer != NULL)	{		/*		int y_offset = 0;		unsigned char c;		int pixel = 0;		for (int y = 0; y < mDim[1]; ++y)		{			y_offset = y * mDim[0] * 3;			for (int x = 0; x < mDim[0]; ++x)			{							// The << 2 multiplies the position by 4 moving				// it to the correct location of the Uint8 buffer.							c = buffer[ (((y) * mDim[0]+(x)) << 2) + 0];				mTexBuf[y_offset + x * 3 + 0] = c; 				c = buffer[ (((y) * mDim[0]+(x)) << 2) + 1];				mTexBuf[y_offset + x * 3 + 1] = c; 				c = buffer[ (((y) * mDim[0]+(x)) << 2) + 2];				mTexBuf[y_offset + x * 3 + 2] = c;						}		}		*/		/*		if (!mbWritten)		{			WritePNG("test.png",mTexBuf, mDim[0], mDim[1]);//			LOG("Image written.\n");			mbWritten = true;		}		*/		// Draw the image to the screen		SDL_Rect dstrect;		//mpVideoSurface->pixels = mTexBuf;		mpVideoSurface->pixels = buffer;				dstrect.x = (mpScreen->w-mpVideoSurface->w)/2 ;		dstrect.y = (mpScreen->h-mpVideoSurface->h)/2 ;		dstrect.w = mpVideoSurface->w;		dstrect.h = mpVideoSurface->h;				int result = 0;						// Now, put the overlay on top of the mpVideoSurface		mpPhotoOverlay->PutCurrentOverlayOverSurface(mpVideoSurface);		// Put the polaroid surface over the video surface		SDL_Rect video_rect;		video_rect.x = mPolaroidPos.x + 3;		video_rect.y = mPolaroidPos.y + 26;		result = SDL_BlitSurface( mpVideoSurface, NULL,mpScreen, &mVideoPos);		result = SDL_BlitSurface( mpPolaroid, NULL,mpScreen, &mPolaroidPos);				if (!mbWritten)		{			mpPhotoSnapshot->TakeSnapshots();			mbWritten = true;			// Cut and paste the video			SDL_Rect cut,paste;			cut.x = cut.y = 0;			cut.w = mVideoPos.w;			cut.h = mVideoPos.h;			paste.x = 0;			paste.y = 26;			paste.w = mVideoPos.w;			paste.h = mVideoPos.h;						SDL_SetAlpha(mpVideoSurface, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT);			SDL_BlitSurface( mpVideoSurface,&cut, s,&paste);			//mpPNG->Save(mpPolaroid, ".\\t_transparent.png");			// Cut & paste the polaroid			cut.x = cut.y = 0;			cut.w = mPolaroidPos.w;			cut.h = mPolaroidPos.h;			paste.x = 0;			paste.y = 0;			paste.w = mPolaroidPos.w;			paste.h = mPolaroidPos.h;			SDL_SetAlpha(s, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT);			SDL_BlitSurface( mpPolaroid,&cut, s,&paste);			SDL_SetAlpha(s, SDL_SRCALPHA, SDL_ALPHA_TRANSPARENT);			mpPNG->Save(s, ".\\s.png");		}	}	arVideoCapNext();}