# Paint Program

### » Thu Jan 01, 2009 7:55 am

thanks
but can there be a method of adding line, square, circle, pen, eraser, bezier curve etc to be added under GRAPHIC category of INSERT OBJECT. because if we have to lern the programmin a lot then its quite difficult and canvas object only appears when we open bank game application. i think the purpose of construct is to help in making application easier. thanks ashlay
B
2
S
1
G
4
Posts: 48
Reputation: 1,296

### » Thu Jan 01, 2009 6:09 pm

No, those features are not objects, they're canvas capabilities, so they would have to go in the canvas object.

What's the formula for cubic interpolation?
Scirra Founder
B
414
S
245
G
92
Posts: 25,207
Reputation: 200,355

### » Thu Jan 01, 2009 6:18 pm

Oops, I had an error in my previous post. Of course, when the number of order rises, the amount of parameters rises too. If I'm not mistaken, it's

[code:1w0nt6ri]lerp(lerp(lerp(a,b,x),lerp(b,c,x),x),lerp(lerp(b,c,x),lerp(c,d,x),x),x)[/code:1w0nt6ri]

And it can be shortened to [code:1w0nt6ri]lerp(qarp(a,b,c,x), quarp(b,c,d,x), x)[/code:1w0nt6ri]

Fortunately cubic curve is the curve of highest order needed in practical computing :D...
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

### » Thu Jan 01, 2009 9:42 pm

[quote="Ashley":1h03x3zc]No, those features are not objects, they're canvas capabilities, so they would have to go in the canvas object.

What's the formula for cubic interpolation?[/quote:1h03x3zc]

well i have it in my game, one sec

this is what i use for x
(((Sprite15.x+((Sprite14.x-Sprite15.x)* ('t')))+(((Sprite14.x+((Sprite.ImagePointX(5)-Sprite14.x)* ('t')))-(Sprite15.x+((Sprite14.x-Sprite15.x)* ('t'))))* ('t')))+((((Sprite14.x+((Sprite.ImagePointX(5)-Sprite14.x)* ('t')))+(((Sprite.ImagePointX(5)+((Sprite.ImagePointX(4)-Sprite.ImagePointX(5))* ('t')))-(Sprite14.x+((Sprite.ImagePointX(5)-Sprite14.x)* ('t'))))* ('t')))-((Sprite15.x+((Sprite14.x-Sprite15.x)* ('t')))+(((Sprite14.x+((Sprite.ImagePointX(5)-Sprite14.x)* ('t')))-(Sprite15.x+((Sprite14.x-Sprite15.x)* ('t'))))* ('t'))))* ('t')))

for y
(((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t')))+((((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))+(((Sprite.ImagePointY(5)+((Sprite.ImagePointY(4)-Sprite.ImagePointY(5))* ('t')))-(Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t'))))* ('t')))-((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t'))))* ('t')))

as you can see, its a B**** to set up, and its very confusing, having a Carp(a,b,c,d,x) would be very usefull, as drasa said, thankfully cubic is the highest order needed.

for a 5 order thing youd need something like

((((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t')))+((((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))+(((Sprite.ImagePointY(5)+((Sprite.ImagePointY(4)-Sprite.ImagePointY(5))* ('t')))-(Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t'))))* ('t')))-((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t'))))* ('t'))))+(((((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t')))+((((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))+(((Sprite.ImagePointY(5)+((Sprite.ImagePointY(4)-Sprite.ImagePointY(5))* ('t')))-(Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t'))))* ('t')))-((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t'))))* ('t'))))-((((((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t')))+((((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))+(((Sprite.ImagePointY(5)+((Sprite.ImagePointY(4)-Sprite.ImagePointY(5))* ('t')))-(Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t'))))* ('t')))-((Sprite15.y+((Sprite14.y-Sprite15.y)* ('t')))+(((Sprite14.y+((Sprite.ImagePointY(5)-Sprite14.y)* ('t')))-(Sprite15.y+((Sprite14.y-Sprite15.y)* ('t'))))* ('t'))))* ('t'))))+)*('t'))

yea, something like that.

the wikipedia article explains it very well
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

### » Thu Jan 01, 2009 9:59 pm

OK, got a cubic expression in the next build!
Scirra Founder
B
414
S
245
G
92
Posts: 25,207
Reputation: 200,355

### » Fri Jan 02, 2009 6:39 am

thanks
hoping to see a paint program template in next release to start with.
B
2
S
1
G
4
Posts: 48
Reputation: 1,296

### » Fri Jan 02, 2009 6:43 am

[quote="hkg.mahwa":vnf3ubiq]thanks
hoping to see a paint program template in next release to start with.[/quote:vnf3ubiq]

I'm not a dev but I think I can safely say this will never happen.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

### » Fri Jan 02, 2009 6:52 am

i am very eager to see it because if you see that Old Paint Example, it even didn't draw a line. but it is useful for open, save and file filter dialogs learning.
B
2
S
1
G
4
Posts: 48
Reputation: 1,296

### » Fri Jan 02, 2009 11:41 am

You should try and do stuff yourself then, start off easy then work up to what you want. We don't aim to provide a template for everything that can be made. If you work with the example and try adding other things to it you should be able to make something work for you.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

### » Tue Jan 06, 2009 7:03 am

B
2
S
1
G
4
Posts: 48
Reputation: 1,296

PreviousNext