Re: Tiled Images

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 02/10/05


Date: Thu, 10 Feb 2005 20:51:46 +0100

Take a look at the beginners guide to GDI+. It explains how to select little
bits of an image. Also the GDI+ FAQ article on drawing images.

-- 
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Jake" <Jake@discussions.microsoft.com> wrote in message 
news:99279AD4-B344-488F-9214-27275605FC9E@microsoft.com...
> Basicly what i'm trying to do is make a tile based sidescroller game. I 
> found
> a cool app called Tile Studio that helps you make the tiles and 
> everything.
> So I now have a bmp with all the tiles, and now I need a way to load them
> into my app so I can use them. So if there is anyway to grab a region from 
> a
> bmp and put it into an Image object, that would be awesome. If not, I'll 
> have
> to figure something else out. Just trying to do it without haveing to save
> each tile as a different file. If you had 100 different tiles, then you'd
> have to deal with 100 different files. Just trying to stay away from that.
> Thanks for your help.
>
> :// Jake
>
> "Bob Powell [MVP]" wrote:
>
>> You can add images to an imagelist dynamically. You could maintain a list 
>> of
>> images in a configuration file and distribute image tiles with the
>> application or replace them later with new ones.
>>
>> You mention WinAmp skins. Are you creating a skinning application?
>>
>> -- 
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>> "Jake" <Jake@discussions.microsoft.com> wrote in message
>> news:5813849B-BA0B-49C3-A3F1-064E7B8BE55A@microsoft.com...
>> > Good suggestion, but I would like to be able to switch out the images 
>> > at
>> > runtime (ie. without re-compileing). After I posted, I looked through 
>> > the
>> > FAQ
>> > you have on your sig and found the Regions. I dled the code and it 
>> > looks
>> > like
>> > this may work. If you can offer anything else, please do. I'm all 
>> > ears...
>> > :)
>> >
>> > thanks
>> >
>> > :// Jake
>> >
>> > "Bob Powell [MVP]" wrote:
>> >
>> >> For images of this size the ImageList is the ideal solution. You can 
>> >> save
>> >> the tiles as individual images and then load them into an imagelist at
>> >> design time. The resulting resource will contain all your tiles at 
>> >> their
>> >> desired size in a form that you can access by an index.
>> >>
>> >> If this doesn't work for you I have more complex solutions.
>> >>
>> >> -- 
>> >> Bob Powell [MVP]
>> >> Visual C#, System.Drawing
>> >>
>> >> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> >> http://www.bobpowell.net/tipstricks.htm
>> >>
>> >> Answer those GDI+ questions with the GDI+ FAQ
>> >> http://www.bobpowell.net/faqmain.htm
>> >>
>> >> All new articles provide code in C# and VB.NET.
>> >> Subscribe to the RSS feeds provided and never miss a new article.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> "Jake" <Jake@discussions.microsoft.com> wrote in message
>> >> news:918ED940-D063-40F7-8C5D-D5766E1FA515@microsoft.com...
>> >> > Not quite sure how to ask this. I'm new to graphics programming. I'm
>> >> > trying
>> >> > to figure out how to only open part of an image. I have an image 
>> >> > with
>> >> > about 4
>> >> > or 5 tiles. Each tile is 32x32px. I want to load this 'tile set' 
>> >> > into
>> >> > an
>> >> > array so that I can use it in my program. This way I don't have to 
>> >> > keep
>> >> > each
>> >> > tile in a differnet bitmap. It's the same idea that winamp uses for
>> >> > it's
>> >> > skins. If anyone has any suggestions, please help. I just need to be
>> >> > pointed
>> >> > in the right direction. thanks
>> >> >
>> >> > :// Jake
>> >>
>> >>
>> >>
>>
>>
>> 


Relevant Pages

  • Re: Very Large Bitmaps
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > spaces and 16-bit images etc without the horrible ambiguity and missing ... A bitmap is loaded and expanded to an uncompressed raster so 18000 * ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Very Large Bitmaps
    ... The GDI+ encoder/decoder systems are dedicated to working with whole images ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... >>> but does not work for the large size bitmap, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Memory leak/problems when printing TIFF images (VS2005)
    ... can that be used on the module scope level? ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... images, however, after ~1100 images I catch an exception saying, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Capturing a Window
    ... Writing a stream of large images to disk is as much of a performance sink as ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... > Obviously I'm not going to be capturing notepad, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Tiled Images
    ... You can add images to an imagelist dynamically. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... >> the tiles as individual images and then load them into an imagelist at ...
    (microsoft.public.dotnet.framework.drawing)