Mixing rasters with generated shapes

BlitzMax Forums/BlitzMax Programming/Mixing rasters with generated shapes

sandav(Posted 2007) [#1]
what I'm trying to do is make a fancy looking box by using greyScale images from a .png for the corners, and drawing the rest with Max2D functions. The problem I'm having is getting the colors to match. I want to be able to change the color of the whole thing simply by sending different R, G, and B parameters to it. the colors used in the .png are R=51,G=51,B=51 and R=108,G=108,B=108. What do I need to put in the SetColor() function to make the lines I'm drawing be the same as the ones from the .png?

Heres my code

	Function DrawFancy(UpperLeftX%,UpperLeftY%,Width%,Height%, R%, G%, B%)
		SetAlpha(.7)
		SetColor(r,g,b)
		DrawRect(UpperLeftX,UpperLeftY,Width,Height)
		SetAlpha(1)
		DrawImage(GuiImage,UpperLeftX-16,UpperLeftY-16,13)
		DrawImage(GuiImage,UpperLeftX+width,UpperLeftY-16,14)
		DrawImage(GuiImage,UpperLeftX-16,UpperLeftY+height,15)
		DrawImage(GuiImage,UpperLeftX+width,UpperLeftY+height,16)
		SetColor(51 + r,51 + g,51 + b) 'side lines
		DrawRect(UpperLeftX,UpperLeftY-3,width,3)      
		DrawRect(UpperLeftX,UpperLeftY+height,width,3)
		DrawRect(UpperLeftX-3,UpperLeftY,3,Height)
		DrawRect(UpperLeftX+width,UpperLeftY,3,Height)
		SetColor(108 + r, 108 + g,108 +b)  'middle stripes
		DrawLine(UpperLeftX,UpperLeftY-2,UpperLeftX+width-1,UpperLeftY-2)
		DrawLine(UpperLeftX,UpperLeftY+height+1,UpperLeftX+width-1,UpperLeftY+height+1)
		DrawLine(UpperLeftX-2,UpperLeftY,UpperLeftX-2,UpperLeftY+Height-1)
		DrawLine(UpperLeftX+width+1,UpperLeftY,UpperLeftX+width+1,UpperLeftY+height-1)
		SetColor(255,255,255)
	EndFunction