I know you didn't want to use the raw resize mode of PB, but in case someone else does, check the speed differences in this code:
Code: Select all
OpenWindow(0, 0, 0, 258, 72, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu) 
CreateGadgetList(WindowID(0)) 
  ResX = 1024 
  ResY = 768 
  Factor = 32 
  ScaledX = ResX/Factor 
  ScaledY = ResY/Factor 
  
  CreateImage(0, ScaledX, ScaledY, #PB_Image_DisplayFormat) 
  CreateImage(1, ScaledX, ScaledY, #PB_Image_DisplayFormat) 
  CreateImage(2, ResX, ResY, #PB_Image_DisplayFormat) 
  CreateImage(3, ResX, ResY, #PB_Image_DisplayFormat) 
  
  ; Custom 
  timer = GetTickCount_() 
  StartDrawing(ImageOutput(0)) 
    hDC = CreateDC_("DISPLAY", 0, 0, 0) 
    HalfFactor = Factor/2 
    DrawX = HalfFactor 
    DrawY = DrawX 
    For I = 0 To ScaledX-1 
      For J = 0 To ScaledY-1 
        Plot(I, J, GetPixel_(hDC, DrawX, DrawY)) 
        DrawY + Factor 
      Next 
      DrawY = HalfFactor 
      DrawX + Factor 
    Next 
    DeleteDC_(hDC) 
  StopDrawing() 
  CustomTime = GetTickCount_()-timer 
  
  ; API 
  timer = GetTickCount_() 
  ImghDC = StartDrawing(ImageOutput(1)) 
    hDC = CreateDC_("DISPLAY", 0, 0, 0) 
    ;SetStretchBltMode_(hDC, #HALFTONE) 
    ;SetBrushOrgEx_(hDC, 0, 0, 0) 
    StretchBlt_(ImghDC, 0, 0, ScaledX, ScaledY, hDC, 0, 0, ResX, ResY, #SRCCOPY) 
    DeleteDC_(hDC) 
  StopDrawing() 
  ApiTime = GetTickCount_()-timer 
  
  ; PB raw 
  timer = GetTickCount_() 
  ImghDC = StartDrawing(ImageOutput(2)) 
    hDC = CreateDC_("DISPLAY", 0, 0, 0) 
    BitBlt_(ImghDC, 0, 0, ResX, ResY, hDC, 0, 0, #SRCCOPY) 
    DeleteDC_(hDC) 
  StopDrawing() 
  ResizeImage(2, ScaledX, ScaledY, #PB_Image_Raw) 
  RawTime = GetTickCount_()-timer 
  
  ; PB smooth 
  timer = GetTickCount_() 
  ImghDC = StartDrawing(ImageOutput(3)) 
    hDC = CreateDC_("DISPLAY", 0, 0, 0) 
    BitBlt_(ImghDC, 0, 0, ResX, ResY, hDC, 0, 0, #SRCCOPY) 
    DeleteDC_(hDC) 
  StopDrawing() 
  ResizeImage(3, ScaledX, ScaledY, #PB_Image_Smooth) 
  SmoothTime = GetTickCount_()-timer 
  
  Frame3DGadget(100, 10, 10, 10+32+10, 10+32+10, Str(CustomTime)) 
  ImageGadget(0, 20, 20+(32-24), 32, 24, ImageID(0)) 
  Frame3DGadget(101, GadgetX(100)+GadgetWidth(100)+10, 10, 10+32+10, 10+32+10, Str(ApiTime)) 
  ImageGadget(1, GadgetX(100)+GadgetWidth(100)+20, 20+(32-24), 32, 24, ImageID(1)) 
  Frame3DGadget(102, GadgetX(101)+GadgetWidth(101)+10, 10, 10+32+10, 10+32+10, Str(RawTime)) 
  ImageGadget(2, GadgetX(101)+GadgetWidth(101)+20, 20+(32-24), 32, 24, ImageID(2)) 
  Frame3DGadget(103, GadgetX(102)+GadgetWidth(102)+10, 10, 10+32+10, 10+32+10, Str(SmoothTime)) 
  ImageGadget(3, GadgetX(102)+GadgetWidth(102)+20, 20+(32-24), 32, 24, ImageID(3)) 
  
Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow 
      Break 
  EndSelect 
ForEver