Now I'm confused (Pixmaps)

BlitzMax Forums/BlitzMax Beginners Area/Now I'm confused (Pixmaps)

MattC(Posted 2005) [#1]
I must be doing something wrong but I've compared my code to the examples scattered about and I can' see a problem.

This code doesn't produce colour, only alpha values seem to be reproduced when I use drawimage(hill). If I draw the pixmap to the screen then I get the expected result (alphablended sickly yellow stripes).

        Local i%,j%
	Local alpha%=	255
	Local red%=	127
	Local green%=	127
	Local blue%=	63
	For t:terrain=EachIn mylist1
		hill=CreateImage(t.w,t.h)
		pmhill=LockImage(hill)
			For j=0 To t.h-1
				For i=0 To t.w-1
					alpha:+1
					If alpha>255 Then alpha=0
					WritePixel(pmhill,i,j,alpha Shl 24 + red Shl 16 + green Shl 8 + blue)
				Next
			Next
		UnlockImage(hill)
		Release pmhill
	next


I must be doing something wrong. Can anyone help, I've been going round in circles for an hour already!


Damien Sturdy(Posted 2005) [#2]
What OS are you using? can someone tell me if macos stores image data a dirrerent way? if youre on a mac rather than windows, youre likely writing the vales in backwards.....


MattC(Posted 2005) [#3]
AAAHH

Thanks for the reply but I found the answer in another thread.

I have a white background so at the beginning of my code I used setcolor(0,0,0). I forgot this affects drawimage now...

I did spend some time worrying about the order of the colour values, since the docs state RGBA8888... I'm using ARGB8888 without problems.


Damien Sturdy(Posted 2005) [#4]
Well I dont have a Mac so it was purely guesswork, but i know about the processors and that.

Glad you fixed it :D