i want to watermark some pictures and i'm almost there but i don't understand the drawing modes
please see image for what i have done and what i need to do

Code: Select all
Procedure DEG2RAD (x)
ProcedureReturn (x / 180 * #PI)
EndProcedure
UseJPEGImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()
UseJPEGImageEncoder()
Global fontsize.l = 20
Global fontangle = 30
Global twidth
Global theight
Global xpos
Global ypos
Global mytext.s = "any text here"
Enumeration
#MyImage
EndEnumeration
If OpenWindow(0, 0, 0, 600, 400, "watermark", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
image_path.s = OpenFileRequester("Select image", "","Images (JPG,PNG,TIFF,TGA) | *.jpg;*.jpeg;*.png;*.tif;*.tiff;*.tga", 0)
If image_path
If LoadImage(#MyImage,image_path) <> 0
ResizeWindow(0,100,100,ImageWidth(#MyImage),ImageHeight(#MyImage))
LoadFont(0, "Arial",fontsize)
StartDrawing(ImageOutput(#MyImage))
DrawingFont(FontID(0))
twidth = TextWidth(mytext)
theight = TextHeight(mytext)
xpos = ((ImageWidth(#MyImage) / 2) - (Cos(deg2rad(fontangle)) * (twidth/2)))
ypos = ((ImageHeight(#MyImage) / 2) + (Sin(deg2rad(fontangle)) * (twidth / 2)) + (Cos(deg2rad(fontangle))* (theight / 2)))
DrawingMode(#PB_2DDrawing_Default )
DrawRotatedText(xpos,ypos, mytext,fontangle,RGB(255,0,0))
StopDrawing()
ImageGadget(0, 0, 0, ImageWidth(#MyImage) , ImageHeight(#MyImage), ImageID(#MyImage))
Else
MessageRequester("Error", "Error loading image", 0)
EndIf
Else
MessageRequester("Error", "No image selected", 0)
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf