Using basicStroke to draw the INSIDE of a polygon

hello
i have a polygon that i want to trace the inside of... using:
g2.setStroke( new BasicStroke( 20, //float width,
BasicStroke.CAP_SQUARE, //int cap,
BasicStroke.JOIN_MITER,
1,
new float[] { 12, 12 },
1
g2.draw( myRect );
this code traces the shape "on the line", and since the stroke width is 20 pixels, it is painting both inside and outside of the shape itself.
i would like to trace the inside of the shape. or for that matter, the outside of the shape...
any ideas?
thanks
ERIK!

First draw the shape using g.fill() and a
non-transparent color. Then set an alpha composite
with the rule SRC_IN, and redraw the shape using the
desired stroke. Only the part of the stroke inside
the filled area will be drawn. Use SRC_OUT to draw
outside the shape. If you're drawing on top of
existing graphics, you may have to use a BufferedImage
as a temporary work area to composite the shape and
then draw the image to your graphics context.thanks for the suggestion, although i believe that this will not render the outer edge of the stroke as intended...
what i mean is, where you use the shape itself to mask the stroke, it will leave a not-as-pretty edge as you would get if from an un-masked basic stroke.
thanks for the two suggestions though.

Similar Messages

  • Can you use apple watch on the inside wrist?

    I Am wondering if you can use Apple watch on the inside wrist Instead of facing outwards, it's just the way I've always worn a watch, and wondering if I have to change?

    Boy loz wrote:
    I Am wondering if you can use Apple watch on the inside wrist Instead of facing outwards, it's just the way I've always worn a watch, and wondering if I have to change?
    The manual says that the heart rate monitoring wouldn't be as accurate if worn on the inside. However, other people have posted that it works fine.
    Both my mother and my brother have always worn watches on the inside of their wrists. I've never figured out how they (and you) don't bang them up on desks and edges of keyboards. But I'm sure it would be as annoying to you to change to wearing a watch on the outside as it would be for me to change to the inside.

  • Getting rid of white halos in the inside of a drawing in CS5?

    I'm starting a comic soon, and I need to know how to get rid of the white halos in the inside of a drawing, as seen here:
    http://www.ezimba.com/work/140106C/ezimba19677819330300.png this is just a sample image.
    The original size of the image is 4000px in width, but resized to 700px.
    I tried defringing, white matte removing, and tried to resize the image to get better results. Nothing happened. I need help before tomorrow, and I would like to get this done ASAP without using separate layers. Any help is appreciated.

    I was going to add that Aaron Johnson is not too fussy about filling to outlines in his What the Duck cartoons, but the first example I found doesn't have much of a 'halo'.  It is, however, appropriate to this site, so I'll use it anyway.
    A wee bit more visible here, but you have to upsize them before it becomes very visible.
    Aaron allows the strip to be published in not for profit sites etc. and I use it in the camera club newsletter I edit.  Or should say, used to edit, because I have been doing for five years now, and have decided someone else can have a turn.

  • I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    Hi
    The value of the Channel Strip volume etc is not stored within the C Strip setting, as you have discovered.
    If you really wanted, you could add a Gain plug to the strip, with it set to give the correct output level with the Fader set to 0
    (Or just set the fader manually in MS)
    CCT

  • How do I set up pages to print a 5x7 catalog using doubled sided printing. When I try this layout the inside pages are upside down?

    I am trying to print a 5 x7 catalog. When I print it out using doubled sided the inside pages are upside down. Is there a way to setup and print using a 5x7 format?

    If your printer does duplex printing (i.e. you're not re-feeding the pages manually), there may be a setting in the print dialog. My Brother color laser has these option when I check the two-sided box. If you see something similar, test the various options & make a note of what works. It took me so many tries to figure out what they meant by long- or short-edge binding!
    If you're using something like CocoaBooklet or another program to create a booklet, see if it has an option to turn the second side upside down.

  • Convert my dynamic Drawing (created in a Flash Dialog using AS 3) into the .DXF and .DWG form

    Hi ,
    I want to convert my dynamic Drawing (that I created in a Flash Dialog using AS 3) into the .DXF and .DWG format.Is there any way by which I can give the export functionality on the flash page so that the dynamic drawing that created in flash code will export into .DXF and .DWG format.
    Please Help
    Thanks,
    Simon

    There's no automatic way to convert to AutoCAD formats... you will need to write your own. You will need to figure out the formats of .dxf and .dwg and then probably use ByteArray to output. It will not be a trivial task.
    Hi,
    Can you please give me some example for this?
    I have used AlivePDF to convert my Diagram to PDF but it create a Raster image in PDF and all vector data is lost.
    I want to convert this PDF to .dxf and .dwg format using any tool. but not found any way around.
    Thanks!!

  • LG enV3 First letter always defaults to lowercase when texting using the inside full keyboard

    LG enV3 First letter always defaults to lowercase when texting using the inside full keyboard...yet works fine on outside keypad. I have the settings set up properly on the phone to Abc. Even if I change to all caps, it only affects the outside keypad on front of phone, and not the full inside keyboard when flipped open. SW version is VX920V02. I have tried resetting phone, yet did nothing.
    Any help is appreciated!

        Hi jjm12345!
    Let's look into this! When did the issue begin? When you press shift, does the letter change to uppercase?
    Thanks,
    AyaniB_VZW
    Follow us on Twitter @VZWSupport

  • How to draw the circle diagram of induction motor using labview

    hi
      i am trying to model the  electrical machines using labview..
    i want to know that is it possible to draw the circle diagram of induction motor using labview..........
    if its possible then please suggest me the possible ways.
                                                                                         thanks

    There may be better ways, but the method I used was to convert amplitude & angle to rectangular coords, then create an XY plot from (0,0) to those coords.  (Or 1 plot for Voltage, 1 for Current, etc.)  I would then just keep updating this plot and feeding it to the graph in a loop.  The result was a slightly choppy looking but useable animation of the phase vectors.
    -Kevin P.

  • Yesterday I used my iphone in the rain.  I think some water must have got inside.  Now the phone seems to be working OK but is not backlit so is incredibly hard to read.  Is there anything I can do to reset or have I ruined the phone?

    Yesterday I used my iphone in the rain.  I think some water must have got inside.  Now the phone seems to be working OK but is not backlit so is incredibly hard to read.  Is there anything I can do to reset or have I ruined the phone?

    What you should have done is immediately turn the phone off, then put it in a ziploc bag of dried rice after you wiped all visible moisture off the phone. Leave it in the ziploc bag for 3 ~ 4 days, then turn it on & hope things work OK. It may be too late to try the dry rice trick now, but you can give it a shot if you like.
    Apple does have an out of warranty replacement program, cost in the US is $199 for the 4S & $149 for other models.

  • Drag and Drop inside JTable: what draws the 'insert' line during the drag?

    I'm trying to reconfigure a rather complex table with a fair number of custom renderers to include drag & drop of rows for resorting the table. Everything is working great, except that as I drag the rows there is no indication of the current insert point (i.e. the line that appears between rows). When I make a simpler table I see the line... I'm not sure what aspect of my current table is blocking this function. I'm writing in the hope that can someone can direct me to the method(s) responsible for drawing this line.
    Thanks!

    To elaborate a bit for anyone who might read this. I inquired with the Substance developers and they hope to support this feature in v5.1 (which requires SE6), but have no plans to update v4.3 (the last release before a switch to SE6).
    Also, I'd still be grateful for any info pointing me to the Swing methods that draw the drag line.

  • Drawing character inside rectangle

    Hi!
    I have the following problem. I have a string and my task is to be able to draw every character of the string in every rectangle. For example I have a string:
    String = ("GCATCGCAGAGAGT");
    So now I will have 14 characters inside 14 rectangles. My question is how to do that? Please help me to solve it.

    This is my code. There's still error in it. It can not show the rectangle and also the characters. Could you fix my code? I am still a beginner in this field
    I am sorry if my code is not formatted as well, because I am a new comer in this forum. So please help me to solve my problem, I expecting a lot from you.
    /** Here is my code **/
    package brute_force;
    import javax.swing.*;
    import javax.swing.border.Border;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    * BorderLayoutDemo.java
    public class BruteForceAnimation4 extends JPanel{
              /** Variable for drawing character inside rectangle **/
              private String[] mSourceString = {"G","C","A","T","C","G","C","A","G","A","G","A","G","T"};
              private String[] mPatternString = {"G","C","A","G","A","G","A","G"};
              /** This is variables to draw the rectangle **/
              private int xPosSource = 40;
              private int yPosSource = 100;
              private int xPosPattern = 80;
              private int yPosPattern = 80;
         /** constants for predefined colors */
         private static final Color lightBlue = new Color(153, 204, 255);
         public BruteForceAnimation4()
         super();
         public static void addComponentsToPane(Container pane) {
         JLabel lblTitle = new JLabel("Brute Force String Searching
    Algorithm", SwingConstants.CENTER);
         String bruteForceCode[] = {
         "int count = 0", //0
         "int m = mPattern.length();", //1
         "int n = mSource .length();", //2
         "outer:", //3
         " for (int i = 0; i <= n - m; ++i) {", //4
         " for (int k = 0; k < m; ++k) {", //5
         " if (mPattern.charAt(k) != mSource.charAt(i + k)) {", //6
         " continue outer;", //7
         " }", //8
         " }", //9
         " ++count;", //10
         " }", //11
         " return count;", //12
         "}" //13
         JList list = new JList(bruteForceCode); // a container for pseud code
         JButton cmdRun = new JButton("Run");
         JButton cmdStep = new JButton("Step");
         //Set the title of the applet
         lblTitle.setFont(new Font("Serif", Font.BOLD, 18));
         JPanel buttons = new JPanel();
         buttons.add(cmdRun);
         buttons.add(cmdStep);
         buttons.setBackground(lightBlue);
         //Set the size and border of list (JList component)
         Border etch = BorderFactory.createEtchedBorder();
         list.setBorder(BorderFactory.createTitledBorder(etch, "Brute Force
    Code"));
         JPanel listPanel = new JPanel();
         listPanel.add(list);
         listPanel.setBackground(lightBlue);
         list.setBackground(lightBlue);
         BruteForceAnimation4 border = new BruteForceAnimation4();
              pane.add(lblTitle, BorderLayout.NORTH);
         pane.add(border, BorderLayout.CENTER);
         pane.add(listPanel, BorderLayout.EAST);
         pane.add(buttons, BorderLayout.SOUTH);
         pane.setBackground(lightBlue);
         public void paintComponent(Graphics g)
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D) g;
         setBackground(lightBlue);
         drawSourceString(g2, mSourceString);          
    /** this is the method to draw character inside rectangles **/
    /** but it still wrong **/
         public void drawSourceString(Graphics2D g2,String[] mSource)
              if (mSource == null)
                   return;
              for (int i=0; i < mSource.length; i++)
                   g2.drawRect(xPosSource, yPosSource, 60, 40);
                   g2.drawString(mSource,40,40);                              
                   xPosSource += 30;
    //This is to count the length of the the Source
                   System.out.println("Your length" +mSource.length);
         public static void main(String[] args) {
         //Create and set up the window.
         JFrame frame = new JFrame("Brute Force Algorithm");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Set up the content pane.
         addComponentsToPane(frame.getContentPane());
         //Use the content pane's default BorderLayout. No need for
         //setLayout(new BorderLayout());
         //Display the window.
         frame.pack();
              frame.setSize(800, 600);
         frame.setVisible(true);

  • MFC: Draw rectangle inside a rectangle

    Hi,
    I have drawn a rectangle:
    dc.Rectangle(10,10,200,100);
    Now i want to draw rectangle inside it by reducing 10 from each side. i.e the new rectangle will be: CRect(20,20,190,90).
    I am manually adjusting the co-ordinate, Is there any API to do this.
    offsetRect() is not solving my issue.
    Thanks

    Hi,
    I have drawn a rectangle:
    dc.Rectangle(10,10,200,100);
    Now i want to draw rectangle inside it by reducing 10 from each side. i.e the new rectangle will be: CRect(20,20,190,90).
    I am manually adjusting the co-ordinate, Is there any API to do this.
    offsetRect() is not solving my issue.
    Thanks
    Just write yourself a function and use it as needed. Programming is not manual work; the computer does the heavy lifting.
    Edit: Actually, I think CRect::DeflateRect() does what you want.
    David Wilkinson | Visual C++ MVP

  • Can I use a photo as the color for my text swatches

    I want to create a set of letters (Lake in Wood Camping Resort) that use a photo of the campground as their swatch, instead of a solid color.  Can I do this?  If yes, how?  I am a novice at INDESIGN so need all the help I can get.
    My thought would be to place text over the photo, using a large open font, that only shows stroke, no color in the swatch.  So you could "see thru the Letters into the campground)  then, delete the photo but still have the font contain the colors of the photo.  Am I dreaming or is this possible?  I have fiddled around with it but to no avail.  Thanks for any advice, recommendations, Cathy

    There was a good discussion about this in ID forum
    1. Place image
    2. Draw white box to cover image
    3. Place text on top
    4. Set opacity of text (effects panel) to 0. Text dissapears
    5. Group with white box from step 2
    6. With group selected choose Knock Out Group (effects panel)
    This preserves live text.

  • I have a new BB and the mail accounts i used to have in the old one doesnt work!!

    Hello!!!
    2 weeks ago someone stole my BB curve 8520.
    I reporte the robe to the mobile company and to the assurance.
    Since 4 days i have a new BB (curve 9300), with other company in other country.
    Im trying to vinculate my mail accounts (the ones i used to have in the old one) to the new BB and it doesnt let me, it shows me a message telling me im putting the wrong mail or password.
    I tryed to vinculate a new account that i didnt use in the old BB, and there was no problem.
    So i dont know how to desactivate the vinculation of my mail accounts from the old BB for being able to use them in the new one.
    Thanks,
    Karura ^_^

    Note to all -- duplicate...follow thread here:
    http://supportforums.blackberry.com/t5/BlackBerry-Curve-3G-BlackBerry/Change-of-BB-and-the-mail-acco...
    @karura -- please mark this thread as solved and use only one thread for this issue.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • HT201250 i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. do i keep my files in the portable hard disk when I connect it again with the macbook or the time machine will era

    i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. Am i keeping my files in the portable hard disk when I will connect it again with the macbook or the time machine will erase all?
    I would like to know if after I erase all my data, empy hard drive inside the macbook, the time machine will erase all my files that I have saved in my "WD "My passport" external hard drive

    Welcome to Apple Support Communities
    Time Machine has to erase the external disk in order to make backups. Before setting Time Machine up, copy the files of your external disk to the hard disk of the Mac in order not to lose them, and then, set up Time Machine. The first backup will start automatically.
    If you want more information about Time Machine, read the Pondini's site > http://pondini.org

Maybe you are looking for

  • MIRO: debito posterior em conta de razão

    Prezados experts, eu tem um pequenho problema na miro na hora de fazer um  :'(, O que acontece na hora de inserir os dados nas telas  da MIRO como debito posterior em conta de razão o sistema calcula os valores dos impostos corretamente como se o val

  • BSOD, STOP 0xc0000034

    This happened after a failed overclock. I got the initial BSOD for a failed overclock, reset the CMOS, and then rebooted and Windows started to load then went to a black screen. After waiting for about 10 minutes I decided to force a restart. That's

  • How to export data from a string to a CSV file

    Hello, i do have a string in a Livecycle Designer script object with a couple of rows with different entries divided by a semicolon: COLUMN1;COLUMN2;COLUMN3 Entry1;Entry2;Entry3 Entry4;Entry5;Entry6 The goal is now to export this string from Livecycl

  • Finder crashes when right clicking on desktop

    Hi there On my new Mac Pro 8-core with Mac OS X Server 10.4.9 and now also on 10.4.10, the Finder crashes occasionally when I right-click on the desktop, on a file on the desktop, or on a folder on the desktop. Here is the crash log: Host Name: BigMa

  • Can I have an application load on startup in osx 10.7.5

    I have a macbook pro running osx 10.7.5   On old systems I used to be able to put applications in a startup folder so that they would launch automatically on startup - or at least I think I did.  I can't see a way of doing that now.  Can anyone help.