473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

splitting bitmaps

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
1 2064
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brad Smalling | last post by:
Does anyone know if there is a reason to prefer bitmaps over icons (or vice-versa) when populating image lists? I've always favored icons because of their built-in transparency (although I've...
1
by: Mark Evans | last post by:
I have a dialog box and on it I want to display a bitmap, which will change at various times during the program. My problem is that the bitmaps will not be the same each time. I want the user to...
0
by: Kevin A. | last post by:
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...
4
by: Nathan | last post by:
Hello, I'm needing some advice: I have an app for which I've built a timer out of multiple bitmaps--a clock with a moving hands. I've saved each hand position (1 second, 2 seconds, etc.) as a...
1
by: John | last post by:
I have 76 bitmaps (640 x 480) and need to combine them together to form a big one (about 3840 x 2880). Those 76 bitmaps overlap each other with a small portion. Is there any way to do it? Thanks.
1
by: Peter Stojkovic | last post by:
What is the correct way to move BITMAPS and drawings inside a windows-forms from one project to another project. The problem is the following row: Dim resources As...
2
by: Mike | last post by:
Hello everybody. I am drawing a country map that consists of 149 municipality bitmaps, each around 25 Kb. I draw it onto the in-memory bitmap, then draw it on the picture box. I use C++, but...
1
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, I need to combine several bitmaps together to form a single bitmap. Can anyone show me some similar sample code? Thanks. AJ
1
by: nkumarin001 | last post by:
Hi, Can anyone help me in this matter:- When i was studying locally managed tablespaces i came across bitmaps that are used in locally managed tablespaces it stated that:- "Locally...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.