473,322 Members | 1,409 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,322 software developers and data experts.

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 11877
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.FromImage,
draw the GraphicsPath to that image using DrawPath or FillPath and then save
the image to a file.

Bitmap bm=Bitmap.FromFile(filename);
Graphics g=Graphics.FromImage(bm);
GraphicsPath pth=new GraphicsPath();
pth.AddEllipse(10,10,200,150);
g.FillPath(Brushes.Yellow,pth);
g.DrawPath(Pens.Black,pth);
g.Dispose();
bm.Save(anotherfilename,ImageFormat.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.com> wrote in message news:cf**********@bagan.srce.hr...
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
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
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...
2
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...
1
by: james autry | last post by:
Is there an example somewhere of how to insert a Bitmap column into a DataGrid?
0
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,...
2
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...
7
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
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...
2
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.