Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
borre Canvas cuando use globalCompositeOperation = 'source-in'

Estoy dibujando una cara en un lienzo con una máscara. la cara aparece solo donde la máscara está llena.

 function drawface(){ this.ctx.globalCompositeOperation = 'source-in'; this.ctx.drawImage(msk, 0, 0, msk_w, msk_w, x, marg, h_c, h_c ); this.ctx.drawImage(this.face, 0, 0, w_f, h_f, x+x_offset, marg+y_offset, h_c, h_c);}

funciona bien, pero quiero mover la cara al arrastrar. Entonces necesito restablecer el lienzo, luego volver a dibujar la cara. Pero cuando lo hago

 function resetCanvas(){ this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height); }

Obtengo un lienzo en blanco y la función drawface ya no funciona después de llamar a resetCanvas. Intenté guardar y restablecer también, pero no pude encontrar una solución que funcionara. ¿Alguien puede ayudar por favor? Gracias !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Necesario para restablecer globalCompositeOperation después de dibujar la cara.

 this.ctx.globalCompositeOperation = 'source-over';
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!