realbasic-nug
[Top] [All Lists]

Picture Nil

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Picture Nil
From: Seth Willits <bmxer01 at pacbell dot net>
Date: Sat, 01 Jun 2002 06:30:34 -0700
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.



Seth Willits
---------------------------------------------------------------------------
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com

A one-question geek test. If you get the joke, you're a geek:
Seen on a California license plate on a VW Beetle: "FEATURE"
        -- Definitely A Geek
---------------------------------------------------------------------------
     




<Prev in Thread] Current Thread [Next in Thread>