Author Topic: Is there a _SCREENIMAGE method for Linux/Mac?  (Read 2360 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Is there a _SCREENIMAGE method for Linux/Mac?
« on: February 22, 2021, 11:17:47 am »
Was wondering if there's a way to grab desktop image under Linux and Mac, like _SCREENIMAGE works under Windows.   As example, here's a screensaver thing that uses _SCREENIMAGE.  Works in Windows, but how would I do this under Linux or Mac?  If there's a way, I could add it to my code before posting it here.

Thanks.

- Dav


Code: QB64: [Select]
  1.  
  2. 'DesktopWriter.bas
  3. 'Coded by Dav, FEB/2021
  4.  
  5. back& = _SCREENIMAGE
  6.  
  7. _SCREENMOVE -3, -30
  8. _PUTIMAGE (0, 0), back&
  9.  
  10.  
  11. x% = RND * _WIDTH: y% = _HEIGHT
  12. r& = RND * 155 + 100
  13. g& = RND * 155 + 100
  14. b& = RND * 155 + 100
  15.  
  16.  
  17.     c% = INT(RND * 2) - 1
  18.     IF c% = 0 THEN c% = 1
  19.     IF (INT(RND * 2) + 1) = 1 THEN
  20.         x% = x% + c%
  21.     ELSE
  22.         y% = y% + c%
  23.     END IF
  24.  
  25.     ball x%, y%, 30, RND * r&, RND * g&, RND * b&, RND * 1
  26.  
  27.     IF x% > _WIDTH OR x% < 0 OR y% > _HEIGHT OR y% < 0 THEN
  28.         x% = RND * _WIDTH: y% = RND * _HEIGHT
  29.         r& = RND * 155 + 100: g& = RND * 155 + 100: b& = RND * 155 + 100
  30.     END IF
  31.  
  32.  
  33.  
  34.  
  35. SUB ball (BallX, BallY, size, r&, g&, b&, a&)
  36.     FOR s = 1 TO size STEP 2
  37.         CIRCLE (BallX, BallY), s, _RGBA(r&, g&, b&, a&)
  38.         IF r& > 0 THEN r& = r& - 2
  39.         IF g& > 0 THEN g& = g& - 2
  40.         IF b& > 0 THEN b& = b& - 2
  41.     NEXT
  42.  
« Last Edit: February 22, 2021, 11:21:16 am by Dav »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Is there a _SCREENIMAGE method for Linux/Mac?
« Reply #1 on: February 22, 2021, 11:24:17 am »
Maybe Pipecom a command to Linux to take a picture | or >>  filename, then _loadimage that file?