Convert GDI+ interface for RGSS2

Cremno wrote a screenshot taker that uses the GDI+ interface.


I like the performance of the script and creates images extremely fast.


However, the DL module is not available in RGSS2.


Can someone modify this script to work in VX, or does anyone have alternative scripts that use GDI+?


https://gist.github.com/cremno/4148851
CACAO has a script for this

http://cacaosoft.web.fc2.com/tkool/script/rgss3/save_bitmap.html

It is for Ace, but it does not use the DL module like cremno's version, so it works with RGSS2.

To make it compatible with RGSS2, simply go to line 114

GAME_TITLE = load_data("Data/System.rvdata2").game_title.encode('SHIFT_JIS')And change it to something arbitrary like "title" (or load it properly from Data/System.rvdata...)You might have to change a couple things from symbols to strings though, like the save_png method in Bitmap.

But the problem is PNG export is still really slow. Probably cause it's doing this

Code:
def GdipCreateImageFromBitmap(bitmap)    gpbmp = [0].pack("i")    if @@GdipCreateBitmapFromScan0.call(      bitmap.width, bitmap.height, 0, PF_ARGB, 0, gpbmp) == 0            image = gpbmp.unpack("i")[0]      r = [0, 0, bitmap.width, bitmap.height].pack("i4")       = [0, 0, 0, 0, 0, 0].pack("i6")      @@GdipBitmapLockBits.call(image, r, 3, PF_ARGB, )      @@GdipBitmapUnlockBits.call(image, )       = .unpack("i*")      data = Array.new(bitmap.width * bitmap.height * 4, 0).pack("C*")      @@RtlMoveMemory.call(data, bitmap.data, data.size)      data = data.unpack("C*")      data = Array.new(bitmap.height) do |i|        data[data.size - bitmap.width * 4 * (i + 1), bitmap.width * 4]      end.flatten!.pack("C*")      @@RtlMoveMemory.call([4], data, bitmap.width * bitmap.height * 4)            return image    else      return nil    end  end
Instead of just letting GDI do the work..

Original thread: https://forums.rpgmakerweb.com/threads/convert-gdi-interface-for-rgss2.16129/