Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Want to copy part of an image fully to another part of an image, but write alphas with it.

    Help
    4
    7
    250
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Discostew
      Discostew F last edited by Discostew

      Any idea on how to do this? From what I can tell, the draw functions take alpha into account for how they write pixels. Any pixels with an alpha of 0 simply don't get written, when what I want to do is write all pixels, along with their alpha values. Only function I saw that could possibly do that is copyImage, but that simply makes a new image when I don't want to make a new image, but copy part of an image into a section of another image I designate, alphas and all.

      1 Reply Last reply Reply Quote 0
      • N
        Nisse5 F last edited by

        If the image is set to image_rgba, this should work:

        setDrawTarget(img1)
        clear({0, 0, 0, 0})
        drawImage(img2, 0, 0)
        
        Discostew 1 Reply Last reply Reply Quote 0
        • Discostew
          Discostew F @Nisse5 last edited by

          @Nisse5 said in Want to copy part of an image fully to another part of an image, but write alphas with it.:

          If the image is set to image_rgba, this should work:

          setDrawTarget(img1)
          clear({0, 0, 0, 0})
          drawImage(img2, 0, 0)
          

          But I'm looking to write to a part of an image, leaving the rest intact. Unless clear() can be limited to an area rather than the whole, it would clear the entire image.

          N 1 Reply Last reply Reply Quote 0
          • N
            Nisse5 F @Discostew last edited by Nisse5

            @Discostew In that case, use box() instead of clear(). Haven't tried it but it should work? EDIT: On second though that would probably just paint nothing.

            1 Reply Last reply Reply Quote 0
            • Dave
              Dave Fuze Team last edited by

              I'm not sure if this is the help that you need @Discostew because in truth this isn't something I've had little experience with, but you can use this form of drawImage():

              drawImage( img, {sourceX, sourceY, sourceW, sourceH}, {destX, destY, destW, destH} )
              

              To select a portion of a created image and draw at any scale. I hope this helps, even if a little!

              1 Reply Last reply Reply Quote 0
              • D
                doumdoum F last edited by

                Did you try to modify the drawing mode, with setBlend() ?

                Discostew 1 Reply Last reply Reply Quote 1
                • Discostew
                  Discostew F @doumdoum last edited by

                  @doumdoum Ah, that's it! I never checked it because I thought that worked differently. Thank you!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post