advertisement

Article:
  Bitmap Image Filters
Subject:   handle alpha channel?
Date:   2002-08-09 17:19:22
From:   mikebeam
Response to: handle alpha channel?

That's part of the solution. The other part has to do with the alpha channel occupying the first 8 bits of a pixel, so you have to offset your red, green, and blue indices by 1. So i had something like the following in the inner for-loop:


*p2 = (char)rint((*(p1 + ao) + *(p1 + 1 + ao) + *(p1 + 2 + ao)) / 3);


where ao (alpha offset) is determined at the start of the method as:


int ao = [srcImageRep hasAlpha] ? 1 : 0;


See if that works for you...


Mike


1 to 1 of 1
  1. ah you had given me support by giving me a problem to solve
    2002-08-10 10:16:59  psheldon [View]

    • friend Dan Van Bose in Fort Worth explained syntax
      2002-08-11 14:40:41  psheldon [View]

1 to 1 of 1