Is there a bug with drawing text to images in B+?

BlitzPlus Forums/BlitzPlus Programming/Is there a bug with drawing text to images in B+?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ugh, I give up on this rotated text function, I wasted too much time on it, and because of how Blitz rotates images and offsets the image handle when the image is rotated, it makes it impossible to position the text precisely. I'm sure I could fix it with a bunch of kludges, but just forget it. Not worth the time and effort just to have text printed vertically.

; -----------------------------------------------------------------------------------------------------------------------------------
; This function draws rotated text at the specified location on the screen.  It works exactly like the text command.  
; The text is drawn in the current drawing color.
;
; Because the function uses masked images to draw the text, black text will not work with this function. 
; If you need black text, use Color 1,1,1 instead.

; Parameters:
; Angle is the angle to draw the text at.  0 = Unrotated, 90 = 90 degrees clockwise rotation.
; If you set masked to FALSE, them the text will be drawn with a solid black baground behind it.
; Border allows you to make the black background a few pixels larger than the text when drawing text which is not masked.
;
; Keep in mind that when you rotate the text, the location you specify will be the top left corner of the first letter.
; If you rotate the text by 90 degrees, and then print it at (0,0) the text will be drawn off the screen.
;
; This function disables TFormFilter.  You will need to renenable TformFilter after calling this function if you need it enabled.
; -----------------------------------------------------------------------------------------------------------------------------------
Function RotatedText(Font, StringToOutput$, X, Y, Center_X=False, Center_Y=False, Angle, Masked=True, Border=0)

	Local OldBuffer
	Local TempImage
		
	; Store the currently active drawing buffer.
		OldBuffer = GraphicsBuffer()

	; Set the font to draw the text in so that we can find out how big an image we need for our string.
		SetFont Font 

	; Create an image to hold the text we want to rotate.					
		TempImage = CreateImage(StringWidth(StringToOutput$), StringHeight(StringToOutput$))
	
	; Set the drawing buffer to that of the image we want to put the text on.			
		SetBuffer ImageBuffer(TempImage)

	; Set the font to draw the text in AGAIN, because we have to set the font for each buffer we want to draw to.
		SetFont Font 
	
	; Draw the text to the temporary image.
		Text 0, 0, StringToOutput$
	
	; Rotate the image.  This changes the size of the image.			
		TFormFilter False
		RotateImage TempImage, Angle
	
	; Draw the rotated image at the specified location on the screen.	
		
		SetBuffer OldBuffer
		
		If Center_X Then X = X - ImageWidth(TempImage)/2
		If Center_Y Then Y = Y - ImageHeight(TempImage)/2

		If Masked 		
			DrawImage TempImage, X, Y
		Else
			DrawBlock TempImage, X, Y
		EndIf
		
	; Clean up.
		FreeImage TempImage

End Function