shapes

Offset shape within a ShapeDrawable

时间秒杀一切 提交于 2020-01-01 04:33:05
问题 I'm trying to draw a rounded rectangle with a border around it using a class that extends ShapeDrawable (see here) and everything is working except that the shapedrawable seems to be cutting off some of the border because the shape itself doesn't extend outside those bounds. Is there not some way to offset where the shapedrawable starts drawing so that there is some padding between the bounds of the shape itself and the canvas? I have tried both ShapeDrawable.setBounds to larger than the

Find the type of a shape

匆匆过客 提交于 2019-12-31 07:23:08
问题 I want to show all the shape types that i have in a powerpoint presentation. I tried with those codes: Private Sub CommandButton1_Click() Dim it As String Dim i As Integer Dim Ctr As Integer ''''''''''''''''' 'Read-only Long ''''''''''''''''' For Each slid In ActivePresentation.Slides For Each s In slid.Shapes 'No need to select the object in order to use it With s 'But it is easier to watch when the object is selected 'This next line is for demonstration purposes only. 'It is not necessary s

Nested shapes in Android

孤街浪徒 提交于 2019-12-30 07:31:36
问题 I am trying to draw a shape that has three rectangular shapes: solid color gradient white line How do I do that? When I try this, it does not work. The layout has the parent color. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:height="60px" > <shape android:shape="rectangle" android:height="30px" > <solid android:color="#ff297baf" /> </shape> <shape android:shape="rectangle" android:height="30px" > <gradient android:type="linear" android

VBA select shapes based on their positions

主宰稳场 提交于 2019-12-30 07:26:11
问题 How do I select all shapes (array? range?) where the value in Cell "A:Shape.TopLeftCell.Row" = 0 ? The Array should consist only Shapes 2 and 3 as per image above. 回答1: Just as an alternative, you can reverse the logic and select as you go, then assign the selection to a shaperange if required: Sub ShapePicker() Dim s As Shape Dim sr As ShapeRange Dim i As Long i = 1 For Each s In ActiveSheet.Shapes If Cells(s.TopLeftCell.Row, "A").Value = 0 Then s.Select (i = 1) i = i + 1 End If Next s Set

Resizing Path2D circle by clicking and dragging its outer edge

拟墨画扇 提交于 2019-12-29 08:25:12
问题 So, when I click and drag a Path2D circle on my JPanel, it is resizing. The problem is that when I initially click-and-drag it, the circle jumps to a smaller size, but then resized correctly as you click and drag. The easiest way to demonstrate is to run the runnable code below. I know I need to fix this code: @Override public void mouseDragged(MouseEvent e) { int mouseX = e.getX(); int mouseY = e.getY(); if (resizing) { System.out.println("resizing"); Rectangle bounds = shapes.get

Scaling/Translating a Shape to a given Rectangle using AffineTransform

夙愿已清 提交于 2019-12-28 03:10:54
问题 I'm trying to scale/translate a java.awt. Shape with AffineTransform in order to draw it in a defined bounding Rectangle. Moreover, I want to paint it in a drawing Area having a ' zoom ' parameter. I tried various concatenations of AffineTransform but I couldn't find the correct sequence. For example, the following solution was wrong: double zoom=(...);/* current zoom */ Rectangle2D viewRect=(...)/** the rectangle where we want to paint the shape */ Shape shape=(...)/* the original shape that

Filling Color in a hexagon in WPF

你离开我真会死。 提交于 2019-12-25 05:05:19
问题 I'm having problem in filling the hexagon using this code, when this code runs it draws only the outline of the hexagon that is "White", I want to fill the hexagon with a color but it is not working. I have searched a lot and tried many things like drawingContext.Drawing() , drawingBrush , etc. Am I missing something in this code? This is the code: public void DrawHexagon(DrawingContext drawingContext) { GeometryGroup hexaKey = new GeometryGroup(); //making lines for hexagon hexaKey.Children

Array Creation Stack overflow

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 04:12:21
问题 I'm getting an error where it would keep giving me a stack overflow. What I basically wanna do is create an Array List of objects that have rectangles. However, if any of the object overlap one another then, I would call the method again and create an array till it creates an array of objects that do not overlap. Can anyone tell me whats wrong? public class TokenArrayCreator { public final int TOKEN_WIDTH= 35; private GameToken token1; private ArrayList<GameToken> tokenarr; public

Java Swing mousePressed and getSource() not showing drawed shapes on JPanel

江枫思渺然 提交于 2019-12-25 02:09:07
问题 I am currently trying to develop a puzzle. All I got is my application with my playing-field and gaming-pieces. Next step is to click on one of my gaming-piece to select it and be able to move it with the arrow-keys (furthermore I want to them only to move, if the next step - which will be 100 pixels - does not contain any other gaming-piece). The problem I'm currently running into: Using addMouseListener() on my main JPanel and then using getSource() only returns my playing-field (called

overlapping partially transparent shapes in openGL

扶醉桌前 提交于 2019-12-25 01:14:47
问题 Please check this neat piece of code I found: glEnable(GL_LINE_SMOOTH); glColor4ub(0, 0, 0, 150); mmDrawCircle( ccp(100, 100), 20, 0, 50, NO); glLineWidth(40); ccDrawLine(ccp(100, 100), ccp(100 + 100, 100)); mmDrawCircle( ccp(100+100, 100), 20, 0, 50, NO); where mmDrawCircle and ccDrawLine just draws these shapes [FILLED] somehow... (ccp means a point with the given x, y coordinates respectively). My problem .... Yes, you guessed it, The line overlaps with the circle, and both are translucent