Bitmap tinting

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Is there a script that I can use that will allow me to change the tint of a bitmap?


For example, say I want to make an image redder or darker.


This is typically accomplished by manipulating pixel colors, so if I wanted to make an image redder (to simulate a sunset type of effect, sort of), I would just add more red to each pixel.


I'm basically going to be providing an add-on that allows users to create map shots with the "screen tint" options applied.
 
Last edited by a moderator:

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
310
First Language
English
Primarily Uses
I don't think there is a script for this, other than maybe Copern's Color Functions via his dll..but perhaps you've already figured out your own dilemma my friend :p


Manipulating a Bitmap is essentially manipulating the pixels underneath the structure; unfortunately in Ruby this is slower, but still possible. You can try your hand at writing a dll to make the function considerably faster, or just brute force it out with (get / set)_pixel.


Perhaps you could create a bitmap the size of the map and then use fill_rect with the tint color, and blt the bitmap onto the one you are saving? I -think- that would be faster than iterating through each pixel, but idk...and I'm not sure exactly how accurate that is when compared to the each_pixel method.
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,203
First Language
Binary
Primarily Uses
RMMZ
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I don't think there is a script for this, other than maybe Copern's Color Functions via his dll..but perhaps you've already figured out your own dilemma my friend :p


Manipulating a Bitmap is essentially manipulating the pixels underneath the structure; unfortunately in Ruby this is slower, but still possible. You can try your hand at writing a dll to make the function considerably faster, or just brute force it out with (get / set)_pixel.


Perhaps you could create a bitmap the size of the map and then use fill_rect with the tint color, and blt the bitmap onto the one you are saving? I -think- that would be faster than iterating through each pixel, but idk...and I'm not sure exactly how accurate that is when compared to the each_pixel method.
That's pretty creative.


I tried creating a huge red rectangle and then blt'd it over my image with a given opacity.


Though, the end result wasn't too attractive.


I guess I'd have to throw a dll at it and do actual pixel manipulations following the tinting algorithm.
 
Last edited by a moderator:

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses
If you don't want to do write it by yourself, I already wrote some of the Sprite “effects” like tone or color for bitmaps.


See the attachment for the tone effect(s). Feel free to do whatever you want with it. I've extracted it from a larger source code and rewrote some stuff (mainly reordering some code and removing SSE2 intrinsics), so even though it's a bit slower now, it's also more readable and portable.


(Actually, I think RGSS3 requires SSE or even SSE2. Maybe I should check that and add them again.)

Project21.zip
 

Attachments

Last edited by a moderator:

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
310
First Language
English
Primarily Uses
Nice cremno, that looks neat!


@Tsuki, I remembered two ways of writing a dll in RGSS, the first is this: RGSSX Bitmap Functions


The second is this: Wanabe's LoadSo


The second one is more powerful (it's re-implementing the ability to load ruby extensions) and is most likely the source cremno used (or an iteration thereof, it simply is a 'rehash' of the ruby headers and part of it's source), but not 100% complete yet. The first one is more specifically for just adding in your own custom for-rpgmaker-only written-in-visual-studio dll. Hope that helps.
 
Last edited by a moderator:

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
216
Reaction score
97
Primarily Uses

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top