Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:16:17+00:00 2026-06-07T17:16:17+00:00

This question is quite difficult for me to explain, so I’ll be illustrating with

  • 0

This question is quite difficult for me to explain, so I’ll be illustrating with some images as well as text.

For a steel engraving machine I need to use .NET’s normal graphics framework to create a “document” that is sent to the engraving machine – it is treated just like a normal printer. The machine in question is this one:

http://www.rolanddga.com/products/impactprinters/mpx90/features.asp

I can print a text-outline on it in C# with this:

// ALL UNITS ARE SET IN MILIMETERS (MM)

Graphics g = <instantiated from my printers-printpage-event>;

// The following values are set as "constants" here for the purpose of my question
// they normally are passed as parameters
string s = "ABC";
float fontSize = 4.0F;
RectangleF r = new RectangleF(0, 30.0F, 100.0F, 40.0F);

StringFormat sfDraw = new StringFormat();
sfDraw.Alignment = StringAlignment.Center;
FontStyle fStyle = FontStyle.Regular;

using (var gpDraw = new GraphicsPath())
{
  gpDraw.AddString(text, fFamily, (int)fStyle, fSize, r, sfDraw);

  SolidBrush brushFG = new SolidBrush(Color.Black);
  Pen pen = new Pen(brushFG, 0.01F);

  g.DrawPath(pen, gpDraw);
}

It gives an output similar to this: http://i47.tinypic.com/mruu4j.jpg

What I want now is to fill this outline. Not simply with a brush-fill (as can easily be accomplished with g.FillPath(brushFG, gpDraw).

It should instead be “filled” with smaller and smaller outlines, like shown on this image: http://i46.tinypic.com/b3kb29.png

(the different line colors are only used to make the example clearer).

As I made the example in Photoshop, I realized that what I am actually trying to do is to mimmick the functionality, that you find in Photoshop’s Select/Modify/Contract.

But I am at my wit’s end as to how I accomplish this.

Any help? I’m not looking for a complete solution, but I am at the moment completely stuck. I’ve tried simple scaling, which probably is the wrong way (since it does not produce the right result…)

UPDATE 2012-07-16: I am now using the Clipper Library http://www.angusj.com/delphi/clipper.php which has a wonderful function called OffsetPolygons.

My test-code is shown here: http://pastie.org/4264890

It works fine with “single” polygons – e.g. a “C” since it only consists of a single polygon. An “O” consist of two polygons – an inside and outside. Likewise with “A”. And these give me some trouble. See these images:

C: http://i46.tinypic.com/ap304.png
O: http://i45.tinypic.com/35k60xg.jpg
A: http://i50.tinypic.com/1zyaibm.png
B: http://i49.tinypic.com/5lbb40.png

You get the picture (heh heh… 😉

I think the problem is, that I extract everything from GraphicsPath as a single polygon, when there are actually 2 (in the case of A and O), and 3 in the case of a B.

Clipper’s OffsetPolygons actually takes an array of polygons, so I guess it is able to do this right. But I don’t know how to extract my paths from GraphicsPath as seperate polygons.

UPDATE 2012-07-16 (later in the day):

Okay I’ve actually managed to pull it off now, and will explain it in an answer, in the hope that it might help others with similar problems.

And a big thank you to everybody who helped along the way! Only reason that I accept my own answer is so that others might benefit from this question with a full-baked solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:16:19+00:00Added an answer on June 7, 2026 at 5:16 pm

    Take a look at An algorithm for inflating/deflating (offsetting, buffering) polygons — the questioner there is actually asking about the reverse operation, but the answers there apply to your case as well. One of them (the highest rated) has a pointer to an open source library that has a C# version.

    The usual name for the operation you describe is “polygon offsetting”, by the way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question was asked quite some time ago, and while it covers possible solutions
It is very difficult for me to explain this particular problem/question so please bear
I've been looking for the answer to this question but it seems quite difficult
This question is quite difficult to describe in words, so let me know if
I know this question is quite basic but I am new to JQuery and
I know this question might sound quite silly, but I somehow found myself stuck
I find the nature of this question to be quite suited for the practical-minded
I realize that the answer to this question is likely quite obvious (if somewhat
This is a very basic question...quite embarassing, but here goes: I have a Stopwatch
This question asks about file name the servers sends and the fix was quite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.