I have been looking at ways to copy the map Bitmap, the closest I have found is this implementation here:
Map Effects.rb
Map Effects Doc En.txt
That script has a lot around it for its use (Map post-processing effects) and I don't want any of that, I just want to be able to say:
Now this chunk looks very handy:
What I understand from this is that it is shifting the viewports given via elements so their .z value overflows, leaving .z == 0 as the top viewport, then it calls snap_to_bitmap to grab the screen as a bitmap, then it reshifts the viewport .z values back to where they started from.
It looks like an excellent start to what I want to do, could someone lend a hand please?
Thanks!
EDIT: Looks like I may have figured something out on my own, if anyone wants to improve on this then please do
Map Effects.rb
Map Effects Doc En.txt
That script has a lot around it for its use (Map post-processing effects) and I don't want any of that, I just want to be able to say:
Ruby:
@spriteset = Spriteset_Map.new
@mapbitmap = @spriteset.bitmap_from_viewport
Now this chunk looks very handy:
Ruby:
class << Graphics
def snap_elements_to_bitmap(*elements)
if !@snap_elements_back or @snap_elements_back.disposed?
@snap_elements_back = Sprite.new
@snap_elements_back.bitmap = Bitmap.new(1, 1)
@snap_elements_back.bitmap.set_pixel(0, 0, Color.new(0, 0, 0))
@snap_elements_back.z = 0x0FFF_FFFF
end
@snap_elements_back.zoom_x = width
@snap_elements_back.zoom_y = height
@snap_elements_back.visible = true
elements.each {|element| element.z += 0x1FFF_FFFF}
bmp = snap_to_bitmap rescue retry
@snap_elements_back.visible = false
elements.each {|element| element.z -= 0x1FFF_FFFF}
return bmp
end
end
It looks like an excellent start to what I want to do, could someone lend a hand please?
Thanks!
EDIT: Looks like I may have figured something out on my own, if anyone wants to improve on this then please do
Ruby:
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# Adds a bitmap dump method to Spriteset_Map.
# Hopefully this works.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Dump bitmap
#--------------------------------------------------------------------------
def bitmap_from_viewport
@viewport1.z += 0x1FFF_FFFF
bmp = Graphics.snap_to_bitmap rescue retry
@viewport1.z -= 0x1FFF_FFFF
return bmp
end
end