Author Topic: Need a cheaper way to do clearcolor  (Read 7625 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Need a cheaper way to do clearcolor
« Reply #30 on: June 30, 2021, 02:49:26 am »
The other way to remove grey scale is with alpha channel.

What ELSE?   no ELSE!

Code: QB64: [Select]
  1. 'DIM C AS LONG
  2. DIM hSCREEN AS LONG
  3. DIM hSHIP AS LONG
  4.  
  5. hSCREEN = _NEWIMAGE(1280, 768, 32)
  6. SCREEN hSCREEN
  7.  
  8. hSHIP = _LOADIMAGE("lship.png", 32)
  9.  
  10. _SOURCE hSHIP
  11.  
  12. FOR Y = 0 TO _HEIGHT(hSHIP) - 1
  13.     FOR X = 0 TO _WIDTH(hSHIP) - 1
  14.         C = POINT(X, Y)
  15.  
  16.         IF _ALPHA32(C) = 0 THEN
  17.             C = _RGB(255, 0, 0)
  18.             PSET (X, Y), C
  19.         END IF
  20.  
  21.         IF _ALPHA32(C) <> 0 THEN
  22.             PSET (X, Y), C
  23.         END IF
  24.  
  25.     NEXT X
  26.  
  27.  
  28.  
 
« Last Edit: June 30, 2021, 03:10:53 am by NOVARSEG »