ok i just tried the timer routine is this: (tickervideo is the form containing the label lbtickervideo2) Sub scorritestovideo_Timer FlickerControl(tickervideo, 0) lbtickervideo2.Left = lbtickervideo2.Left - 1 If lbtickervideo2.Left < (-lbtickervideo2.Width) Then lbtickervideo2.Left = tickervideo.Width FlickerControl(tickervideo, 1) EndSub Procedure FlickerControl(frm As Form, state%) // v1 // state% : 0 - Suspend Rendering; 1 - Reinstate and Redraw ~SendMessage(frm.hWnd, WM_SETREDRAW, state%, 0) If state% = 1 Then ~RedrawWindow(frm.hWnd, Null, Null, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN) EndProcedure
And using a simple hidden form, maybe that you enjoy ?
Global String TXT = "- Je voudrais savoir une dernière chose, dit Harry. Est-ce que tout cela est réel ? Ou bien est-ce dans ma tête que ça se passe ?" OpenW 1 : AutoRedraw = 1 Form Hidden HF HF.AutoRedraw = True Set Me = Win_1
Thanks for testing FlickerControl - shame it didn't work.
Just as an academic exercise, what is the interval of your Timer? I did a quick example and, with only a label on the form, any value over 35 worked with FlickerControl (example below). However, to get faster speeds than that, I just adjusted how far the label moved left (from 1 to 10 seems to give a smooth scroll, the latter at a comparative iteration of a leftward movement of just a single pixel every 0.0035 of a second; anything over 3 seems to blur - I tested it with speeds of 20 and it seemed flicker free, just too fast to read )
OpenW 1 Ocx Label lbl = "", 100, 100, 400, 20 : .Transparent = True lbl.Text = "This is meant to be scrolling text................" Ocx Timer tmr : .Interval = 35 : .Enabled = True Do : Sleep : Until Win_1 Is Nothing Or Iif(Not IsNothing(tmr), tmr.Enabled = False, False) If Not IsNothing(tmr) Then tmr.Enabled = False
Sub tmr_Timer If lbl.Left > -200 FlickerControl(Win_1, 0) lbl.Left = lbl.Left - 1 // Change this to make faster DoEvents // Added to process any background messages which may produce a flicker effect - can be omitted. FlickerControl(Win_1, 1) Else tmr.Enabled = False EndIf EndSub
Procedure FlickerControl(frm As Form, state%) // v1 // state% : 0 - Suspend Rendering; 1 - Reinstate and Redraw ~SendMessage(frm.hWnd, WM_SETREDRAW, state%, 0) If state% = 1 Then ~RedrawWindow(frm.hWnd, Null, Null, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN) EndProcedure
It's a bit late.. On the older Gfabasic I wrote a program that shifts a image on the screen by floating point values in grayscale. 30 years ago? I never had any idea what im doing in case of rendering an image with bi-linear filtering..
' Initialize screen and input SCREEN 12 CLS INPUT "Enter image width (in pixels): ", imgWidth INPUT "Enter image height (in pixels): ", imgHeight INPUT "Enter horizontal shift (in pixels): ", shiftX INPUT "Enter vertical shift (in pixels): ", shiftY
' Load image data into a 2D array DIM img(imgWidth, imgHeight) AS INTEGER LOAD "image.dat", img
' Create a copy of the image array DIM imgNew(imgWidth, imgHeight) AS INTEGER imgNew() = img()
' Loop through each pixel and shift it by the user-specified amount FOR y = 0 TO imgHeight - 1 FOR x = 0 TO imgWidth - 1 ' Determine the new x and y coordinates, accounting for floating-point shift values newX = x + shiftX newY = y + shiftY x1 = INT(newX) y1 = INT(newY) x2 = x1 + 1 y2 = y1 + 1 f1 = newX - x1 f2 = 1 - f1 g1 = newY - y1 g2 = 1 - g1
' Calculate the blended color of the current pixel based on its surrounding pixels col1 = (img(x1, y1) * f2 + img(x2, y1) * f1) * g2 col2 = (img(x1, y2) * f2 + img(x2, y2) * f1) * g1 imgNew(x, y) = col1 + col2 NEXT x NEXT y
' Display the shifted image PUT (0, 0), imgNew, PSET
' Wait for user input before exiting WHILE INKEY$ = "" WEND
The same in RGB scale
REM Image shifting program with RGB color
REM Define the dimensions of the image DIM SHARED img(255, 255, 3)
REM Load the image LOADBMP "image.bmp", img()
REM Define the shift values DIM SHARED shiftX AS SINGLE DIM SHARED shiftY AS SINGLE
REM Set the shift values shiftX = 0.5 shiftY = 0.5
REM Main program loop WHILE INKEY$ = ""
REM Clear the screen SCREEN 0, 0, 0
REM Shift and redraw the image FOR y = 0 TO UBOUND(img, 2) FOR x = 0 TO UBOUND(img, 1)
REM Calculate the new position of the pixel newX = x + shiftX newY = y + shiftY
REM Calculate the color of the pixel by blending the surrounding colors r = 0 g = 0 b = 0 count = 0
FOR i = -1 TO 1 FOR j = -1 TO 1 pixelX = INT(newX + i) pixelY = INT(newY + j) IF pixelX >= 0 AND pixelX < UBOUND(img, 1) AND pixelY >= 0 AND pixelY < UBOUND(img, 2) THEN r = r + img(pixelX, pixelY, 0) g = g + img(pixelX, pixelY, 1) b = b + img(pixelX, pixelY, 2) count = count + 1 END IF NEXT j NEXT i
REM Calculate the average color of the surrounding pixels IF count > 0 THEN r = r / count g = g / count b = b / count END IF
REM Draw the pixel with the new color PSET (x, y), RGB(r, g, b)
NEXT x NEXT y
REM Update the screen SHOWPAGE
REM Save the modified image SAVEBMP "modified_image.bmp", img()