On 6/1/02 9:30 AM, "Seth Willits" <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.
1) Are you sure Icon.Graphics is nil?
and 2) What I just responded off-list with, is to try making a new 32bit
picture and copying icon into it, then using the new picture instead of
icon.
--
Kevin Ballard
kevin at sb dot org
Email from Korea or China must go to <kevin dot nb at sb dot org>
http://kevin.sb.org/
|