06-10-2023, 01:10 AM
(This post was last modified: 06-12-2023, 04:29 AM by DerVVulfman.)
Well, this is what I wanna speed up within RPGMaker XP...
Now within RPGMaker XP:
But, you'd think they woulda PUT TONE ADJUST INTO THE BITMAP CLASS?????
Still, for anything large, this code does take some time to change a bitmap. If I could adjust the bitmap with the Tone class I could with sprites, it would be dang near instantaneous. Unfortunately, I need something FAAAAST!
And no. You cannot tone adjust a sprite and copy the contents into a bitmap. The sprite's own properties are what is adjusted, not the bitmap contained within.
So, does anyone know of a faster means to adjust the tone of a bitmap?
Code:
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
# The bitmap class. Bitmaps are expressions of so-called graphics.
#==============================================================================
class Bitmap
#-------------------------------------------------------------------------
# * Tone Adjust
# r : red adjustment (defaulted to 0 middle of -255 - 255 range)
# g : green adjustment (defaulted to 0 middle of -255 - 255 range)
# b : blue adjustment (defaulted to 0 middle of -255 - 255 range)
#-------------------------------------------------------------------------
def tone_adjust(r=0, g=0, b=0)
# Adjust values to be within -255 to 255 ranges
r = tone_ranges(r)
g = tone_ranges(g)
b = tone_ranges(b)
# Cycle through the bitmaps pixels
for x in 0..self.width
for y in 0..self.height
#
# Base mechanics for each pixel
color = self.get_pixel(x, y) # Get single pixel color
next if color.alpha == 0 # Skip if transparent
rr = color.red + r # Adjust the red
gg = color.green + g # Adjust the green
bb = color.blue + b # Adjust the blue
self.set_pixel(x, y, Color.new(rr, gg, bb)) # Replace the pixel
#
end
end
end
#-------------------------------------------------------------------------
# * Tone Range Adjustment
# value : value (forced to stay in -255 to -255 range)
#-------------------------------------------------------------------------
def tone_ranges(value)
value = -255 if value < 255
value = 255 if value > 255
end
end
Now within RPGMaker XP:
- You can hue-adjust bitmaps within a 0-360 range.
- You can tone adjust sprites, or increase the red, green and/or blue tones in a range of -255 to 255, darkening or lightening them accordingly.
But, you'd think they woulda PUT TONE ADJUST INTO THE BITMAP CLASS?????
Still, for anything large, this code does take some time to change a bitmap. If I could adjust the bitmap with the Tone class I could with sprites, it would be dang near instantaneous. Unfortunately, I need something FAAAAST!
And no. You cannot tone adjust a sprite and copy the contents into a bitmap. The sprite's own properties are what is adjusted, not the bitmap contained within.
So, does anyone know of a faster means to adjust the tone of a bitmap?