Hot to WindowedScreen AutoStetch sharpen quality? off smooth

Just starting out? Need help? Post your questions and find answers here.
Didaktik
User
User
Posts: 79
Joined: Fri Mar 14, 2014 2:12 pm

Hot to WindowedScreen AutoStetch sharpen quality? off smooth

Post by Didaktik »

My friend create game. This similar ZX Spectrum graphics.
Have screen 256x192. And use AutoStretch to resize screen X2 or X3.
But seems very smooth, not pixel perfect.

Is it possible to do some kind of trick for Windows so that the picture is not blurred?

Image
#NULL
Addict
Addict
Posts: 1497
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Hot to WindowedScreen AutoStetch sharpen quality? off sm

Post by #NULL »

IIRC, i never experienced blurriness with autostrech on Windows, and currently i can't produce any blurriness on Linux. I used that often for x2,x3,x4 scaling.
not shure if this helps :P

...I just tried it. To my surprise drawing on the Screen directly interpolates smoothly, whereas displaying a Sprite interpolates pixelsharp. I never realized that :)
resize the window to test.

Code: Select all

InitSprite()
InitKeyboard()

ww=100
wh=100
sw=ww
sh=wh

win=OpenWindow(#PB_Any, 50,100, ww,wh, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)
OpenWindowedScreen(WindowID(win), 0,0, sw,sh, 1,0,0)

spr = CreateSprite(#PB_Any, 50,50, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr))
	DrawingMode(#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
	For i=0 To OutputWidth() Step 2
		For k=0 To OutputWidth() Step 2
			Box(i,k,1,1, $ff00ff00)
		Next
	Next
StopDrawing()


Repeat
	ExamineKeyboard()
	
	Repeat
		event = WindowEvent()
		Select event
			Case #PB_Event_CloseWindow
				quit = #True
		EndSelect
	Until Not event
	
	StartDrawing(ScreenOutput())
		DrawingMode(#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
		For i=0 To OutputWidth() Step 2
			For k=0 To OutputWidth() Step 2
				Box(i,k,1,1, $ff00ff00)
			Next
		Next
	StopDrawing()
	
	DisplaySprite(spr, 0,0)
	
	FlipBuffers()
	ClearScreen($333333)
Until quit Or KeyboardPushed(#PB_Key_Escape)
<edit>
Some ZX Spectrum stuff might have resources left to just draw on a Sprite first and display that on the screen. That might solve the Problem.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Hot to WindowedScreen AutoStetch sharpen quality? off sm

Post by Lunasole »

#NULL wrote: ...I just tried it. To my surprise drawing on the Screen directly interpolates smoothly, whereas displaying a Sprite interpolates pixelsharp. I never realized that :)
Interesting, I also though it will blur sprite on scale anyway.
Too bad that ResizeSprite() always produces blur


@Didaktik, so you can use solution #NULL posted (which "truly professionally" is called "Render to texture" ^^).
First you draw all the pixels to a sprite (256x192), then you draw sprite on screen with auto-stretch and it's scaled without blur:

Code: Select all

InitSprite()

ww=256
wh=192
sw=ww
sh=wh

win=OpenWindow(#PB_Any, 50,100, ww,wh, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)
OpenWindowedScreen(WindowID(win), 0,0, sw,sh, 1,0,0)

spr = CreateSprite(#PB_Any, 256,192, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr))
DrawingMode(#PB_2DDrawing_Outlined | #PB_2DDrawing_AllChannels)
For i=0 To ww-1
	For k=0 To wh-1
		Plot(i, k, RGBA(Random(255), Random(255), Random(255), 255))
	Next
Next
StopDrawing()

Repeat
	Repeat
		event = WindowEvent()
		Select event
			Case #PB_Event_CloseWindow
				quit = #True
		EndSelect
	Until Not event
	
	ClearScreen($333333)
	DisplaySprite(spr, 0,0)
	FlipBuffers()
Until quit
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Post Reply