What the Heck?

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

What the Heck?

#1 Post by The Artful Dodger »

Hello, all:

I was just doing a bit of programming and I noticed a problem that isn't making any sense. So, I created a new "instrument", with a bare minimum of code, so that it could be demonstrated. First, here is the code:

Code: Select all

PaneCanvas = canvas_add(0, 0, 25, 25)
BoxCanvas = canvas_add(5, 5, 15, 15)
--
	canvas_draw(PaneCanvas, function() 
		_rect(1, 1, 23, 23)
		_stroke("red", 2)
	end)
--
	canvas_draw(BoxCanvas, function()
		_rect(1, 1, 13, 13)
		_stroke("green", 1)
--
		_move_to(3, 4)
		_line_to(9, 4)
		_stroke("blue", 1)
	end)
Then, here is the result:
Line Test.png
Line Test.png (271 Bytes) Viewed 631 times
You will note that the colour of the inner box is not "green" and the line is not "blue". Furthermore, the inner box is not "stroke = 1" nor is the line!

I do not understand - I have been doing this kind of thing for quite a while now but this is a first!

Sparky

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#2 Post by The Artful Dodger »

Well, I can't seem to get the image to show. Maybe I need some OJT!
image.png
image.png (133 Bytes) Viewed 631 times

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#3 Post by The Artful Dodger »

I give up. I cannot make an image appear. Sorry.

Sparky

User avatar
Ralph
Posts: 7916
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: What the Heck?

#4 Post by Ralph »

I have no idea what you see :) But it might be that it is blending.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#5 Post by The Artful Dodger »

Hi, Ralph:
How do I add an image?

User avatar
Ralph
Posts: 7916
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: What the Heck?

#6 Post by Ralph »

Add it as a attachment to your message. You can do this below the text editor.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#7 Post by The Artful Dodger »

What is blending? I'm trying to draw a straight line with _move_to and _line_to! the line I get is wider than I asked for and the color is faded.

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#8 Post by The Artful Dodger »

I'll try again.
Line Test.png
Line Test.png (271 Bytes) Viewed 614 times
But it doesn't work! That's the third time I've tried!

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#9 Post by The Artful Dodger »

I guess it's too small - 25 pixels wide. I'll make it bigger!

The Artful Dodger
Posts: 204
Joined: Sat Jul 09, 2022 3:20 pm

Re: What the Heck?

#10 Post by The Artful Dodger »

Here it is as 200x200.
Line Test.png
Line Test.png (868 Bytes) Viewed 606 times
Her are the problems:
1. The green box is 2 pixels on top and to the left, instead of 1 as in the _stroke command.
2. The colour of the green box is not green, it is quite watered down.
3. The blue line is 2 pixels wide, not 1 as requested.
4. The colour of the blue line is not blue but a watered down blue.
Here's the new lua code:

Code: Select all

PaneCanvas = canvas_add(0, 0, 200, 200)
IALDCanvas = canvas_add(50, 50, 100, 100)
--
	canvas_draw(PaneCanvas, function() 
		_rect(1, 1, 198, 198)
		_stroke("red", 2)
	end)
--
	canvas_draw(IALDCanvas, function()
		_rect(1, 1, 99, 99)
		_stroke("green", 1)
--
		_move_to(10, 10)
		_line_to(25, 10)
		_stroke("blue", 1)
	end)
I don't understand what has happened.

Sparky

Post Reply