I want to create a new Bitmap which is a portion of an existing Bitmap. For
example, if I have a Bitmap that is 100x100 in size I might want to create a
new Bitmap that is equivalent to the one located at (x,y)=(10,20)
(upper-left hand corner) and is 50x50 in size of the source Bitmap. A
sub-Bitmap if you will, sort of the equivalent to sub-strings for a source
string.
I don't think this works, but something like:
Bitmap^ src_bm = gcnew Bitmap( "bm100x100.bmp" ) ;
Bitmap^ sub_bm = gcnew Bitmap( src_bm(Rectangle(10,20,50,50)) ) ;
Now I can do this via SLOW code ala creating the sub-bitmap of the proper
size and then copying pixels one-by-one from the source bitmap via GetPixel
and SetPixel. But I'm hoping that the construct for a sub-bitmap exists, as
it is quite natural. I can easily DRAW a sub-bitmap with the Graphics class,
but I want to create it as a new Bitmap.
Should I use the pixel-by-pixel method, or is there a faster and/or easier
way?
Thanx in advance for response!
[==Peter==]
PS - I'm developing in MS VC++ 2005 Express ala /cli (managed) code. This is
the Bitmap class I'm speaking of (since there may be more than one with the
same name but different namespaces):
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/cpref8/html/T_System_Drawing_Image_Members.htm 2 2574
1 create an empby bitmap
2 use Graphics::FromImage to create a Graphics from the empby bitmap
3 draw the desired potion of your bitmap to the Graphics
4 save the bitmap you created at step 1 and altered in step 3
--
Sheng Jiang
Microsoft MVP in VC++
"Peter Oliphant" <po*******@roundtripllc.comwrote in message
news:OE**************@TK2MSFTNGP03.phx.gbl...
I want to create a new Bitmap which is a portion of an existing Bitmap.
For
example, if I have a Bitmap that is 100x100 in size I might want to create
a
new Bitmap that is equivalent to the one located at (x,y)=(10,20)
(upper-left hand corner) and is 50x50 in size of the source Bitmap. A
sub-Bitmap if you will, sort of the equivalent to sub-strings for a source
string.
I don't think this works, but something like:
Bitmap^ src_bm = gcnew Bitmap( "bm100x100.bmp" ) ;
Bitmap^ sub_bm = gcnew Bitmap( src_bm(Rectangle(10,20,50,50)) ) ;
Now I can do this via SLOW code ala creating the sub-bitmap of the proper
size and then copying pixels one-by-one from the source bitmap via
GetPixel
and SetPixel. But I'm hoping that the construct for a sub-bitmap exists,
as
it is quite natural. I can easily DRAW a sub-bitmap with the Graphics
class,
but I want to create it as a new Bitmap.
Should I use the pixel-by-pixel method, or is there a faster and/or easier
way?
Thanx in advance for response!
[==Peter==]
PS - I'm developing in MS VC++ 2005 Express ala /cli (managed) code. This
is
the Bitmap class I'm speaking of (since there may be more than one with
the
same name but different namespaces):
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/cpref8/html/T_System_Dra
wing_Image_Members.htm
>
Thanks, Sheng! I tried it and it works great!
Not only that, this opens up a lot more possibilities I hadn't considered,
since I didn't know before how to get a Graphics object from an Image
before! Thanks again!
[==Peter==]
"Sheng Jiang[MVP]" <sh*********@hotmail.com.discusswrote in message
news:eO**************@TK2MSFTNGP05.phx.gbl...
>1 create an empby bitmap
2 use Graphics::FromImage to create a Graphics from the empby bitmap
3 draw the desired potion of your bitmap to the Graphics
4 save the bitmap you created at step 1 and altered in step 3
--
Sheng Jiang
Microsoft MVP in VC++
"Peter Oliphant" <po*******@roundtripllc.comwrote in message
news:OE**************@TK2MSFTNGP03.phx.gbl...
>I want to create a new Bitmap which is a portion of an existing Bitmap.
For
>example, if I have a Bitmap that is 100x100 in size I might want to create
a
>new Bitmap that is equivalent to the one located at (x,y)=(10,20) (upper-left hand corner) and is 50x50 in size of the source Bitmap. A sub-Bitmap if you will, sort of the equivalent to sub-strings for a source string.
I don't think this works, but something like:
Bitmap^ src_bm = gcnew Bitmap( "bm100x100.bmp" ) ; Bitmap^ sub_bm = gcnew Bitmap( src_bm(Rectangle(10,20,50,50)) ) ;
Now I can do this via SLOW code ala creating the sub-bitmap of the proper size and then copying pixels one-by-one from the source bitmap via
GetPixel
>and SetPixel. But I'm hoping that the construct for a sub-bitmap exists,
as
>it is quite natural. I can easily DRAW a sub-bitmap with the Graphics
class,
>but I want to create it as a new Bitmap.
Should I use the pixel-by-pixel method, or is there a faster and/or easier way?
Thanx in advance for response!
[==Peter==]
PS - I'm developing in MS VC++ 2005 Express ala /cli (managed) code. This
is
>the Bitmap class I'm speaking of (since there may be more than one with
the
>same name but different namespaces):
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/cpref8/html/T_System_Dra
wing_Image_Members.htm
>> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MiW |
last post by:
Hi
I'm making a kind of JavaScript-based library for creating SVG
objects/elements. And I hit the wall...
Every element (rect, circle etc.) can be created using
*.createElement, then...
|
by: RHamilton |
last post by:
I've been making stop and go progress on a test app that creates a .tif
file. After fighting other problems (that have already been discussed here
and elsewhere), I'm able to generate a .tif file...
|
by: James Dean |
last post by:
In my program i create a 32ARGB bitmap. To actually create the bitmap
seems very slow. In fairness the file size is very big. I support
multiple bitmaps as well. I have to convert these bitmaps to...
|
by: mark |
last post by:
I want plot points on a cartesian surface with single pixels. I have been
unable to find a graphics member which draws points. (Is there one?)
I would like to create a bitmap one element wide and...
|
by: Nathan Sokalski |
last post by:
I am having a problem saving an image with the same name it originally had. I have two similar versions of my code, one in which I close the FileStream used to open the original image before saving,...
|
by: tshad |
last post by:
I am trying to set up an Image authorization where you type in the value
that is in a picture to log on to our site.
I found a program that is supposed to do it, but it doesn't seem to work.
...
|
by: AlVis1515 |
last post by:
We had a VB6 program that was used to take a scanned signature image as a set
of screen coordinates.
The VB6 program then converted this into a bitmap file which we used to
embed the signature...
|
by: Robert Dufour |
last post by:
I been trying to look for samplecodes on how to create a simple tif file. I
found a lot of commercial and stuff but I would prefer to roll my own. I
only need to put some formatted text in a tif...
|
by: colin |
last post by:
Hi,
I have all the components of a .bmp file in memory wich i need
to write to a .bmp file, (or other convenient image file)
ie i have 256 color pallete of RGBquads and array of 8bit pixels,
I...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |