advertisement

Article:
  Bitmap Image Filters
Subject:   Final code problem
Date:   2002-08-09 22:25:38
From:   johnts
In the final filterImage: code, there's a slight problem. At the top there are the declarations:
int w = [srcImageRep pixelsWide];
int h = [srcImageRep pixelsHigh];


But below in the for() loops, it's using 'height' and 'width'.

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Final code problem
    2002-08-10 21:52:55  johnts [Reply | View]

    The final projects also has some warnings that can be very easily fixed. (I remember the warnings were around in the last version too):

    IAWindowController.m needs:

    #import "MyDocument.h"

    and in IAWindowController.h this needs to be added:

    - (void)setImageToDraw:(NSImage *)image;
    • warnings can mean runtime errors later
      2002-08-11 07:37:02  psheldon [Reply | View]

      ie. that the compiler tried to guess what you meant which might not be correct during execution.

      These warnings don't show up on a second compile (after a clean).

      So, one should do a clean before a candidate final compile to catch them all if you want to be safe.
  • I see why I and Mike didn't see
    2002-08-10 10:25:16  psheldon [Reply | View]

    The original partially filled out for loops did have w and h. Later loops didn't in the for lines controlling inside of the loops, the loop bodies, which did have w and h.

    I only changed the inside of the loops not bothering to look at or paste the outside of the loop, so we only glanced at the for control lines for human, not computer, meaning.

    I hope the above analysis of the mistake is useful.

    Cool you caught that.