movable text on an image?

Just starting out? Need help? Post your questions and find answers here.
DataMiner
User
User
Posts: 25
Joined: Mon Mar 28, 2005 1:29 pm
Location: Germany

movable text on an image?

Post by DataMiner »

Hi everybody!
For my father i created a simple image viewer, because my father hate to have 25 Buttons on a window. This was quiet simple to build. But now he ask me for drawing text on an image. Good, just use DrawText, i thought, but how can i get this text movable and editable after drawing??? And, with saving this modified image, keep it movable and editable???
I am grateful for each Note!
I am German - that's hard enough ;)
dige
Addict
Addict
Posts: 1430
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

I would do it like this:
Create a new image with same size, like the viewed image and
fill it with #white color.

Use the PB Commands to draw the Text inside the white image
and mix the two images together to a third image.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

DataMiner,

Here's a super-basic ugly example for you.

Code: Select all

EnableExplicit
UsePNGImageDecoder()
LoadImage(0, "c:\temp\bliss.png")
CopyImage(0, 1)
If OpenWindow(0, 0, 0, ImageWidth(0) + 15, ImageHeight(0) + 15, "Test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_TitleBar)
   ;
   If CreateGadgetList(WindowID(0))
      ImageGadget(0, 0, 0, ImageWidth(0), ImageHeight(0), ImageID(0), #PB_Image_Border)
   EndIf
   ;
EndIf
Define.l EventID
Repeat
   EventID = WaitWindowEvent()
   If EventID = #PB_Event_CloseWindow 
      Break
   ElseIf EventID = #WM_MOUSEMOVE
      FreeImage(0) : CopyImage(1, 0)
      StartDrawing(ImageOutput(0))
         DrawText(WindowMouseX(0), WindowMouseY(0), "Hello!")
      StopDrawing()
      SetGadgetState(0, ImageID(0))
   ElseIf EventID = #PB_Event_Gadget 
   EndIf
ForEver
DataMiner
User
User
Posts: 25
Joined: Mon Mar 28, 2005 1:29 pm
Location: Germany

Post by DataMiner »

:D Thank you very much! Both of you!
I'll think about your hints ...
I am German - that's hard enough ;)
Post Reply