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

Similar Messages

  • Want to draw some rectangles inside a swing panel object

    HI,
    I want to draw some rectangles inside one JPanel object in swing. The JPanel object should also hold some buttons, labels, etc.. I can add simple buttons, label etc. easily to the panel object but how do I add graphics (like lines, rectangles) to it ??
    an immediate response would be highly appreciated!!

    I am not sure why you are talking about the rectangle.
    To repeat I fill in a bit of code (subject to compiler errors since I Do not have a machine where I can compile or test on at the moment):
      private class ColourCube extends JPanel 
         // The size of each rectangle with colour
         private static final int ROWS = 10;
         private static final int COLS = 10;
         // To store current selection
         private int selectedIndex[] = null;
         public ColourCube()
             addMouseListener( new MouseAdapter() {
                public void mouseReleased(MouseEvent me)
                   // Find the rectangle index by dividing
                   // x and y positions then set selectedIndex
                   // unless it is the same positions as previous
                   // then set it to be null
                   fireActionEvent();
         // needed listener methods for firing events
         public void addActionListener( ActionListener al)
            // add to list
         // remove etc....
         protected void fireActionEvent()
            // Construct action event
            // call actionPerformed( ae ) on all listeners
         public void paintComponent(Graphics g)
             // Depending on size and height of this component
             // calculate out colWidth and rowHeight
             // Loop and paint the rectangles in their different colours
             for(int i = 0; i < ROWS; i++)
                for(int j = 0; j < COLS; j++)
                   // set the colour to the graphics object here from the list of colours available
                   g.setColor( ... );
                   // Added a little bit extra to have some space between
                   // each rectangle
                   g.fillRect( i * rowHeight + 1, j * colWidth + 1, colWidth - 2, rowHeight - 2 );
             if( selectedIndex != null )
                // We have a selection, lets paint the selection
                g.setColor( Color.white ); // Selection colour
                // The index contains the row in index 0 and the col in index 1
                g.drawRect( selectedIndex[0] * rowHeight, selectedIndex[1] * colWidth, colWidth, rowHeight );
      }Lacking from the above component is lacking stuff like preferedSize.
    Now, all you do is instantiate the ColourChooser, add it to your applet iether by drag and drop if you have an WYSIWYG editor, or by hand if you are so inclined.
    Voila! A composite component appears, doing the stuff it needs to be doing.
    Regards,
    Peter Norell

  • 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);

  • Drawing a rectangle inside a label with a picture

    Hi everyone,
    i want to know how you can draw a rectangle inside a label that have an iconimage
    thanks in advance,
    kimos

    It depends if you want it only to show on the GUI or really change the image inside the IconImage.
    If you just want it to show in your GUI, extend JLabel and implement paintComponent to draw a rectangle on top.
         JLabel label = new JLabel() {
              protected void paintComponent(Graphics g) {
                   super.paintComponent(g);
                   g.drawRect(x, y, width, height);
         };

  • Drawing a Box with many rectangles inside

    I've been trying to make an applet that has 100 equally defined rectangles going across. They will have different shades going from light to dark. This is what I have gotten so far:
    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Graphics2D.*;
    import java.awt.Rectangle;
    import java.awt.BasicStroke;
    import java.awt.Color;
    public class Flags3 extends Applet
         public Flags3()
         public void paint(Graphics g)
              int w = getWidth();
              int h = getHeight();
              int x = w-w;
              int y = h-h;
              Graphics2D g2 = (Graphics2D)g;
              System.out.println("Width:"+getWidth()+" Height: "+getHeight());
    int i;
    int grayy = 250;
              for ( i=1; i<100; i++)
                        Color newGrey = new Color(0,0,0,grayy);
                        g2.setColor(newGrey);
                        Rectangle bar = new Rectangle (x,(h/100)*i, w, (h/100)*i);
                        g2.fill(bar);
                        grayy = grayy - 6;
    }I want it to look like this but with 100 rectangles instead of the 5.
    http://img339.imageshack.us/my.php?image=boxxi9.jpg
    Why does the rgb values have 4 integers instead of 3? Also can anyone recommend a good java book for beginners.
    Thanks for the help.
    Message was edited by:
    ButcherBay
    Message was edited by:
    ButcherBay

    public class Flags3 extends JFrame {
        public Flags3() {
            setContentPane( new JPanel() {
                public void paintComponent(Graphics g) {
                    int w = getWidth();
                    int h = getHeight();
                    int x = 0;
                    int y = 0;
                    System.out.println("Width:"+getWidth()+" Height: "+getHeight());
                    for (int i=0; i<100; i++) {
                        Color newGrey = Color.getHSBColor(150, 0, i/100.0f);
                        g.setColor(newGrey);
                        g.fillRect(0, (h/100)*i, w, (h/100));
            Dimension size = new Dimension(800, 600);
            getContentPane().setPreferredSize(size);
            getContentPane().setMinimumSize(size);
            getContentPane().setMaximumSize(size);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            setVisible(true);
        public static void main(String[] args) {
            new Flags3();
    }I wrote this mainly to make sure I wasn't giving you bad info, but I also improved your paint method a little bit. It's a JFrame instead of a JApplet, so you'll have to make some changes, but it gives the full range of black to white (although it doesn't include full brightness white, the B value only goes to .99).

  • How to access a placed PDF inside a rectangle and move it around

    Hi, I have the following code which places a PDF inside a rectangle var f = new File("C:/pdf.pdf");    var doc = app.activeDocument;  var thepdf =doc.pages[0].rectangles[0].place(f, false);  doc.pages[0].rectangles[0].fit(FitOptions.FILL_PROPORTIONALLY);  Now I want to move "thepdf" (which is of object type PDF) but I can only find a way to move the rectangle around it. I need to move the inner rectangle (the PDF), like I would do with the Direct selection tool. is this possible?

    Yes. That's possible.
    The PDF placed inside the rectangle is the graphics[0] object of the rectangle.
    Or, if you look it up in the links collection, the parent of that link. The parent of that parent is the container object, the rectangle.
    myRectangle.graphics[0].move(/*insert your arguments here*/)
    Would move the PDF inside. Where the move() method could have different arguments:
    Adobe InDesign CS6 (8.0) Object Model JS: Graphic
    Uwe

  • Photoshop CC: Convert Rectangle to Rounded Rectangle?

    I saw that the Rounded Rectangle properties were not available on the regular rectangle (to change corner radius). Any way to convert it?

    I have the newest Everything.
    Adobe Photoshop Version: 14.0
    Operating System: Mac OS 10.8.4
    Properties panel for regular rectangle—not rounded rectangle: http://d.pr/i/XT8K
    I'm looking to easily convert to rounded without drawing a rounded one in place of the square one.

  • Check if a point lies inside a rectangle

    Hi im making an application that displays a shape on the screen at different locations. The shape is a combination of an ellipse and a line. My problem is when i want to draw the shapes i created a method to check if the point given is contained by any other shape and if it is it should create a new point. However when the .contains(Point) method is run it doesnt reply true or false so my code just goes into an infinite loop and crashes.
    Here is the checkpoint method that loops infintly
    private void setPoint(Point pow) {
              boolean anythingthere = false;
              while (anythingthere==!true) {
                   Rectangle test = list.getBounds();
                   if (test.contains(pow)) {
                        int f = pow.x;
                        f = f+200;
                        int g = pow.y;
                        pow.setLocation(f, g);
                        System.out.println(pow);
                        f = 0;
                   else {
                        if (pow.x+150 > getWidth()) {
                             pow.setLocation(50, pow.y+180);
                        anythingthere = true;
                        i++;
         }And because my shape is a combination of graphics2D shapes i created this method in its class to return the rectangle that bounds the shapepublic Rectangle getBounds() {
         bound = new Rectangle(location.x,location.y,size,size);
         return bound;
    }Thanks for any help you can give im really stumped!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi thanks for your reply's. Thanks for tips on making my code nicer and efficient ive tried to do it throughout my project so hopefully its more readable now. The problem was to do with scope like one of you said so i moved a few things round and got it working. The problem was when i called the bounds of the rectangle it was returning the bounds using the last changed point which meant that every time i tested the loop the point was inside that bound so it basically looped infinitely. One line moved and it worked perfectly.
    Thanks everyone

  • BUG: Rectangles inside FW symbols become blurry/misaligned

    There seems to be a problem with the use of Rectangles within Symbols in Fireworks CS6, CS5 and earlier.
    The problem is that they become blurry. More exactly, they become repositioned within the symbol—aligned to the half-pixel—and their edges become anti-aliased as a result. For example, here's a series of rectangles that I'd created on the canvas to visualize a set of color swatches:
    Here's the same set of rectangles after having been saved as a Symbol and imported into another document:
    At first I thought this was a problem with Symbols in general, but then I discovered that it only occurred with Rectangles—a.k.a. "rectangle primitives", which are a special kind of grouped vector object created using the Rectangle tool—and only when the contents of the Symbol in which they resided had a pixel width or height ending in an odd number (i.e., 1, 3, 5, 7 or 9).
    THE PROBLEM
    Here's what I've observed, in greater detail. Start with two Rectangles, 99 x 99 pixels—one with a stroke only, the other with a fill only. Select the first Rectangle and choose Modify > Symbol > Convert to Symbol, and then do the same for the second. Save the file. Everything looks OK, right?
    Now close the file, and reopen it. Have a look at the thumbnail previews within your Document Library. They look a little... fuzzy, yes?
    Click on the name of one of the symbols in the Document Library to open the Symbol Properties dialog, and then click OK. Now look on the canvas...
    Yikes. The symbol instance containing the stroked Rectangle (on the left) has become quite blurred. Now, back within the Document Library panel, click on the thumbnail preview of the other symbol to enter Edit Symbol mode, and then return to the document canvas...
    Yikes again. The symbol instance containing the fill Rectangle (on the right) has also become blurred—horizontally, in this case. They both look worse now.
    Note that it's not the instances nor their placement on the canvas that's the problem—you can move them anywhere on the canvas, and they'll still look just as bad—but the symbols themselves. Double click on one of the symbols to enter Edit Symbol mode and select the rectangle. Its X-Y position in the Properties panel will look normal, but if you open the Transform panel extension (http://www.senocular.com/fireworks/extensions/?entry=572), you'll see the real story: The rectangle has been re-aligned to the half-pixel.
    Importantly, the trigger here isn't the dimensions of the rectangle, per se, but of the symbol contents as a whole. If the symbol contents have an even-numbered dimension, alignment remains crisp and pixel-perfect along that dimension; if the symbol contents have an odd-numbered pixel dimension, a blurry misalignment occurs. For example, here's a series of "even" rectangles (20 x 20 pixels) that, with their single-pixel spacing, comprise an odd-numbered selection (125px), shown before and after symbol conversion:
    Incidentally, the same problem reveals itself when you import these symbols into another document using the Import Symbols command within the Document Library options menu.
    THE FIX
    The patch for this bug, once it's occurred, is to edit the symbol. In Edit Symbol mode, select all objects—or just the misaligned Rectangle objects—and choose Modify > Snap To Pixel.
    The fly in the ointment here is that, in many cases, the original alignment is not preserved. The rectangles may now be misaligned in relation to other objects in the symbol, as well as to other objects on the canvas. Therefore, to finish the job, you may need to also nudge the rectangle(s) by a pixel horizontally or vertically using the keyboard arrow keys.
    The good news is that once a symbol has been fixed using Snap To Pixel, its alignment and clarity should remain fixed.
    THE WORKAROUND
    The surest way to avoid this issue, of course, is to avoid including Rectangles in your symbols—not the geometric shape, but the grouped vector object as it's created by the Rectangle tool. Therefore, prior to converting a selection to a symbol, check for any Rectangles within the selection and ungroup them using the Modify > Ungroup command, which will convert them into simple paths, unaffected by this bug. (Chances are, by the time you're converting these objects to symbols, you won't need the fluid resizing or adjustable rounded corners that Rectangle objects offer; the trick will be remembering to perform this extra step.)
    THE BUG REPORT
    Lastly, here's the bug report that I submitted to Adobe regarding this issue:
    Product name: Fireworks
    Product Version: 12.0.0.236
    Product Language: English
    Your operating system: Mac OS 10.6.8
    ******BUG******
    Concise problem statement: Rectangles within Symbols become blurry if the width or height of the symbol contents is an odd number (e.g., 21, 23, 25, 27, 29, etc.). The blurriness is caused by misalignment of Rectangles on the half-pixel within the symbol, and becomes apparent upon closing and reopening the document and either a) viewing the symbol's Document Library thumbnail preview, or b) clicking to view Symbol Properties or to Edit Symbol. It can also be observed upon Importing the symbol into the Document Library of another document.
    Steps to reproduce bug:
    In an open FW document, draw a Rectangle and set the width and/or height to an odd number (e.g., 99 x 99 pixels).
    Select the Rectangle and Convert to Symbol.
    Save and close the document.
    Reopen the document. In the Document Library, double-click the symbol name to open the Symbol Properties dialog, and click OK. (Or double-click the symbol preview to Edit, and then return to the document canvas.)
    Results: The Symbol instance appears blurry on the canvas. (The Symbol itself also appears blurry within Edit mode.)
    Expected results: The Symbol should appear as it was originally created, without a loss of clarity or change in alignment.
    Note that this bug can occur whether a rectangle's dimensions are even or odd; the determining factor is the dimensions of the symbol contents as a whole. However, the bug affects Rectangles only; it has not been observed with paths, ellipses, auto shapes, bitmaps, or groups.
    The Transform panel extension was used to view the precise pixel alignment of objects and determine the cause of the blurriness.
    For more information, including graphic demonstrations and workarounds, please see the following forum post: http://forums.adobe.com/thread/1073489?tstart=0
    This bug has also been observed in Fireworks 8 and CS5 on Mac OS 10.6.8 (Snow Leopard).
    POSTSCRIPT
    Amazingly, this bug can also affect Symbol instances on the canvas that have been "broken apart". To see this for yourself, create a symbol like one of the preceding examples, select the symbol instance on the canvas and choose Modify > Symbol > Break Apart. Save and close the file, then reopen it. The "broken apart" instance on the canvas will now appear blurry/misaligned(!).

    Thanks, Petros_!
    That's good input. If this issue is important to you, consider submitting your own bug report. Feel free to copy and paste from mine, if it helps. (Just be sure to verify all results on your own setup first.)
    Whenever possible, I'm trying to post bug reports on this forum in addition to submitting them to Adobe. Partially, this is to allow me to include graphics or go into slightly more detail, and partially it's to make bug reporting more transparent—to raise awareness of known issues among fellow users and reduce duplication of effort, to create a record, and to increase public visibility of these issues. It also allows for corrections or additions to be made by myself or other users.
    However, it's not a true bug reporting system. So we don't know whether the Fireworks team has looked at this yet, whether it has been or will be assigned to someone, or whether your comment on this thread will be read by anyone on the Fireworks team.
    Nevertheless, it is quite an investment of time tracking down a bug and writing it up like this, so I appreciate the kudos!

  • Fast drawing of lots of rectangles, zoomable

    Hey all,
    I need to build a zoomable Canvas onto which I need to draw around half a million small rectangles. Ideally,
    it should be possible to zoom/pan into this canvas interactively, e.g. with low lag. The dimensions of the canvas
    are quite large, e.g. it will be about 0.5 billion units in height and a few hundred million units in width.
    A friend of mine recommended the use of OpenGL for this, but I am hoping that I can use some "standard"
    stuff to do this (and the Java2D pipeline is said to be OGL-accelerated nowadays anyways, right ?)
    Does anyone have any suggestions ? I don't mind looking at commercial components, too, if they are easily
    redistrbutable...

    ThomasDullien wrote:
    But the users is used to a lot of pain :-P...well, when it comes to inflicting pain on the users you can never do enough, which makes this even more interesting :-)
    Thinking about it again, I think it's not a good idea to draw the entire thing as a BufferedImage and them copy components...
    Memory consumption alone will be at least 0.5bn * a few million, e.g. more RAM than we have. This is correct, it will consume a huge amount of ram. You should, however, keep in mind that swing will internally double-buffer everything in order to provide smooth scrolling. You might need to turn it off for your JPanel using JPanel#setDoubleBuffered(false).
    I guess what I need is:
    A rectangle describing the entire area, a rectangle describing the sub-area that is currently visible, and the size (in pixels height/width) for
    the sub-area.
    Then, to draw, naive, without any optimiztions:
    Iterate through all rectangles
    calculate if the rectangle overlaps with the visible sub-area
    if no, next
    if yes, calculate the rectangle's pixel size, draw it
    Does that make sense so far ? Or was this what you meant when you said "mind the clip" ?Pretty much. As the previous poster pointed out, you can always ask a Graphics object for its clip bounds. It is a common mistake to assume that Graphics will do the clipping for you - well, it will, but at a much higher cost compared to you doing it manually. Still, considering the amount of rectangles, you might want to optimize your clipping routine rather than just iterating over millions of rectangles with each repaint. I'd suggest you use a technique usually used for collision detection (this is a grossly oversimplified view):
    Create an array of your rectangles and sort it by their x values. A rectangle will not be visible if its x value is larger than clip.x+clip.width, or if rectangle.x+rectangle.width is smaller than clip.x. Now, you can detect the last rectangle you need to consider using a binary search for clip.x+clip.width. All rectangles 'right' of this one in the array don't even have to be checked in the first place. Assuming that your rectangles are of equal width, you'll simply need to go 'left' while the rectangle you're looking at still fulfills the condition (rectangle.x+rectangle.width < clip.x). This will ideally give you a very small subset of rectangles to examine (you'll still have to check the y values, but you can apply the same approach here as well). Theoretically, this ought to be a lot faster than naive iteration.
    Cheers,
    ThomasGood luck :-)

  • All of the menus on my macbook pro how a question mark inside a rectangle.  It looks like unsupported characters.  How do I change it back to regular text?

    On my early-2011 MBP running Mavericks, all of the text of menus has turned into a question mark surrounded by a rectangle.  As a result, I cannot read any menus.  What do I do to change the character set the OS is using back to a normal charset?

    Startup in Safe Mode. http://support.apple.com/kb/PH14204
    If this does not help, reinstall OS X.
    Reinstall OS X  10.9 Mavericks
    http://support.apple.com/kb/PH13871

  • Aligning text horizontally inside a rectangle shape?

    I have text on top of a rectangle made with a shape layer. I now want to align the text in the center of the rectangle shape. I select both layers, though the option to align the text sometimes shows and other times does not. When it does show the horizontal option is greyed out. How is this done?
    Thanks.

    With the Move Tool selected and no Selection active it should be no problem, could you please post a screenshot with the pertinent Panels visible?

  • The letters on my desktop have been replaced with a's inside a rectangle

    All of the the letters on my desktop and top toolbar have now turned into the letter a inside a square. I cant read where it should say file, edit nor can i read the names of my programs or hards drives. Please help

    Welcome to Discussions - You may have pressed a key sequence that activates Universal Access. Go to System Preferences>Universal Access and make sure all the options are turned off.

  • How to get rid of red rectangle in gray rectangle cropping box?

    A little box has appeared on the right side of the preview screen. It has a small red rectangle in a larger gray rectangle. You can move around the red rectangle to crop the frame.
    The problem is, I don't want to crop the frame! How do I get rid of the red rectangle thing?
    I've tried the "crop" button and read the documentation about cropping but there's no mention of this red rectangle. I looked at the project settings and it looks good (1920x1080).

    Thomas Kehoe wrote:
    ... You can move around the red rectangle to crop the frame.
    no, you don't crop the video.
    It is just shown, when you set your preview window to a setting which doesn't 'fit'. Then, the red rectangle indicates which part of the whole frame you see; or, drag it to a part you like to see.
    Set your  Preview window to a smaller size (like '50%' or simply 'fit') = no red cross rectangle.
    for cropping, use the cropping tool

  • 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.

Maybe you are looking for