By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

splitting bitmaps

P: n/a
Hi all,

I'm trying to make a little game in VB.NET that uses sprites (bitmaps)
with a fixed size, currently 32x32 pixels.
Now I was thinking: when I want to include objects in my game
(buildings or so) that consist of multiple sprites, I would have to
divide that object into individual sprites and draw them separately in
Paint. But this is too hard to do.
For example, if I wanted a building with a size of 96x64 pixels
(or 3x2 measured in sprites), I would have to draw 6 separate images
of 32x32 in Paint.
Or: I could draw the entire image of 96x64 in one piece, and include
a function in my application that divides this large image into 6 images
of 32x32.
The problem is: how can I do this? How can I copy a part of an
image (the large image) into a smaller image (the sprite)?

Please help. Thanks in advance.

Kevin
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello Kevin,

there is an overload of Graphics.DrawImage that takes the source rectangle
and the destination rectangle as arguments. So you could call DrawImage
repeatedly with squares of 32x32 at a time to draw from your source image
to a target device (or bitmap).

HTH
Antoine
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
From: "Kevin A." <ke*********@antwerpen.be>
Subject: splitting bitmaps
Date: Sat, 20 Sep 2003 17:47:10 +0200
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <e4**************@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: ppp-62-235-226-118.tiscali.be 62.235.226.118
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:139892
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hi all,

I'm trying to make a little game in VB.NET that uses sprites (bitmaps)
with a fixed size, currently 32x32 pixels.
Now I was thinking: when I want to include objects in my game
(buildings or so) that consist of multiple sprites, I would have to
divide that object into individual sprites and draw them separately in
Paint. But this is too hard to do.
For example, if I wanted a building with a size of 96x64 pixels
(or 3x2 measured in sprites), I would have to draw 6 separate images
of 32x32 in Paint.
Or: I could draw the entire image of 96x64 in one piece, and include
a function in my application that divides this large image into 6 images
of 32x32.
The problem is: how can I do this? How can I copy a part of an
image (the large image) into a smaller image (the sprite)?

Please help. Thanks in advance.

Kevin


Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.