Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Resolved] Shrinking an Icon
#2
I use this to increase graphic sizes for a zoomed effect in my CharGen project
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
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
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }


Messages In This Thread
[Resolved] Shrinking an Icon - by Yin - 01-11-2012, 03:07 AM
RE: Shrinking an Icon - by DerVVulfman - 01-11-2012, 04:57 AM
RE: Shrinking an Icon - by Yin - 01-11-2012, 05:12 AM
RE: Shrinking an Icon - by NightOwl - 01-13-2012, 12:00 AM
RE: Shrinking an Icon - by Yin - 01-13-2012, 06:02 PM
RE: Shrinking an Icon - by Victor Sant - 01-13-2012, 09:33 PM
RE: Shrinking an Icon - by Yin - 01-26-2012, 11:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Icon Display 1.0 scripts makes events impossible to go to events, which are passable Djigit 0 3,658 01-03-2015, 09:11 PM
Last Post: Djigit
   [Resolved] DerVVulfman Animated Battlers - Physical attacks result in looping Samven 2 5,809 07-07-2012, 10:56 AM
Last Post: Samven
   Icon next to ennemy name in battle ? mageone 6 8,185 10-09-2009, 04:57 PM
Last Post: mageone
   [Resolved] Equipment Scene Problem Yin 4 6,709 08-29-2009, 11:01 PM
Last Post: Yin



Users browsing this thread: