[Win x64] v6.02 / v6.03b9 - Image resize issue

Post bugreports for the Windows version here
pjay
Enthusiast
Enthusiast
Posts: 251
Joined: Thu Mar 30, 2006 11:14 am

[Win x64] v6.02 / v6.03b9 - Image resize issue

Post by pjay »

ResizeImage() on 24 bit images are ignoring the #PB_Image_Smooth flag.

Oddly though, if you uncomment the 'Drawingfont()' line, the ResizeImage() behaves as expected.

Code: Select all

;- example to demonstrate potential bug with ResizeImage().
EnableExplicit
Procedure ExampleImage(img,w,h,txt.s, bits)
  CreateImage(img,w,h,bits)
  StartDrawing(ImageOutput(img))
  Box(0,0,OutputWidth(),OutputHeight(),#White)
  DrawingMode(#PB_2DDrawing_Transparent)
  Circle(w/2,h/2,h*0.45,255)
  ;DrawingFont(FontID(0))
  DrawText(2,40,Txt,#Black,#White)
  DrawText(2,60,"("+Str(bits)+" bit)",#Black,#White)
  StopDrawing()
EndProcedure
OpenWindow(0,0,0,640*2,960,"Image resizing test",#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
LoadFont(0,"Arial",8)
ExampleImage(0,160,120,"Smooth",24) : ResizeImage(0,640,480,#PB_Image_Smooth)
ExampleImage(1,160,120,"Smooth",32) : ResizeImage(1,640,480,#PB_Image_Smooth)
ExampleImage(2,160,120,"Resize during draw",24)
ExampleImage(3,160,120,"Resize during draw",32)

CanvasGadget(0,0,0,640*3,960)
StartDrawing(CanvasOutput(0))
  DrawImage(ImageID(0),0,0)
  DrawImage(ImageID(1),640,0)
  DrawImage(ImageID(2),0,480,640,480)
  DrawImage(ImageID(3),640,480,640,480)
StopDrawing()

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

pjay
Enthusiast
Enthusiast
Posts: 251
Joined: Thu Mar 30, 2006 11:14 am

Re: [Win x64] v6.02 / v6.03b9 - Image resize issue

Post by pjay »

Along the same lines, this behaviour is being seen on scaling directly with DrawImage().

The example below shows (on my PC at least) that the image is scaled randomly with either #PB_Image_Smooth or #PB_Image_Raw

Code: Select all

Enumeration ;/ windows / image / gadget
  #MyWindow_Main
  #MyImage_Main = 0
  #MyGad_Canvas
EndEnumeration

Width = 320 : Height = 240
OpenWindow(#MyWindow_Main,0,0,Width,Height,"Image scaling: Sometimes smooth, sometimes raw",#PB_Window_SystemMenu|#PB_Window_BorderLess|#PB_Window_Maximize|#PB_Window_MaximizeGadget)
CanvasGadget(#MyGad_Canvas,0,0,WindowWidth(#MyWindow_Main),WindowHeight(#MyWindow_Main))
CreateImage(#MyImage_Main,Width,Height)
AddWindowTimer(#MyWindow_Main,0,350)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_Timer
      StartVectorDrawing(ImageVectorOutput(#MyImage_Main))
      VectorSourceColor(RGBA(10,30,60,255)) : FillVectorOutput()
      VectorSourceColor(RGBA(50,180,198,255))
      Rotation.f = ElapsedMilliseconds() / 4000.0
      AddPathCircle((Width * 0.5) + (Width * 0.1) * Cos(Rotation),(height * 0.5) + (height * 0.1) * Sin(Rotation),height * 0.1) : FillPath()
      StopVectorDrawing()
      
      StartDrawing(CanvasOutput(#MyGad_Canvas))
      DrawImage(ImageID(#MyImage_Main),0,0,OutputWidth(), OutputHeight())
      StopDrawing()
    Case #PB_Event_CloseWindow : End
  EndSelect
ForEver

Fred
Administrator
Administrator
Posts: 18199
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Win x64] v6.02 / v6.03b9 - Image resize issue

Post by Fred »

I can see the bug but I can't find the issue as we are just using StretchBlt() which should always work... If someone gets a good idea :idea:
Post Reply