Message Board


Message Board > Fenix / Bennu / Gemix / DIV > blendop

February 6, 2006, 12:20
Tovi
I love you!
75 posts

Could someone explain to me how blendop is supposed to work? Or give me an example or something. I have a feeling it's supposed to do what lightFX.dll used to do for Div, but I haven't been able to get it to work yet.

I make a new blendop with blendop_new, and I try to apply different kinds of blends to graphics, but it doesn't seem to make any difference at all.

Flamingbird was some help, but since I don't see any difference, I must be doing something wrong.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
February 6, 2006, 12:33
Woody
HEAD BLACK MAN
722 posts

I've never used blendop, but I think you can use the local variable alpha for awesome transparency.
____________
boredome is the bitter fruit of too much routine
#
February 6, 2006, 13:59
Tovi
I love you!
75 posts

That is pretty cool, but it's not exactly what I had in mind. I really liked how LightFX could "blend" two graphics together.

But I'm glad I found this alpha... Especially since it's a local variable. Could come in real handy.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
February 6, 2006, 14:40
Sandman
F3n!x0r
1194 posts

BANG:
Code:
my_map = load_png("...");
my_blndop = blendop_new();
blendop_tint(my_blndop,0.5,0,0,255);
blendop_assign(0,my_map,my_blndop);
blendop_translucency(my_blndop,0.5);

For a lovely blue tint and half transparency. You can do assign before, after and even in between!

blendop_apply() can only operate at 16bit and only has effects after the effect commands (like blendop_tint()). blendop_apply() applies the blendop data only once, when called, and unlike blendop_assign(), will it not automatically update graphs.
Consider these pieces of code:
1
Code:
blendop_tint(my_blndop,0.5,0,0,255);
blendop_apply(0,my_map,my_blndop);
blendop_tint(my_blndop,0.5,0,255,0);
blendop_apply(0,my_map,my_blndop);

2
Code:
blendop_tint(my_blndop,0.5,0,0,255);
blendop_tint(my_blndop,0.5,0,255,0);
blendop_apply(0,my_map,my_blndop);

3
Code:
blendop_tint(my_blndop,0.5,0,255,255);
blendop_apply(0,my_map,my_blndop);

They all produce different colors.

When you're done:
Code:
blendop_free(my_blndop);


This is really nifty:
Code:
blendop_tint(my_blndop,0.5,255,0,0);
blendop_swap(my_blndop);

What it does:
- it makes the graph (where this blendop is assigned to) totally empty
- everything /under/ (higher z value in the process) will have the effects you put in the blendop. In the example it will make everything red-ish.

Now there are some more commands, but you'll figure out those on your own I think. ;)
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
February 6, 2006, 14:49
Rincewind
programmer
1545 posts

I once made a small example of a way of using blendops to change colortints of graphics, it was written with lame dutch variable-names for somebody to make it easier to understand, but you will handle it. ;) Download it here!

Edit: oh fuck Sandman posted something better earlier. :P

[Edited on February 6, 2006 by Rincewind]
____________
Personal website: http://www.loijson.com
#
February 6, 2006, 15:32
Fiona
games are terrible
-9616558 posts

I've used the blendop stuff once because I couldn't be arsed to make another graphic that was tinted blue.
But you end up having to do more work when using blendop, so it' pretty crap.
____________
laffo
#
February 6, 2006, 18:02
Deadmaster
Where is Johnny?
458 posts
Wait, I think you can do what lightFX did using flags=16... :S
____________
My site still needs updating and redesigning. My last.fm page.

GO TO TEXTUAL ANARCHY II YOU FISHDOG YOU
#
February 7, 2006, 09:28
Momia que fuma
None
6 posts

(Well, lets go with my crappy english XD)

With blendops you can do pretty good things...

Since fenix 0.84 you dont necesarily need to use blendop_assign or blendop_apply, there is a local called blendop which indicates the process wich blendop to use, so you can use blendops whitout really modify the fpg (so you can use the fpg whit blendop and whitout it whit no need to load it twice)

Although, if you use the blendop local, alpha, flags=16, flags=32 ando some other effects will not work...in that case you must use blendop_apply...

Here i have a little demo using blendops:

Here

Cool looking uh? :D

With flags=16 (adittive blit) you can do pretty cool things too...

EDIT: The demo is with no dll or exes, use fenix 0.84a :P

[Edited on February 7, 2006 by Momia que fuma]
____________
Hey, how crappy is my english? Im spanish and all of your bases are belong to me!
#
February 7, 2006, 12:03
Tovi
I love you!
75 posts

Oh, I think I get it now...

I was running Kensuo in 8bit mode, and it seems blendops don't work in 8bits...

Nice example btw, Momia que fuma.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
February 7, 2006, 12:26
Fiona
games are terrible
-9616558 posts

Now that I didn't know, such a shame that 0.84 is a piece of crap.
____________
laffo
#
February 7, 2006, 12:56
Momia que fuma
None
6 posts

Quoting Ferret:
such a shame that 0.84 is a piece of crap.


Why? Sure, it has some nasty bugs (i.e. you must declare a first local that you wont use, because the first local declared gets buggy) but i think that 0.84 is pretty nice and improves 0.83 in many aspects (at last, partial restore and dump, improving performance)

Furthermore you have 0.84b (bugs concerning floats) and the no-official-CVS-compiled 0.84c (float bugs fixed)

[Edited on February 7, 2006 by Momia que fuma]
____________
Hey, how crappy is my english? Im spanish and all of your bases are belong to me!
#
February 7, 2006, 14:00
Fiona
games are terrible
-9616558 posts

The bugs are just crippling. It got to a point where 0.84 would actually do different things on different computers.
The only thing which I would find useful is glob(), of which Retep wrote a dll for 0.83 anyway.
____________
laffo
#
February 7, 2006, 15:26
Tovi
I love you!
75 posts

Ok, so I tried flags=16, and that's exactly what I needed, so I decided to stop messing around with blendops. :p

Someone should document this somewhere in english. Flamingbird only explained the first 7 flags. So now I know flags=16 is additive blending, and flags=32 is subtractive blending (I think). Oh, and it works in 8bits too, so yay.
____________
Zombie Robot Ninja Pirate Battlefield Extreme!!!
#
February 7, 2006, 19:01
Eckolin
Quite Whiskered
388 posts

First three flags.

So the flags for fenix are:
1: Horizontal mirror
2: Vertical mirror
4: 50% transparency
8: ?
16: additive blending
32: substractive blending (?)
64: ?
128: untransparent blackness (?)

(?) I'm not sure about, needs testing.

[Edited on February 7, 2006 by Eckolin]
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
April 1, 2006, 15:52
Rhovanion
Exterminated
666 posts
Say, if Fenix is 16-bit, how is it possible it uses an alpha channel on graphics? it has 65000 (estimated) colors, so you'll need another 8 bit for the alpha channel... or am I totally wrong here? :s
____________
#
April 1, 2006, 16:19
Rincewind
programmer
1545 posts

With 16-bit images there's a single alpha 'color' you can use, With 32-bit images there's an optional 0-255 alpha value available per pixel.
____________
Personal website: http://www.loijson.com
#
April 1, 2006, 16:58
Sandman
F3n!x0r
1194 posts

Actually Fenix is 15bit, I believe.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
June 3, 2006, 19:56
Sandman
F3n!x0r
1194 posts

So I'm trying blendops in 8bit mode, but they don't seem to work. When I change to 16bit mode, they do work. Any thoughts on that?
I'm using 0.84a, tried both apply and assign, tried 8bits and 16bits graphs, it all comes down to that it doesn't work. If that is so, it sucks, if it's my fault, it sucks less.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
June 4, 2006, 23:26
Fiona
games are terrible
-9616558 posts

Quoting Tovi:
Oh, I think I get it now...

I was running Kensuo in 8bit mode, and it seems blendops don't work in 8bits...

Nice example btw, Momia que fuma.


Whereas flags=16 works.
____________
laffo
#
June 5, 2006, 01:35
Sandman
F3n!x0r
1194 posts

Oh I overlooked that.
Yes I know flags=16 works, but that's not what I want.
I made an rgbscale() for 8bit graphs, so now I am happy.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#

Message Board > Fenix / Bennu / Gemix / DIV > blendop

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!