3D-Pictures

BlitzPlus Forums/BlitzPlus Programming/3D-Pictures

Maybe you could readpixel what is on the screen, add the green and then write it back?
-->WritePixel x, y, ReadPixel(x, y) Or $00FF00
This example combines two black&white images:
	Graphics 800, 600, 0, 2
	SetBuffer BackBuffer()
	Cls
	Flip
	
	;create images
	RED_picture = CreateImage(800, 600)
	GRN_picture = CreateImage(800, 600)
	
	;-----------------------
	;  make red picture
	;-----------------------
	;this picture is a greyscale picture
	Cls
	For i = 0 To 1000
	cc = Rand(255)
	Color cc, cc, cc
	Oval Rand(800), Rand(600), Rand(80), Rand(60)
	Next
	
	GrabImage RED_picture, 0, 0
	
	Locate 0, 0
	Color 255, 255, 255
	Print "RED PICTURE"
	Flip
	
	Delay 500
	
	
	;-----------------------
	;   make green picture
	;-----------------------
	;this picture is a greyscale picture, too
	Cls
	For i = 0 To 1000
	cc = Rand(255)
	Color cc, cc, cc
	Rect Rand(800), Rand(600), Rand(80), Rand(60)
	Next
	
	GrabImage GRN_picture, 0, 0
	
	Color 255, 255, 255
	Locate 0, 0
	Print "GREEN PICTURE"
	
	Delay 500
	
	;-----------------------
	;    blend pictures
	;-----------------------
	
	Cls
	
	;used in combination with Read/WritePixelFast
	LockBuffer()
	LockBuffer(ImageBuffer(RED_picture))
	LockBuffer(ImageBuffer(GRN_picture))
	
	;for every pixel
	For y = 0 To 599
	For x = 0 To 799
	
		;get red from image 1	
		cc_RED% = ReadPixelFast(x, y, ImageBuffer(RED_picture)) And $FF0000
		;get green from image 2
		cc_GRN% = ReadPixelFast(x, y, ImageBuffer(GRN_picture)) And $00FF00
		;blend by adding them, and write result to screen
		WritePixelFast x, y, cc_RED% + cc_GRN%
	
	Next
	Next

	;unlock stuff
	UnlockBuffer(ImageBuffer(RED_picture))
	UnlockBuffer(ImageBuffer(GRN_picture))
	UnlockBuffer()
	
	Locate 0, 0
	Color 255, 255, 255
	Print "MIXED PICTURES"
	
	Flip
	WaitKey()
	
	End