on 6/1/02 9:30 AM, Seth Willits at bmxer01 at pacbell dot net wrote:
> I'm placing this in a canvas subclass' open event handler.
>
> /////////
> dim x, y as integer
> dim rs1, rs2 as rgbSurface
>
> Open // allows the instance to set icon
>
>
> rs1 = icon.RGBSurface
> rs2 = icon.mask.RGBSurface
>
> for x = 0 to me.icon.width-1
> for y = 0 to me.icon.height-1
> if rs1.pixel(x,y) = rgb(243, 243, 243) then /// DIES
> rs2.pixel(x,y) = rgb(255, 255, 255)
> else
> rs2.pixel(x,y) = rgb(0, 0, 0)
> end if
> next
> next
> /////////
>
> Whenever run, it trips a NIL on the first access of a pixel. Icon.graphics,
> and Icon.RGBSurface are nil, but Icon is not Nil and I can't figure out why.
>
> Even if I place this code somewhere else the same thing happens.
>
> Any ideas? I must either be missing something extremely obvious or
> something.
Hi, Seth.
Two questions:
1) What does the open-method look like ?
2) Where is the icon-reference stored ?
John
|