Copying Images
Posted: Sat Mar 20, 2010 11:48 pm
				
				I have been reading through this forum for the last month and also the help topics in the program and I am so stuck.  I can't even get started.
I want to:
- write a program that lets you include a bitmap pic in the compiled program
- copy that pic to a hidden buffer so that changes can be made to the pic before it's displayed
- and draw the final pic to the window without using an image gadget
I don't want to draw the final pic to image gadgets because image gadgets cover buttons when the window paints
Heres my Common.pb code:
and heres my Skin.pb code
Can anybody help me?  Is it even possible to do what I want to do?
Also, the compiler says CreateGadgetList was depreciated. So I took that line out and the error went away. Is that really all I had to do?
			I want to:
- write a program that lets you include a bitmap pic in the compiled program
- copy that pic to a hidden buffer so that changes can be made to the pic before it's displayed
- and draw the final pic to the window without using an image gadget
I don't want to draw the final pic to image gadgets because image gadgets cover buttons when the window paints
Heres my Common.pb code:
Code: Select all
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
  #SkinTest
EndEnumeration
;- Gadget Constants
;
Enumeration
  #iNewPic
  #ScrollX
  #ScrollY
  #bEnter
  #Chat
  #Entry
  #Slider
  #Back
  #DouBuf
EndEnumeration
;- Image Plugins
;- Image Globals
Global Image0
Global Image1
Global Image2
;- Catch Images
Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
Image2 = CatchImage(2, ?Image2)
;- Images
DataSection
Image0:
  IncludeBinary ""
Image1:
  IncludeBinary "C:\SkinTest\Skin.bmp"
Image2:
  IncludeBinary ""
EndDataSection
Procedure Open_SkinTest()
  If OpenWindow(#SkinTest, 359, 105, 561, 288, "Skin Test",  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
    If CreateGadgetList(WindowID(#SkinTest))
      ImageGadget(#iNewPic, 10, 10, 272, 216, Image0)
      ScrollBarGadget(#ScrollX, 10, 226, 272, 16, 0, 100, 33)
      ScrollBarGadget(#ScrollY, 280, 10, 16, 216, 0, 100, 33, #PB_ScrollBar_Vertical)
      ButtonGadget(#bEnter, 240, 250, 57, 20, "Enter")
      EditorGadget(#Chat, 10, 10, 289, 235)
      StringGadget(#Entry, 10, 250, 219, 19, "")
      TrackBarGadget(#Slider, 310, 250, 246, 25, 0, 100)
      ImageGadget(#Back, 0, 560, 562, 288, Image1)
      ImageGadget(#DouBuf, 0, 560, 807, 557, Image2)
    EndIf
  EndIf
EndProcedure
Code: Select all
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
IncludeFile "Common.pb"
Open_SkinTest()
;copy image from Back (later will be input from a file) to DouBuf
StartDrawing(ImageOutput(Image2) )
  DrawImage(ImageID(Image1),0,0)
StopDrawing()
Repeat ; Start of the event loop
  
  Event = WaitWindowEvent() ; This line waits until an event is received from Windows
  
  WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
  
  GadgetID = EventGadget() ; Is it a gadget event?
  
  EventType = EventType() ; The event type
  
  ;You can place code here, and use the result as parameters for the procedures
  
  If Event = #PB_Event_Gadget
    
    If GadgetID = #iNewPic
      
    ElseIf GadgetID = #ScrollX
      
    ElseIf GadgetID = #ScrollY
      
    ElseIf GadgetID = #bEnter
      
    ElseIf GadgetID = #Chat
      
    ElseIf GadgetID = #Entry
          ;temporary code To test the concept of drawing from the Buffer To the screen
          ;copy image from DouBuf to #SkinTest
          StartDrawing(ImageOutput(Image2) )
          DrawImage(ImageID(Image1),0,0)
          StopDrawing()
  
    ElseIf GadgetID = #Slider
      
    ElseIf GadgetID = #Back
      
    ElseIf GadgetID = #DouBuf
      
    EndIf
    
  EndIf
  
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;
Also, the compiler says CreateGadgetList was depreciated. So I took that line out and the error went away. Is that really all I had to do?