01-11-2012, 04:57 AM
I use this to increase graphic sizes for a zoomed effect in my CharGen project
Okay.... it may be a mess. The thing is the temp_bmp.stretch_blt(rect, bitmapped, rect2) routine.
rect is the rectangle holding the size/shape of your original
rect2 is the rectangle of your shrunk/resized image
bitmapped is your file
and temp_bmp is your new one
Code:
def resize(bitmapped,flag)
if flag == true
temp_bmp = bitmapped.clone
rect = Rect.new(0, 0, temp_bmp.width, temp_bmp.height)
rect2 = Rect.new((temp_bmp.width/$game_zoom.chargen[1].to_i)*(($game_zoom.chargen[3].to_i)-1),
(temp_bmp.height/$game_zoom.chargen[2].to_i)*(($game_zoom.chargen[4].to_i)-1),
temp_bmp.width/$game_zoom.chargen[1].to_i,
temp_bmp.height/$game_zoom.chargen[2].to_i)
temp_bmp = Bitmap.new(temp_bmp.width, temp_bmp.height)
temp_bmp.stretch_blt(rect, bitmapped, rect2)
bitmapped = temp_bmp
end
return bitmapped
end
rect is the rectangle holding the size/shape of your original
rect2 is the rectangle of your shrunk/resized image
bitmapped is your file
and temp_bmp is your new one