Author Topic: _SCREENIMAGE Fuzzy [solved]  (Read 1860 times)

0 Members and 1 Guest are viewing this topic.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
_SCREENIMAGE Fuzzy [solved]
« on: May 02, 2020, 10:14:42 pm »
I found some funky behavior with _SCREENIMAGE. If the width of a screen shot exceeds 1024 (0 - 1023) the image always comes out fuzzy as though it is being resized.

Desktop& = _SCREENIMAGE(0, 0, 1023, 600) ' not fuzzy

Desktop& = _SCREENIMAGE(0, 0, 1024, 600) ' fuzzy (anything over 1023)

Desktop& = _SCREENIMAGE ' fuzzy if over 1024 wide

Bug perhaps?
« Last Edit: May 03, 2020, 10:38:54 pm by TerryRitchie »
In order to understand recursion, one must first understand recursion.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #1 on: May 02, 2020, 10:24:04 pm »
Fuzzy? Trouble with tribbles, perhaps?
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #2 on: May 02, 2020, 10:53:01 pm »
I found some funky behavior with _SCREENIMAGE. If the width of a screen shot exceeds 1024 (0 - 1023) the image always comes out fuzzy as though it is being resized.

Desktop& = _SCREENIMAGE(0, 0, 1023, 600) ' not fuzzy

Desktop& = _SCREENIMAGE(0, 0, 1024, 600) ' fuzzy (anything over 1023)

Desktop& = _SCREENIMAGE ' fuzzy if over 1024 wide

Bug perhaps?

Into what container are you viewing the image?

This demo from Wiki runs fine:
Code: QB64: [Select]
  1. desktop& = _SCREENIMAGE
  2. MaxScreenX& = _WIDTH(desktop&)
  3. MaxScreenY& = _HEIGHT(desktop&)
  4. '_FREEIMAGE desktop& 'free image after measuring screen(it is not displayed)
  5. SCREEN _NEWIMAGE(MaxScreenX&, MaxScreenY&, 32) 'program window is sized to fit changed to 32 from 256
  6.  
  7. _PUTIMAGE , desktop&, 0  '<<<  I added this
  8.  
  9.  
« Last Edit: May 02, 2020, 10:55:24 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #3 on: May 02, 2020, 11:27:24 pm »
Here's another test (over 1024):

Code: QB64: [Select]
  1. desktop& = _SCREENIMAGE
  2. MaxScreenX& = _WIDTH(desktop&)
  3. MaxScreenY& = _HEIGHT(desktop&)
  4. _FREEIMAGE desktop& 'free image after measuring screen(it is not displayed)
  5.  
  6. partialDesk& = _SCREENIMAGE(200, 0, MaxScreenX&, MaxScreenY& - 30)
  7. SCREEN _NEWIMAGE(MaxScreenX& - 200, MaxScreenY& - 30, 32) 'program window is sized to fit changed to 32 from 256
  8. _DELAY .25
  9. _SCREENMOVE 200, 40
  10. FOR i = 1 TO 1000
  11.     PRINT MaxScreenX& - 200; " X "; MaxScreenY& - 30,
  12. _DELAY .25
  13. partialDesk& = _SCREENIMAGE(200, 0, MaxScreenX&, MaxScreenY& - 30)
  14. _PUTIMAGE , partialDesk&, 0 '<<<  I added this
  15.  
  16.  


FellippeHeitor

  • Guest
Re: _SCREENIMAGE Fuzzy
« Reply #4 on: May 02, 2020, 11:41:49 pm »
I get the same only when I run in a VM.

Even screen 0 goes blurry if wider than a certain number of columns, since it's an OpenGL graphical window in the end.

When I run on the Mac, any size goes well.

Likely boils down to a graphics card issue.

PS: I do most of my coding in said VM, which runs XP. I can never run a bplus demo without editing the source first, since all his demos go beyond my blur point.

PS2: reread the thread and noticed it's screenimage; mine gets blurry with newimage. Too late to post anything, to bed I go.
« Last Edit: May 02, 2020, 11:46:59 pm by FellippeHeitor »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #5 on: May 03, 2020, 12:19:37 am »
That was it Fell. I'm running everything in a Win10 VM so the tutorial has Win10 screen shots (I run Windows 7 on my computer).

I should have checked for that. It's strange behavior. From now on when I run across something "strange" I'll be sure to test it outside the VM first.
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #6 on: May 03, 2020, 10:50:21 am »
Quote
I can never run a bplus demo without editing the source first, since all his demos go beyond my blur point.

@FellippeHeitor,  Is this because image width is past 1024?

FellippeHeitor

  • Guest
Re: _SCREENIMAGE Fuzzy
« Reply #7 on: May 03, 2020, 10:50:58 am »
Yeah :-)

FellippeHeitor

  • Guest
Re: _SCREENIMAGE Fuzzy
« Reply #8 on: May 03, 2020, 10:51:39 am »
Actually, let me see what my blur point is; it might differ from Terry's.

I remember it had to do with powers of 2 indeed. Give me a minute.

FellippeHeitor

  • Guest
Re: _SCREENIMAGE Fuzzy
« Reply #9 on: May 03, 2020, 11:01:26 am »
Mine goes without blur up until 1024. It's at 1025 that the blur begins.

Might be too subtle to notice. It's actually an extreme antialiasing that gets applied after that stretch point, which not only makes it look terrible but also slows down execution/framerate greatly.

Again, only on the Windows VM. The Linux VM, same VirtualBox installation, renders large windows fine. It's Windows that doesn't play well with the graphics card virtualization here.

  [ You are not allowed to view this attachment ]  

  [ You are not allowed to view this attachment ]  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #10 on: May 03, 2020, 12:05:35 pm »
Hi @FellippeHeitor

OK so now I am wondering about screen height, also a 2^n, maybe 512?

But that would mean 800 x 600 is no good either.
« Last Edit: May 03, 2020, 12:07:58 pm by bplus »

FellippeHeitor

  • Guest
Re: _SCREENIMAGE Fuzzy
« Reply #11 on: May 03, 2020, 12:08:08 pm »
No issues with screen height.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: _SCREENIMAGE Fuzzy
« Reply #12 on: May 03, 2020, 03:10:39 pm »
No issues with screen height.

Same here, never had a problem with height, only width.
In order to understand recursion, one must first understand recursion.