3 Replies Latest reply on Jan 3, 2007 6:32 AM by the real POTMO

    merging images

    the real POTMO Level 1
      Hi i have made a margeImages function to merga a transparent image with a box with a dropshadow.

      The problem is that it doesnt work.
      The dropshadow gets all jaggy and gray and ugly.

      Both the iomages to be merges has alpha. DstImg is a 32bit white image with setAlpha(0)
      srcImg is a filled square with a smooth dropshadow.

      Here is the code

      on mergeImages dstImg, srcImg, dstRect, srcRect

      if dstImg.useAlpha or srcImg.usealpha then
      tAlpha = image(dstImg.width, dstImg.height, 8, #greyscale)
      --add the original alpha
      tAlpha.copyPixels(dstImg.extractAlpha(), dstImg.rect, dstImg.rect)
      --add the new alpha
      tAlpha.copyPixels(srcImg.extractAlpha(), dstRect, srcRect, [#ink:39])
      end if

      tImage = image(dstImg.width, dstImg.height, 32)
      --add the original image
      tImage.copyPixels(dstImg, dstImg.rect, dstImg.rect)
      --add the new image
      if not voidp(tAlpha) then
      tImage.copyPixels(srcImg, dstRect, srcRect, [#ink:36])
      tImage.copyPixels(srcImg, dstRect, srcRect)
      end if
      return tImage