473,799 Members | 3,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding GraphicsPath to Bitmap?

jay
I have a bitmap and a graphicspath object. I draw pixels on m_Bitmap and I'm
drawing text using m_Graphics GraphicsPath object.

However, saving my work with m_Bitmap.Save doesn't save GraphicsPath along
with it.

How do I save it all in a single file? Or how do I "glue" graphicspath to
bitmap so they save together?

thanks,
jay
Nov 16 '05 #1
1 11960
If you're intention is to modify a bitmap with graphics in the path then you
need to obtain the Graphics object for the bitmap using Graphics.FromIm age,
draw the GraphicsPath to that image using DrawPath or FillPath and then save
the image to a file.

Bitmap bm=Bitmap.FromF ile(filename);
Graphics g=Graphics.From Image(bm);
GraphicsPath pth=new GraphicsPath();
pth.AddEllipse( 10,10,200,150);
g.FillPath(Brus hes.Yellow,pth) ;
g.DrawPath(Pens .Black,pth);
g.Dispose();
bm.Save(another filename,ImageF ormat.jpeg);

DISCLAIMER: late at night, not compiled, hope you get the picture, (pun
intended)

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml


"jay" <so***@nospam.c om> wrote in message news:cf******** **@bagan.srce.h r...
I have a bitmap and a graphicspath object. I draw pixels on m_Bitmap and I'm drawing text using m_Graphics GraphicsPath object.

However, saving my work with m_Bitmap.Save doesn't save GraphicsPath along
with it.

How do I save it all in a single file? Or how do I "glue" graphicspath to
bitmap so they save together?

thanks,
jay

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
7658
by: Altramagnus | last post by:
I have a complicated Region object, which I need to draw the outline, but not fill How can I convert the Region object to GraphicsPath object? or How can I draw the outline of the Region object?
6
2413
by: Altramagnus | last post by:
I have n number of circles. Some of them might overlap. I need to draw the outline of all circles but not those overlap areas. Initially, I am try to use a Region, because a Region object has a Union function Creating a GraphicsPath of 1 circle is easy. So I convert each GraphicsPath to a Region and then Union them. But I could not get back a GraphicsPath of the Unioned Region. Does anyone know how to solve my problem?
2
6530
by: Ivan Figueredo | last post by:
Hi, I have successfully implemented a simple TreeView Control with a corresponding Listview. I know how to assign a bitmap to the first item of a Listview, but is it possible to add a bitmap to any column of a Listview? Finally, I was wondering if it is possible to have the
1
1875
by: james autry | last post by:
Is there an example somewhere of how to insert a Bitmap column into a DataGrid?
0
2113
by: jay | last post by:
Hi! I'm using this code to add text to the GraphicsPath m_Gpath: m_Gpath.AddString(m_objectLabel, otherFont.FontFamily, (int)otherFont.Style, (int)otherFont.Size, new Point(m_MouseX, m_MouseY), StringFormat.GenericDefault); I'm using this code to paint Bitmap m_Bitmap on a picture control:
2
3456
by: James dean | last post by:
I am using Graphics path in my application and i have located the slow areas in my rogram and it seems that the graphics path consistently is slow when doing any operation like adding another graphics path, adding text etc......and also drawing the Graphics path onto the drawing surface using the Graphics class is also slow. Am i doing something wrong or is this the fault of GDI+ which i have heard was slow?.....is this a correct...
7
2087
by: Crirus | last post by:
Hi Is that true that this IsVisible method is incredible slow? Seems that my app is much slower with only this added as a condition to draw something Crirus
4
1946
by: Don | last post by:
When creating a new region for a control via a GraphicsPath object, it appears the entire rightmost column of pixels and bottom most row of pixels are not included in the region. I will try to clarify with some ASCII art. Imagine a GraphicsPath describing a 4x4 pixel square with rounded corners (X = pixel, _ = blank) _ X X _ X X X X X X X X
2
5449
by: Martijn Mulder | last post by:
/* GraphicsPath.IsVisible() gives unexpected results. I fill a System.Drawing.Drawing2D.GraphicsPath-object with PointF-structures that define the unit-square (0,0), (1,0), (1,1) and (0,1). Then I test 3 different PointF-structures to see if they fall inside the unit- square and the results are clearly wrong: Point(-0.2, -0.2) falls inside the unit square... WRONG!!! Point(0.2, 0.2) falls inside the unit square... Point(0.7, 0.7) falls...
0
9687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10488
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10237
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10029
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6808
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4144
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 we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.