| Article: |
Bitmap Image Filters | |
| Subject: | handle alpha channel? | |
| Date: | 2002-08-08 21:12:34 | |
| From: | psheldon | |
|
"p1 = srcData + 3 * (y * w + x);" in IAGrayscaleFilter.m I believe does not as needs n in place of 3, I think.
|
||
Showing messages 1 through 3 of 3.
-
handle alpha channel?
2002-08-09 17:19:22 Michael Beam |
[View]
-
ah you had given me support by giving me a problem to solve
2002-08-10 10:16:59 psheldon [View]
I do need some (easy) problems.
I don't get the syntax on right hand side of :
int ao = [srcImageRep hasAlpha] ? 1 : 0;
supposedly setting a0 to 1.
Are ? and : c operators and is this rhs c syntax?
My c pdf file from an old codewarrior has awful hypertexting. -
friend Dan Van Bose in Fort Worth explained syntax
2002-08-11 14:40:41 psheldon [View]
c = boolean ? a : b
c evaluates to first symbol after ? if boolean true and second expression if false.
So, this sentence commands skipping by an offset if Alpha is there and mixing 3 colors only.
I understand now.



*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