Page 2 of 3

Posted: Fri Jun 23, 2006 10:53 pm
by Fred
I think it's a good approach to have a flexible fast image manipulation. It could be added natively to PB in a future version.

Posted: Sat Jun 24, 2006 1:22 am
by nco2k
sounds good. :P

ImageOutput() = ~200ms
FastImageOutput() = 0-15ms

c ya,
nco2k

Posted: Sun Jun 25, 2006 7:21 pm
by Joakim Christiansen
Illegal memory access...
I testet it with remi_meier's "The beauty of z^2 + c" trick...
http://www.purebasic.fr/english/viewtopic.php?t=22446

Posted: Mon Jun 26, 2006 8:47 am
by S.M.
Illegal memory access...
I testet it with remi_meier's "The beauty of z^2 + c" trick...
http://www.purebasic.fr/english/viewtopic.php?t=22446
Thanks :D , I corrected the code above.
Now FastImageOutput() returns zero if a device dependent bitmap (bitmap created with #PB_Image_DisplayFormat) is used.
To get the code working, just replace:

Code: Select all

img = CreateImage(#PB_Any, #S, #S)
with:

Code: Select all

img = CreateImage(#PB_Any, #S, #S,32)
Now it should work.

@all
Thanks for the nice feedback!

Posted: Thu Jul 13, 2006 2:33 pm
by GeoTrail
It says 0 ms on my machine. Is that possible?

Posted: Thu Jul 13, 2006 2:41 pm
by netmaestro
It will say 0 ms if you aren't using a high-enough-res method of timing. ElapsedMilliseconds() is only good to a resolution of 15 ms or so, and if the operation you're timing finishes faster than that the ElapsedMilliseconds() value will not have changed. Hence the 0 ms. You can get 1ms accuracy easily with:

Code: Select all

timeBeginPeriod_(1)
start = timeGetTime_()
  ; timed operation
ending = timeGetTime_()
or look to QueryPerformanceFrequency_() for microsecond accuracy (you shouldn't need this much)

IIRC, when I tested this FastImageOutput() I had to drop to a lower-res method as well to avoid getting 0 ms for a result. I think I posted the method if you look a few posts back in this thread.

Posted: Thu Jul 13, 2006 3:12 pm
by GeoTrail
That seemed to work, I'm getting 15 ms now.
But if I run it two or three times after each other then I sometimes get 0 ms and then back to 15 again.

Re: FastImageOutput

Posted: Sat Sep 15, 2007 1:52 pm
by PB
This code no longer works with v4.10 B3, and I don't know how to fix it.
Changing to "img = CreateImage(#PB_Any, #S, #S,32)" doesn't help as
it doesn't exist in the original code snippet.

Posted: Sat Sep 15, 2007 2:01 pm
by DoubleDutch
Maybe it's now native? Fred?

Posted: Wed Nov 28, 2007 6:23 pm
by IceSoft
Fred wrote:I think it's a good approach to have a flexible fast image manipulation. It could be added natively to PB in a future version.
@Fred,
Maybe together with the 'DirectX9' Version of PB?

Posted: Wed Nov 28, 2007 9:11 pm
by Psychophanta
Native or not, the tip should work!?
And it doesn't for 4.10 version

Posted: Thu Nov 29, 2007 1:30 am
by Mistrel
Is this faster than drawing on a window with WindowOutput()?

Re: FastImageOutput

Posted: Tue Sep 15, 2009 10:44 am
by dige
Since PB4.40 drawing on Gadgets with StartDrawing(GadgetOutput(GadgetID.i))
does not work anymore.
May be the Structure has changed?

Code: Select all

Structure DrawingInfoStruct
  Type.l
  Window.l
  DC.l
  ReleaseProcedure.l
  PixelBuffer.l
  Pitch.l
  Width.l
  Height.l
  Depth.l
  PixelFormat.l
  StopDirectAccess.l
  StartDirectAccess.l
EndStructure

Global FastImgOutputID.DrawingInfoStruct

Procedure ReleaseGadgetOutput()
  ReleaseDC_(FastImgOutputID\Window, FastImgOutputID\DC)
EndProcedure

Procedure GadgetOutput(GadgetID) ; returns the outputID for the declared window handle
  hwnd = GadgetID(GadgetID)
  FastImgOutputID\Type=2
  FastImgOutputID\Window=hwnd
  FastImgOutputID\DC=GetDC_(hwnd)
  FastImgOutputID\ReleaseProcedure=@ReleaseGadgetOutput()
  ProcedureReturn FastImgOutputID
EndProcedure 

Re: FastImageOutput

Posted: Mon Jul 26, 2010 6:31 am
by Michael Vogel
Any news about FastImageOutput for PB4.50?

Re: FastImageOutput

Posted: Mon Jul 26, 2010 9:49 am
by Fred
It shouldn't have much difference since 4.40.