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

  • Home
  • SEARCH
  • 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 8014271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:52:55+00:00 2026-06-04T19:52:55+00:00

this thread is almost what I need: Creating a GraphicsPath from a semi-transparent bitmap

  • 0

this thread is almost what I need:
Creating a GraphicsPath from a semi-transparent bitmap

but he is drawing an outline AROUND the image – I need to draw one just a couple of pixels INSIDE the image. basically I’m trying to draw a “Focus Rectangle” (except it’s not a rectangle)
the result needs to be in the form of a GraphicsPath so i can fit it right into my current code.

private function GetImagePath(img as Image) as GraphicsPath
…
end function

[EDIT]
ok, first of all i cant even get the code from the other post to work. i keep getting index out of range at this line:

*byte alpha = originalBytes[y * bitmapData.Stride + 4 * x + 3];*

that’s IF it even gets past the other stuff first. alot of times it comes out of the first loop having not found a non-transparent point – when most of the image is non-transparent.

the newst problem is that it creates a list of point that dont make any sense. the image is 68×68 my list of points has points like 290×21 and even crazier ones like 2316x-15

this is my original image:

[wont let me upload cause im new]

its the background image of a button that is 70×70 – if that matters at all.

  • 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-04T19:52:57+00:00Added an answer on June 4, 2026 at 7:52 pm

    I would think to use the routine provided in the link, get the output from it, and add your own wrapper around it modifying the path pushing it in the couple pixels you want. You could even make the amount of pixels to move in an input parameter so that you can play around with it.

    Else you could add the second pass directly into the routine provided. Either way I think this is a 2 pass approach. You need to find the outer bounds of the object, that is what is provided. Then you need to essentially move around the path yourself, understand the derivative of the path so that you can move your path in perpendicularly to the derivative at the current point you are looking at. You will also have to recognize inside from outside (i.e. which direction to move the line).

    An Algorithm might look something like this (remember just algorithm):

    Create New List of Points for the new line
    
    For all points i in 0 to (n-2) (points in original point list)
        // Get a New point in between
        float xNew = (x(i) + x(i + 1) ) / 2
        float yNew = (y(i) + y(i + 1) ) / 2
    
        // Need to figure out how much to move in X and in Y for each (pixel) move along
        // the perpendicular slope line, remember a^2 + b^2 = c^2, we have a and b
        float a = y(i + 1) - y(i)
        float b = x(i + 1) - x(i)
        float c = sqrt( (a * a) + (b * b) )
    
        // c being the hypotenus is always larger than a and b.
        // Lets Unitize the a and b elements
        a = a / c
        b = b / c
    
        // Assume the original point array is given in clockwise fashion
        a = -a
        b = -b
    
        // Even though a was calculated for diff of y, and b was calculated for diff of x
        // the new x is calculated using a and new y with b as this is what gives us the
        // perpendicular slope versus the slope of the given line
        xNew = xNew + a * amountPixelsToMoveLine
        yNew = yNew + b * amountPixelsToMoveLine
    
        // Integerize the point
        int xListAdd = (int)xNew
        int yListAdd = (int)yNew
    
        // Add the new point to the list
        AddPointToNewPointList(xListAdd, yListAdd)
    
    Delete the old point list
    

    Image of the geometry I am performing:
    Image of the Geometry I am algorithmically describing above

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

Sidebar

Related Questions

This Thread belong to this I am asking where do I need to insert
This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives
I almost found the answer to this question in this thread (samplebias's answer); however
This thread didn't helped me. If I use $class_vars = get_class_vars(get_class($this)); foreach ($class_vars as
Is this thread safe? private static bool close_thread_running = false; public static void StartBrowserCleaning()
Following this thread, I tried to upload a file on the server. If I
This question is based on this thread . Is [---] a comment in Git
This question is based on this thread . I am interested in how Git
This question is based on this thread . The code function man() { man
This question is based on this thread in Meta . I would like to

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.