How to draw a border around a Textured Plane?

Hi everyone,
How does one go about drawing a square border around a textured square plane?
I've tried using the setBoundaryColor() method, and have set the texture2D's boundaryModeS and boundaryModeT to CLAMP, but no boundary color appears.
Can someone help?
Here are some fragments of my code:
/** My plane **/
QuadArray plane = new QuadArray(20, GeometryArray.COORDINATES
| GeometryArray.TEXTURE_COORDINATE_2
| GeometryArray.COLOR_3
          float length = 0.5f;
          float epsilon = 0.1f;
     Point3f p = new Point3f(-length/2.0f, length/2.0f, 0.0f);
plane.setCoordinate(0, p);
p.set(-length/2.0f, -length/2.0f, 0.0f);
plane.setCoordinate(1, p);
p.set(length/2.0f, -length/2.0f, 0.0f);
plane.setCoordinate(2, p);
p.set(length/2.0f, length/2.0f, 0.0f);
plane.setCoordinate(3, p);
     Point3f upperborder = new Point3f(-(length/2.0f+epsilon), length/2.0f+epsilon, 0.0f);
plane.setCoordinate(4, upperborder);
upperborder.set(-(length/2.0f+epsilon), length/2.0f, 0.0f);
plane.setCoordinate(5, upperborder);
upperborder.set((length/2.0f), length/2.0f, 0.0f);
plane.setCoordinate(6, upperborder);
upperborder.set((length/2.0f), length/2.0f+epsilon, 0.0f);
plane.setCoordinate(7, upperborder);
Point3f rightborder = new Point3f((length/2.0f), length/2.0f+epsilon, 0.0f);
plane.setCoordinate(8, rightborder);
rightborder.set((length/2.0f), -(length/2.0f), 0.0f);
plane.setCoordinate(9, rightborder);
rightborder.set((length/2.0f+epsilon), -(length/2.0f), 0.0f);
plane.setCoordinate(10, rightborder);
rightborder.set((length/2.0f+epsilon), length/2.0f+epsilon, 0.0f);
plane.setCoordinate(11, rightborder);
Point3f lowerborder = new Point3f(-(length/2.0f), -length/2.0f, 0.0f);
plane.setCoordinate(12, lowerborder);
lowerborder.set(-(length/2.0f), -(length/2.0f+epsilon), 0.0f);
plane.setCoordinate(13, lowerborder);
lowerborder.set((length/2.0f+epsilon), -(length/2.0f+epsilon), 0.0f);
plane.setCoordinate(14, lowerborder);
lowerborder.set((length/2.0f+epsilon), -length/2.0f, 0.0f);
plane.setCoordinate(15, lowerborder);
Point3f leftborder = new Point3f(-(length/2.0f+epsilon), length/2.0f, 0.0f);
plane.setCoordinate(16, leftborder);
leftborder.set(-(length/2.0f+epsilon), -(length/2.0f+epsilon), 0.0f);
plane.setCoordinate(17, leftborder);
leftborder.set(-(length/2.0f), -(length/2.0f+epsilon), 0.0f);
plane.setCoordinate(18, leftborder);
leftborder.set(-(length/2.0f), length/2.0f, 0.0f);
plane.setCoordinate(19, leftborder);
TexCoord2f q = new TexCoord2f(0.0f, 1.0f);
plane.setTextureCoordinate(0, 0, q);
q.set(0.0f, 0.0f);
plane.setTextureCoordinate(0, 1, q);
q.set(1.0f, 0.0f);
plane.setTextureCoordinate(0, 2, q);
q.set(1.0f, 1.0f);
plane.setTextureCoordinate(0, 3, q);
/** My Texture (using Appearance) **/
// can't use parameterless constuctor
Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight());
texture.setImage(0, image);
texture.setEnable(true);
texture.setMagFilter(Texture.NICEST);
texture.setBoundaryModeS(Texture.CLAMP_TO_BOUNDARY);
texture.setBoundaryModeT(Texture.CLAMP_TO_BOUNDARY);
texture.setBoundaryColor(new Color4f(1.0f, 0.0f, 0.0f, 0.0f));
planeAppearance.setTexture(texture);
Is there a better way to do it?
Thanks in advance for any help!

Do a control-A (select all). This should put a selection outline around your image. Then do an Edit-Stroke. Define your Width in pixels, Color, and then choose Inside. Set blending to whatever you want (Normal for a solid color) and then the Opacity.
Play with it. Have fun. Do NOT edit original images - always do an Image-Duplicate before doing edits until you know what you're doing. It is way too easy to make edits and then save that file over your original - losing the source file forever (unless you have a backup).

Similar Messages

  • How to draw a border around shape objects?

    How would I draw a border around something like an Ellipse2D object? I tried using using a BasicStroke in a sub-class of Ellipse but nothing showed.

    nvm, figured it out, I wasn't calling the draw method :)

  • How to draw a border around a TreeNode control?

    I have a TreeView that contains levels of TreeNodes. How do I draw borders around the text of the TreeNode? The TreeNode class does not accept a border style property. Assigning the property to TreeView only draws an outside window around the entire tree,
    not the individual nodes.

    Hi T.J.Fan,
    Sheng Jiang give a good suggestion, you could use the DrawNode event, I make an example for you.
    before you using this, you need to set DrawMode
    property to OwnerDrawText;
    private void treeView1_DrawNode(object sender, DrawTreeNodeEventArgs e)
    // Draw the background and node text for a selected node.
    if ((e.State & TreeNodeStates.Selected) != 0)
    Font nodeFont = e.Node.NodeFont;
    if (nodeFont == null) nodeFont = ((TreeView)sender).Font;
    Pen p = new Pen(Brushes.Red);
    e.Graphics.DrawRectangle(p, e.Node.Bounds);
    // Draw the node text.
    e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.White,
    Rectangle.Inflate(e.Bounds, 2, 0));
    // Use the default background and node text.
    else
    Font nodeFont = e.Node.NodeFont;
    if (nodeFont == null) nodeFont = ((TreeView)sender).Font;
    Pen p = new Pen(Brushes.Red);
    //draw border
    e.Graphics.DrawRectangle(p, e.Node.Bounds);
    // Draw the node text.
    e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.Black,
    Rectangle.Inflate(e.Bounds, 2, 0));
    // If the node has focus, draw the focus rectangle large, making
    // it large enough to include the text of the node tag, if present.
    if ((e.State & TreeNodeStates.Focused) != 0)
    using (Pen focusPen = new Pen(Color.Black))
    focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
    Rectangle focusBounds = e.Node.Bounds;
    focusBounds.Size = new Size(focusBounds.Width - 1,
    focusBounds.Height - 1);
    e.Graphics.DrawRectangle(focusPen, focusBounds);
    private void myTreeView_MouseDown(object sender, MouseEventArgs e)
    TreeNode clickedNode = treeView1.GetNodeAt(e.X, e.Y);
    if (clickedNode.Bounds.Contains(e.X, e.Y))
    treeView1.SelectedNode = clickedNode;
    #TreeView.DrawNode Event
    https://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.drawnode(v=vs.110).aspx
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to draw white border(only corner) lines around camera view finder

    Hi. You know those white corner lines around the camera view that is found on most camera apps, how do I draw those lines around the camera view? I'm developing a video camera app and now I want to draw those lines to indicate where the camera view finder
    is. The white line starts at the top left corner of the camera view(horizontal) then stops about one quarter and starts again at the other side(top right). The same at left, right and bottom side. It shouldn't be a full square/rectangle just the corners. I
    think you understand what I'm talking about now. How can I draw just "video camera corner lines"? After this question I want to ask you how to change the resolution like to 176*220, 240*320 ect and what the available resolutions is for capturing
    video-clips. For now just the white corner lines of camera view. Thanks in advance:-)

    How do I draw lines and shapes on top of the camera view finder(cvf)?
    +how do I show the battery life bar on cvf?
    +how do I programmatically add text on the cvf?
    +how do I make a connection request? (connect to a URL)?
    +how do I change the resolution of the video camera? What is the acceptable values for resolution?
    +how do I listen for touch events on the cvf?
    Thanks

  • How to add a Border around an ImageView

    Hi all,
    I'm adding a row of photos in my application which are being resized to fit into some constrained space with Preserve Ratio true. They are put in a TilePane, with a Label below each photo.
    Basically, I give all my ImageViews a fitHeight of 120 pixels, and let them determine how wide they will become themselves in order to preserve the ratio.
    It looks great.
    However, I would like to add a Border around these images, as they sometimes fade too much into the background to clearly see the edges. ImageViews themselves donot support borders, so I'm forced to wrap these ImageViews inside another container.... but, no matter what container I use, the container itself refuses to resize itself to fit exactly around the image -- it seems to be completely oblivious of the real size of the Image -- with some parameters the ImageView will simply render itself outside the edges of its container, and with other parameters the container is wider than the ImageView leaving a gap on the right side.
    This is yet another instance where I want my ImageViews to resize themselves to fit the available space, resulting in a huge struggle to force these components into their proper straight-jacket. Anyone got any solutions for this?

    I'm afraid that also won't work, as the Image needs to be scaled, and the dimensions you are using are from the unscaled image.
    I've however am now using this class to get what I want, together with a stylesheet to specify the border it works and I get nice borders.
    package hs.mediasystem.util;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.geometry.Bounds;
    import javafx.geometry.Insets;
    import javafx.geometry.Pos;
    import javafx.scene.Node;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.Region;
    import javafx.scene.layout.StackPane;
    public class ScaledImageView extends Region {
      private final ImageView imageView = new ImageView();
      private final StackPane effectRegion = new StackPane();
      private final ObjectProperty<Pos> alignment = new SimpleObjectProperty<>(Pos.TOP_LEFT);
      public ObjectProperty<Pos> alignmentProperty() { return alignment; }
      public final Pos getAlignment() { return this.alignment.get(); }
      public final void setAlignment(Pos pos) { this.alignment.set(pos); }
      public ScaledImageView(Node placeHolder) {
        getChildren().add(imageView);
        getChildren().add(effectRegion);
        getStyleClass().add("scaled-image-view");
        effectRegion.getStyleClass().add("image-view");
        if(placeHolder != null) {
          effectRegion.getChildren().add(placeHolder);
          placeHolder.getStyleClass().add("place-holder");
          placeHolder.visibleProperty().bind(imageView.imageProperty().isNull());
      public ScaledImageView() {
        this(null);
      @Override
      protected void layoutChildren() {
        Insets insets = effectRegion.getInsets();
        double insetsWidth = insets.getLeft() + insets.getRight();
        double insetsHeight = insets.getTop() + insets.getBottom();
        imageView.setFitWidth(getWidth() - insetsWidth);
        imageView.setFitHeight(getHeight() - insetsHeight);
        layoutInArea(imageView, insets.getLeft(), insets.getTop(), getWidth() - insetsWidth, getHeight() - insetsHeight, 0, alignment.get().getHpos(), alignment.get().getVpos());
        Bounds bounds = imageView.getLayoutBounds();
        effectRegion.setMinWidth(bounds.getWidth() + insetsWidth);
        effectRegion.setMinHeight(bounds.getHeight() + insetsHeight);
        effectRegion.setMaxWidth(bounds.getWidth() + insetsWidth);
        effectRegion.setMaxHeight(bounds.getHeight() + insetsHeight);
        layoutInArea(effectRegion,  0, 0, getWidth(), getHeight(), 0, alignment.get().getHpos(), alignment.get().getVpos());
      @Override
      protected double computePrefWidth(double height) {
        return 0;
      @Override
      protected double computePrefHeight(double width) {
        return 0;
      public final ObjectProperty<Image> imageProperty() { return imageView.imageProperty(); }
      public final Image getImage() { return imageView.getImage(); }
      public final void setImage(Image image) { imageView.setImage(image); }
      public final BooleanProperty preserveRatioProperty() { return imageView.preserveRatioProperty(); }
      public final boolean isPreserveRatio() { return imageView.isPreserveRatio(); }
      public final void setPreserveRatio(boolean preserveRatio) { imageView.setPreserveRatio(preserveRatio); }
      public final BooleanProperty smoothProperty() { return imageView.smoothProperty(); }
      public final boolean isSmooth() { return imageView.isSmooth(); }
      public final void setSmooth(boolean smooth) { imageView.setSmooth(smooth); }
    }

  • How to remove black border around image files?

    I'm something of a beginner with Photoshop, so forgive me if I've missed something entirely obvious: for some strange reason I'm now getting a black border around all image files that I save through the "Save for Web & Devices" panel. Does anyone know how I can save without creating this border? It looks rather unsightly when I load it into a client site. The file in question is a .png, but I seem to be getting the same effect with all other image files as well.
    Thanks in advance,
    Shane

    One cause could be having the matte color set to something other than none.
    Is that a png-8?
    MTSTUNER

  • How to get a border around several components in GridBagLayout

    I have several buttons in a 16 x 12 matrix using GridBagLayout manager
    Now I want to have a border around buttons 1/1 to 6/6 and another border around 1/7 to 8/6
    and another border around 1/9 to 16/6. How can I do this ?

    I usually create JPanels for each group, with their own LayoutManager. Adding a [ border to a JPanel is fairly staight forward|http://java.sun.com/docs/books/tutorial/uiswing/components/border.html] . To put thing together, I add instances of those JPanels to a top level JPanel in some frame or window.

  • How to create a border around JCheckBox?

    Hello,
    I would like to set a border around a JCheckBox. I don't mean the little square arround the check symbol, I mean the whole component. Does anyone know how to do this?
    More details:
    What I am trying to do is to use a JCheckBox as the renderer for a column in a JTable. However, I would like the values of this column to look like the column headers. In other words, I am trying to create a "row header". However, when I try to set the border of my JCheckBox to the same thing as the header renderer component, it doesn't show up that way. If I just use a JLabel as the renderer, I can set the border and it shows.
    Does anyone have a suggestion? Thank you for your help.

    yourCheckBox.setBorderPainted(true);

  • I have never used my mac for desktop publishing before and am having some problems.  This sounds really dumb, but I can't figure out how to put a border around a text box.  Also, how do you edit the border, i.e. border color, thickness, etc. Help!

    I have never used my mac for desktop publishing before and am running into some real problems.  How do you put a border around a text box?  Can you edit the border - color, thickness, etc.?  Help!

    I think the best solution is to read Pages documentation, go to Help and you have a long list of options. Pages is capable of quite sophisticated things, some features are above Nisus or Mellel, so it is not so simple to summarize things in a few lines.

  • How to make a border around text?

    In my latest FCE project, I made a solid color matte clip (dark blue) to set below my titles to give the text a colored background (these titles are not overlaid on video clips, so without the colored matte, the background would be the default black of the Timeline, and I don't want black).
    Anyway, so here I have this nice white text overlaid on a dark blue background, looking pretty good, and now I'd like to put a decorative rectangular white border around the text, a thin white line, or a maybe a double white line, sort of like a pinstripe, to elegantly (I hope) enclose the text in a sort of box.
    What would be the best way to create such a border? Could I make one on a transparent layer in Photoshop (I have CS-2,) and then import it into FCE as a clip to set the text above? Or is there a simpler way to do it, within FCE?
    Any suggestions would be welcome.
    Tom

    The only option I see on that PieroF webpage is to download it as a .zip file. When I download it and double-click on the icon, I get that zoom-out effect like it's opening, but it doesn't open. Dropping its icon onto the Stuffit icons doesn't do anything either.
    Anyway, I just experimented with masking off a colored matte in the way you mentioned, and I think I see how to do it: create a color matte and then lay two masks on top of it, an inner one and an (inverted) outer one, which leaves only a thin line of the color matte still showing. Is that it? For a double pinstripe, I suppose I would do that twice, i.e. create two masked-off mattes, one a little larger than the other, and stack them up on the video tracks?
    It's more trouble than the Piero frame generator, no doubt, but effective. Thanks!
    Tom B.

  • How to add white border around my Banner?

    Hello,
    I am trying to add a small border around my banner.
    I tried to code it in but it didnt seem to work. Not sure why?
    So i added just without the border.
    Any thoughts?
    Thank you!
    Ivan
    Here is the URL - http://www.the-electronic-cigarette.net

    Your header is defined as an id in style.css
    So, in your CSS:
    #branding {
              background: #ffffff url(images/sky.png) top left repeat-x;
              margin-bottom: -20px;
    Change to:
    #branding {
              border-color: fff;
      border-width: 3px;
              margin-bottom: -20px;
    That will create a 3 pixel border around the div.

  • How to make a border around a pic-in-pic?

    I use adobe premiere pro cs3. What is tehe best (and hopefully an easy way) to create a border around a pic-in-pic movie. Is it correct that I can't find an option for that? I make this kind of things now by placing the second clip in track video-2 en then changing the size. But there is no option then in wich i can specify the thickness and the color of a border.

    Use a color matte on track 2 and your PIP on track 3. Size both to your liking, for instance track 2 sized to 50% and track 3 to 45%. The difference in size determines the border width, the color of the matte is your border color. Start with the color matte using motion/scale/position, then copy and paste attributes to track 3 and scale this further down to create the desired border width.

  • How to achieve black border around a logo

    Hello,
    I am trying to do a parody of a Top Gun logo and have it done except for the border around the image. I know this is probably very simple and I've googled it but can't figured it out.
    Here is an example:
    http://www.redbubble.com/people/tgigreeny/works/7360099-top-gun-sundown-with-tomcat
    I want to create that black border/background colour and can't figure it out.
    Thanks for any help you can offer.
    Mary

    Well actually it is a bit more complex than I wrote
    1 You have to outline the text and
    2. united it with the art (color bars that hbe the same color)
    3. you have to give the object a stroke and drag it below the fill in the appearance panel
    4 the jet plane needs a fill of white
    5. the star needs a stroke with the stroke being draged below the fill in the appearaqnce panel
    6. then you group everything and give the group a sufficent weight stroke cover all the gaps
    7 and finally you drag the stroke you gave the group below the contents in the appearance panel (that means it is behind the groups contents the logo art.
    Like such ( You have to think this one out.)

  • Ask - how to draw diagonal border on XMLPublisher report?

    Hi all,
    I need to draw diagonal border on my XML Publisher report.
    xsl attributes I tried are:
    <xsl:attribute xdofo:ctx="block" name="border-diagonal">1pt solid #000005</xsl:attribute>
    <xsl:attribute xdofo:ctx="block" name="border-diagonaldown">1pt solid #000005</xsl:attribute>
    <xsl:attribute xdofo:ctx="block" name="border-diagonalup">1pt solid #000005</xsl:attribute>
    <xsl:attribute xdofo:ctx="block" name="tl2br">1pt solid #000005</xsl:attribute>
    but no one has effected
    can anyone help me this issue?

    The solution is AHformater, but it's have lisence.
    Another is use a picture on template, and caculate shape-offset-x, y, and size-y.
    I don't know why xmlp not support show diagonal border.

  • How to put a border around locked text boxes?

    I have a number of locked text boxes. I need to place a border (a box) around them. How do I do that?

    Govan,
    1. It's helpful to give a full and complete description of your problem when first posting in order to get a complete answer and avoid follow up posts.
    2. There's no need post the same answer twice.
    My answer: The stroke/line around a text box is all or nothing. If you want to eliminate the line between adjacent text boxes you'll have to draw a white line over the offending line to cover it up. Once this is done, select both text boxes and the line (using shift-click or command-click) open the Arrange menu and choose Group (or press Option-Command-G). This will keep the white line in place if the text boxes move.
    Good luck,
    Terry

Maybe you are looking for

  • Download paused

    I prepurchased a book.  I received notification that it was available and attempted to download it.  It is now permanently paused in my library and won't budge.  I did manage to download it on my phone. 

  • How to call C++ module in Java? Can I do it?

    Any expert know it, please tell me. Thanks! I can make the C++ module into a dll, but how can I call it in Java........... :(

  • Cannot download, but Safari Can

    the website: teamaloha.info has files that can be downloaded, however firefox was unable to download them and safari could. I control-clicked (I'm on a Mac) and on firefox, there was no option to save the file, on Safari, I could. In the past, I coul

  • Loss of speaker setup choice with 5.12.4.1196/2.09.7540 driv

    After updating I can't seem to switch out of 2/2. Speakers. Pressing the button has no effect and makes no sound. Previous drivers allowed me to use headphones, 4/4. and so on, but the latest AudioHQ/Creative Surround Mixer 2 will not. What are the p

  • Data in AdvanceDdataGrid not changed

    Hello all, I have really weird problem, I think it's related to datprovider or something similar. I have data grid in ac class (as attribute of this class), in the main app, I was import that class and create new instance, and create ArrayCollection