PLUGIN: AGSBlend. AGS Graphic Library - Source Available

Started by Calin Leafshade, Sun 01/08/2010 17:44:21

Previous topic - Next topic

Calin Leafshade

AGSBlend is *designed* for 32-bit sprites with alpha transparency. Since the background doesnt have that then you are essentially doing unnecessary calculations so you should use the built in functions.

Monsieur OUXX

 

Construed

Could this added functionality perhaps enable me to draw one sprite to another at a specified location on the sprite?
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Calin Leafshade


Construed

I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

Any idea why the draw is coming out splintered like this?
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Calin Leafshade

Not without seeing the code.

But remember this only works for *32bit* sprites.

Construed

Ah, ok.

I'll have to start keeping track of the bits :D

Thanks- Jar
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Construed

#28
Sorry for bombing your thread, but i have one last question,
Is it possible to assign the drawing to an entire loop of sprites or just to an entire characters loops?

EDIT:Or perhaps a way to assign it to a large multitude of sprites at once?
I felt sorry for myself because I had no shoes.
Then I met the man with no feet.

Ryan Timothy B

#29
Hey Calin,
First time I'm checking out this plugin. I actually haven't even done anything with it yet, but I'm already curious. Why aren't you using an extender function for DrawAlpha and the other functions or is that not possible with a plugin?

Also, if I create my own dynamicsprite with AGS, will it actually allow me to draw an alpha channeled sprite to that? Since a created sprite will be pure pink. Thanks a bunch.

Calin Leafshade

The plugin API doesnt expose the dynamic sprite struct but i guess you could make it an extender in the header if you really wanted.
Or alternatively you could wrap the function in an extender function if you feel its necessary (I know you know this. it's 1 line of code)

As for creating a new sprite it should work as expected since a new dynamic sprite with an alpha channel will init to 255,0,255,0 so the resulting blends will take the alpha channel into account.

There are a couple of reasons you shouldnt use this plugin anymore though if you are a programming whizz such as yourself.

Firstly it's inefficient. Every time a sprite is drawn the surface is locked and unlocked. For repeated draws this is terribly inefficient. I could have added a "locksprite() and releasesprite()" function but that increases the likelihood of errors for inexperienced scripters so i kept it simple.

Secondly the engine source is open now. You should just edit the drawsprite function in the engine source so you dont have to deal with a plugin for such base functionality.

Thirdly you sacrifice alot of the object orientation with c style functions like this. Ideally (if still using the plugin) you should rewrite it with its own drawing surface object using the Managed Object interface provided by the plugin API.

Ryan Timothy B

Unfortunately I don't know enough about C# (if that's what the engine and editor are created with) to add my own alpha blending abilities.

Although I am tempted, since I really want Character.Speaking to return true whenever the character is talking, regardless whether the character has a speech view set and is animating. But as I said, I don't yet know enough to even look into adding these features for myself.

Knox

Hi Calin,

Ive got this plugin working great and using it a lot. Its awesome!

I was wondering though, how could I make a simple gui background alpha sprite be applied over another gui in "screen" blend mode? Do I have to draw it to a dynamic sprite everytime that GUI is opened, or can I set something somewhere into the properties of the gui.background image directly (somehow). Its so that a sprite of a light-cone is blended over objects underneath it to make it look like its lighting that area.

Its number "8" in the enum eBlendModes.
--All that is necessary for evil to triumph is for good men to do nothing.

Calin Leafshade

Theres no mechanism for one gui being drawn onto another in a different blend mode so you would need to do all your drawing manually onto a *single* dynamic sprite and apply that to a single gui.

However the blending modes are limited due to the fact that they can only be blended with another single sprite and not with the sprites and stuff beneath it in the draw order.

For instance you cant use a gui in screen mode to draw on top of a room background below it.

Monsieur OUXX

 


Calin Leafshade

The plugin has been rendered obsolete by the latest version of AGS.

Except the Blur and Highpass functions maybe.

Crimson Wizard

Quote from: Calin Leafshade on Mon 02/12/2013 20:15:59
The plugin has been rendered obsolete by the latest version of AGS.
Why? 3.3.0 supports only "normal" alpha blending mode, while plugin presents about 20 special effects (Add, Subtract, Burn, etc).

Calin Leafshade

That's true I suppose. I never really considered those useful.

selmiak

Oh they are. Will they be in 3.3.1 or 3.4.0?
Of course they should be appliable to every object/GUI/whatnot seperately and not a gamewide default blending mode in general settings.

SMF spam blocked by CleanTalk