Negate Image (Basically a JoJo reference)

Hi everybody,

So ive been messing around with Bitmap, although not the source code, you get the ide, etc.

I’m wondering if there’s some kind of way to pretty much turn a bitmap, and more specifically a portion of a bitmap, into a negative of its image. It would be interesting. Also, I want a script that could, for example, start as a small negative dot where the player is, then grow larger and larger (while playing the Dio “ZA WARUDO” sound from JoJo’s bizzare adventure lol), while also shaking the screen. The negative circle grows until it fills up the entire screen with the negative tint, and then quickly receded back to the dot where it originated, leaving the screen the normal color. Know what I mean?

I thought it would be cool, and all I need is the script for the animation of the negative circle growing and receding, I can do the rest of the scripting myself.

Thanks and I hope you like the idea!
Just for context who don't know:
Disclaimer: This operation is expensive. Means it may lag while flipping the color to negative
Code:
class Bitmap
  def negative!
    width.times do |w|
      height.times do |h|
        color = get_pixel(w,h)
        color.red = 255 - color.red
        color.blue = 255 - color.blue
        color.green = 255 - color.green
        set_pixel(w, h, color)
      end
    end
  end
end

$sprite = Sprite.new
$sprite.bitmap = Cache.battleback1("GrassMaze")

loop do 
  Graphics.update
  Input.update
  if Input.trigger?(:C)
    Graphics.freeze
    $sprite.bitmap.negative!
    Graphics.update
    RPG::SE.new("Battle2").play
    Graphics.transition(60, "Graphics/System/BattleStart", 100)
  end
end
Put this code in the script editor, playtest, then hit enter.
Disclaimer: This operation is expensive. Means it may lag while flipping the color to negative
Code:
class Bitmap
  def negative!
    width.times do |w|
      height.times do |h|
        color = get_pixel(w,h)
        color.red = 255 - color.red
        color.blue = 255 - color.blue
        color.green = 255 - color.green
        set_pixel(w, h, color)
      end
    end
  end
end

$sprite = Sprite.new
$sprite.bitmap = Cache.battleback1("GrassMaze")

loop do
  Graphics.update
  Input.update
  if Input.trigger?(:C)
    Graphics.freeze
    $sprite.bitmap.negative!
    Graphics.update
    RPG::SE.new("Battle2").play
    Graphics.transition(60, "Graphics/System/BattleStart", 100)
  end
end
Put this code in the script editor, playtest, then hit enter.

Thanks so much, I can’t really show how much I appreciate it haha
Btw. RGSS offers something similar: the rarely used sub(tractive) blend type. It's faster than Bitmap#{get,set}_pixel. Of course since it's a sprite property it doesn't manipulate the bitmap data at all and it may not be the right tool here anyway.

There's also the faster but unofficial way to manipulate bitmaps via a DLL, e.g. Bitmap-EX.
@cremnophobia as you have guessed, blend type is a totally different function. As the name implies, it's a function to blend (multiple images). The negative/positive blend just means that the color is additive or subtractive on top of each other. Not on its own.

Original thread: https://forums.rpgmakerweb.com/threads/negate-image-basically-a-jojo-reference.120556/