473,467 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2065
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.