ImageLib & Getpixel - bugs or user errors?

LineCutter

Active Member
Licensed User
I must be missing something :sign0085:

I've been playing with the Imagelib - you'll be able to work out why :)

I have 2 questions:
  1. Why does the form1.getpixel value change when I use exactly the same coordinates but from a sub?
  2. Why do i get an error if I change the "false" to "true" in drawer1.new1("Form1", false)?

You'll note that there is a workaround for the first problem in place. Change the if pixel = cBlack then to if form1.getpixel(x,y) = cBlack then to see the difference
 

Erel

Administrator
Staff member
Licensed User
It is better to leave Sub Globals for variables declarations only.
1. The second time you are using GetPixel is after drawing the purple circle.
So the color returned is the small circle color (cPurple).
2. If you want to draw on the forelayer, you need to first create it using:
Form1.ForeLayer = true
 

RandomCoder

Well-Known Member
Licensed User
I too have had similar problems to this with one of my app's. I was finding that the colour of my image (say white for example) was not being detected as cWhite. When I checked the RGB values of cWhite and my white background I found they were different. As a work around I used GetPixel to obtain the RGB value for the background colour and stored this for use later.

Regards,
RandomCoder
 

Cableguy

Expert
Licensed User
Funny...
There are at least two color constatnt that should always be the same in whatever platform is used...cwhite=rgb(255,255,255);cblack=rgb(0,0,0)
 

LineCutter

Active Member
Licensed User
It is better to leave Sub Globals for variables declarations only.
Agreed, they got moved there as part of the bug tracking attempt.
1. The second time you are using GetPixel is after drawing the purple circle.
So the color returned is the small circle color (cPurple).
:sign0161:
2. If you want to draw on the forelayer, you need to first create it using:
Form1.ForeLayer = true
I knew I had to have missed something.

That makes the score Erel 4, Linecutter 0.
 
Top