Können Sie semi-transparente Pixel undurchsichtig machen, ohne ihre Koordnungen zu kennen?JavaScript

Javascript-Forum
Anonymous
 Können Sie semi-transparente Pixel undurchsichtig machen, ohne ihre Koordnungen zu kennen?

Post by Anonymous »

Mein Ziel ist es, jedes Pixel mit zu drehen alpha> 0 , um alpha = 1 zu haben. src = "https://i.static.net/65wiyswb.png"/>
und ich zeichne ein Weiß (weiß (weiß

Code: Select all

#fff
) Square drauf:

#f003):

An diesem Punkt können Sie an diesem Punkt, ohne das Bild zu erkennen, ohne das Bild zu erhalten, ohne das zweite SHEENSHOT (alles weiß zu wissen). /> Hier ist der HTML-Beispielcode: < /p>

Code: Select all




test


canvas {
background:
linear-gradient(217deg, rgba(255, 0, 0, 0.8), rgba(255, 0, 0, 0) 70.71%),
linear-gradient(127deg, rgba(0, 255, 0, 0.8), rgba(0, 255, 0, 0) 70.71%),
linear-gradient(336deg, rgba(0, 0, 255, 0.8), rgba(0, 0, 255, 0) 70.71%);
}

body {
background: #111;
}






const canvas = document.querySelector("canvas")
const ctx = canvas.getContext('2d')

// Screenshot 1 taken at this point

ctx.fillStyle = '#fff'
ctx.fillRect(10, 10, 100, 100)

// Screenshot 2 taken at this point

ctx.globalCompositeOperation = 'source-in'
ctx.fillStyle = '#f003'
ctx.fillRect(0, 0, 320, 180)

// Screenshot 3 taken at this point

// now what ???





Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post