[url]http://www.purebasic.fr/english/viewtop ... 12&t=38606[/url]
In this topic you can find a compression algoryhme, so maybe, you can use it, and slow this as you want (I think this is the simpliest way)
That is soooo over my head
There is no need for point and also no need for a even slower API point.oakvalley wrote: along with the need for point command which in the loop is hard to slow down at least with standard purebasic commands and in which end even using other smart ways of doing the point command in API way
No, there is nothing like that. At least not on windows. The trick is to put a counter in and delay only every 10. or 100. or 1000. or so iteration.oakvalley wrote: still would to be run in a loop where I cannot slow down the loop beyond the minimum of 1 ms during each run. Is there time and space for requesting a nanosecond delay in the next version of Purebasic?
I totally agree with these 2 pointsThorium wrote:There is no need for point and also no need for a even slower API point.
The fast way would be to use DrawingBuffer() to get the pointer to the image data and access it directly.
I agree to this one too. In my code, I have just tryed to design some quick compression algorythme without even doing some research on the web... My point was : to create a code doing the job requested (compresse an image) to make the opportunity to slow this code down.Thorium wrote:The trick is to put a counter in and delay only every 10. or 100. or 1000. or so iteration.
I agree that a use of 2% when the computer is doing nothing, only mean that window allow the code to run faster because IT can.Thorium wrote:But again we speak about 2% CPU load. It's acualy a lot of work for realy nothing what you try to do. That 2% does not mean another process does not have that 2%.
There is nothing wrong with a good challenge.graph100 wrote:I agree that a use of 2% when the computer is doing nothing, only mean that window allow the code to run faster because IT can.Thorium wrote:But again we speak about 2% CPU load. It's acualy a lot of work for realy nothing what you try to do. That 2% does not mean another process does not have that 2%.
But, I also like this challenge, because it's an unusual way of thinkingand it might be fun to code this
Code: Select all
#dist_max = 442
IncludeFile "_librairie_code_saveimageto8bitcolor_netmaestro.pbi"
Procedure DesktopSnapShot(img, coef.l = 6)
Ecran_Largeur = GetSystemMetrics_(#SM_CXSCREEN)
Ecran_Hauteur = GetSystemMetrics_(#SM_CYSCREEN)
DC = GetDC_(0)
CreateImage(img, Ecran_Largeur, Ecran_Hauteur)
Dessin = StartDrawing(ImageOutput(img))
If Dessin
BitBlt_(Dessin, 0, 0, Ecran_Largeur, Ecran_Hauteur, DC, 0, 0, #SRCPAINT | $40000000)
StopDrawing()
EndIf
ReleaseDC_(0, DC)
ResizeImage(img, Ecran_Largeur / coef, Ecran_Hauteur / coef, #PB_Image_Raw)
ProcedureReturn img
EndProcedure
If OpenWindow(0, 0, 0, 500, 500, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ImageGadget(0, 0, 0, WindowWidth(0), WindowHeight(0), 0)
EndIf
snap = 1
DesktopSnapShot(snap)
i = ImageTo8bit(ImageID(snap), 2)
SetGadgetState(0, i)
Save8bitImage(i, "test.bmp")
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
End