[5.60b1] AddImageFrame with start/stop drawing

Just starting out? Need help? Post your questions and find answers here.
User avatar
ar-s
Enthusiast
Enthusiast
Posts: 344
Joined: Sat Oct 06, 2007 11:20 pm
Location: France

[5.60b1] AddImageFrame with start/stop drawing

Post by ar-s »

That is working

Code: Select all

Enumeration Window
  #mainForm
EndEnumeration

Enumeration Gadget
  #image 
EndEnumeration

Global Image = CreateImage(#PB_Any, 100, 100, 24)
 
Declare Start()
Declare ChangeFrame()
Declare Exit()

Start()

Procedure Start()
  ;Creation de trois frames
  StartDrawing(ImageOutput(Image))
  Box(0, 0, 100, 100, RGB(255, 0, 0)) ;Red
  StopDrawing()
 
  AddImageFrame(Image)
  StartDrawing(ImageOutput(Image))
  Box(0, 0, 100, 100, RGB(0, 0, 255)) ;Blue
  StopDrawing()
 
  AddImageFrame(Image)
  StartDrawing(ImageOutput(Image))
  Box(0, 0, 100, 100, RGB(255, 215, 0)) ;Yellow
  StopDrawing()

; So many StartStopDrawing ! 


  ;Affichage du nombre de frames : On a bien les 3 frames
  Debug "Image frame count " + ImageFrameCount(Image)

  ;Selection de la première frame
  SetImageFrame(Image, 0)
 
  OpenWindow(#mainForm, 0, 0, 500, 300, "Image animée", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(#image, 10, 10, 0, 0, ImageID(Image))
 
  AddWindowTimer(#mainForm, 0, 1000)
 
  ;Triggers
  BindEvent(#PB_Event_CloseWindow, @Exit())
  BindEvent(#PB_Event_Timer, @ChangeFrame())
 
  Repeat : WaitWindowEvent() : ForEver
EndProcedure

Procedure ChangeFrame()
  Static Frame
  Frame +1
  If Frame = 3
    Frame = 0
  EndIf
     
  SetImageFrame(Image, Frame)
  SetGadgetState(#Image, ImageID(Image))
EndProcedure

Procedure Exit() 
  End
EndProcedure

But we should be able to write like that in the Start() Procedure

Code: Select all

;Creation de 3 frames
  StartDrawing(ImageOutput(Image))   ; Only one
  Box(0, 0, 100, 100, RGB(255, 0, 0)) ;Red ; First frame

  AddImageFrame(Image)
  Box(0, 0, 100, 100, RGB(0, 0, 255)) ;Blue

  AddImageFrame(Image)
  Box(0, 0, 100, 100, RGB(255, 215, 0)) ;Yellow

  StopDrawing()  ; Only one
But here the red frame does not appear.
~Ar-S~
My Image Hoster for PB users
My webSite (french) with PB apps : LDVMULTIMEDIA
PB - 3.x / 5.7x / 6 - W11 x64 - Ryzen 7 3700x / #Rpi4

Code: Select all

r3p347 : 7ry : un71l d0n3 = 1
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: [5.60b1] AddImageFrame with start/stop drawing

Post by walbus »

Interesting,
but, i think the Bug Report thread is not optimal for this
I have linked it in the 560 beta1 thread for further comments and testings
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.60b1] AddImageFrame with start/stop drawing

Post by Fred »

This is the way it is done for now, it's not a bug. If you want to add a frame, you create a new image and you need to change the drawing area for StartingDrawin().
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: [5.60b1] AddImageFrame with start/stop drawing

Post by walbus »

Yep Fred,
this all are great news, thanks a lot, it feel very very good !
Post Reply