| 
		
	
	
	
		
	Posts: 607Threads: 36
 Joined: May 2009
 
	
	
		Hey, I was just wondering how I would shrink an icon. I have this right now: Code: bitmap = RPG::Cache.icon(item.icon_name)    self.contents.font.color = normal_color    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 16, 16))    self.contents.draw_text(x + 20, y, width-80, 16, item.name)
It makes the area 16x16, but the icon is still normal sized.
	
My partner in crime = TREXRELL 
	
	
	
		
	Posts: 11,566Threads: 672
 Joined: May 2009
 
	
	
		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...)
  Above are clickable links 
	
	
	
		
	Posts: 607Threads: 36
 Joined: May 2009
 
	
	
		I'm sorry, I sort of understand but how would I use this? 
resize("icon name", true)
 
How does it know what size to switch to?
 
NVM let me figure this out! :) I've been trying to teach myself.
 
Thank you!
 
Ok, so I've been here... trying to figure this out. This is the new method.
 Code: if item == nilreturn
 end
 self.contents.font.color = normal_color
 #self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 16, 16))
 bitmap = RPG::Cache.icon(item.icon_name)
 rect = Rect.new(0, 0, 16, 16)
 icon = Rect.new(0, 0, 16, 16)
 bitmap.stretch_blt(rect, bitmap,icon)
 self.contents.draw_text(x + 20, y, width-80, 16, item.name)
It just comes up blank now.
	
My partner in crime = TREXRELL 
	
	
	
		
	Posts: 68Threads: 1
 Joined: Sep 2009
 
	
	
		I didn't know you edited your post.  Last I saw was "gonna figure this out".  I woulda come earlier had I known. 
Well, you commented out the line that pasted the revised icon and forgot to redo it after the resize.  You also performed the resize, but didn't establish it as a new bitmap.  I did a little editing as you can see here.
 Code: if item == nilreturn
 end
 self.contents.font.color = normal_color
 bitmap    = RPG::Cache.icon(item.icon_name)
 newbitmap = bitmap.clone
 rect      = Rect.new(0, 0, 32, 32)
 rect2     = Rect.new(0, 0, 16, 16)
 newbitmap = bitmap.stretch_blt(rect, bitmap, rect2)
 self.contents.blt(x, y + 4, newbitmap, rect2)
 self.contents.draw_text(x + 20, y, width-80, 16, item.name)
DerVVulfman's 'regular Joe' account for testing and permissions use.Who watches the Watchmen?
 
	
	
	
		
	Posts: 607Threads: 36
 Joined: May 2009
 
	
	
		I'm going to try this out asap. For some reason, I thought that the stretch blt was standalone and did not need the regular blt call.
	 
My partner in crime = TREXRELL 
	
	
	
		
	Posts: 192Threads: 82
 Joined: Jul 2009
 
	
	
		the stretch_blt is stand alone, but you didn't apply it to the window content 
Change the
 Code: bitmap.stretch_blt(rect, bitmap,icon)self.contents.draw_text(x + 20, y, width-80, 16, item.name)
to
 Code: self.contents.stretch_blt(rect, bitmap,icon)self.contents.draw_text(x + 20, y, width-80, 16, item.name)
 
	
	
	
		
	Posts: 607Threads: 36
 Joined: May 2009
 
	
	
		Thanks I got it working properly.
	 
My partner in crime = TREXRELL |