drawing2d

Merge an image, a background and Text into a single image

与世无争的帅哥 提交于 2020-01-06 15:08:06
问题 I found this code here: Private _BackgroundColours As New List(Of String)() From { _ "339966", _ "3366CC", _ "CC33FF", _ "FF5050" _ } Public Function GenerateRactangle(firstName As String, lastName As String) As MemoryStream Dim imgSize() As Integer = {800, 800} Dim avatarString As String = String.Format("{0}{1}", firstName(0), lastName(0)).ToUpper() Dim bgColour = _BackgroundColours(New Random().[Next](0, _BackgroundColours.Count - 1)) Dim bmp As Bitmap = New Bitmap(imgSize(0), imgSize(1))

How to drawing a path with a bitmap?

ぃ、小莉子 提交于 2020-01-01 05:02:30
问题 I have a little drawing app and want to use "complex" shapes as brushes, i.e. a star. Drawing with a simple brush already works with this code: remotePath.reset(); remotePath.moveTo(start_x, start_y); float dx = Math.abs(end_x - start_x); float dy = Math.abs(end_y - start_y); if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) { remotePath.quadTo(start_x, start_y, (end_x + start_x) / 2, (end_y + start_y) / 2); } remotePath.lineTo(end_x, end_y); // commit the path to our offscreen mCanvas

.NET - Border around resized imaged

本秂侑毒 提交于 2019-12-10 13:45:54
问题 I'm trying to resize an image in .NET, but get a faint black border around the resized image. I found a post - http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/cf765094-c8c1-4991-a1f3-cecdbd07ee15/ which from someone who said making the destination rectangle larger than the canvas worked, but this doesn't work for me. It gets riid of the top and left borders, but the right and bottom are still there, and are a full 1px thick black. Am I missing something? My code is below.

set position for drawing binary tree

假装没事ソ 提交于 2019-12-09 07:13:24
问题 I want to drawing a binary tree with an graphical framework(Qt) like this: 9 / \ 1 10 / \ \ 0 5 11 / / \ -1 2 6 but I have a problem to set X and Y for every node, do you any idea to setting and fixation position ? (I have only height of every node and left-Child and right-Child) 回答1: Given the width canvasWidth and the height canvasHeight of the canvas you can calculate position of each node. First, let's assign two numbers to each node: the depth of the node and a serial index of the node

Draw Path with zoom and darg

江枫思渺然 提交于 2019-12-08 04:06:53
问题 'm developing an application in which I'm pasting images, doing drawing and painting on canvas. This app can also Scale up/down the canvas or drag it to different location. My problem is: I can't get the correct canvas coordinates after scaling or dragging the canvas. I want to draw finger paint after the canvas is scaled or dragged but unable to retrieve the right place where i've touched... @Override public boolean onTouchEvent(MotionEvent event) { scaleListener.onTouchEvent(event);

paint() method would not draw on JPanel

落花浮王杯 提交于 2019-12-04 05:49:13
问题 I tried few source codes of drawing in java and they were working fine, but when i tried to make one of my own I could not get the paint(Grahpics g) method to work! I looked again at the codes I have and checked some of the tutorials in Oracle's pages but i don't seem to be able to know why it would not work. can someone please check it and tell me what is wrong here?? main method: public class main { public static void main(String[] args) { new board(); } } board: import java.awt

How to drawing a path with a bitmap?

戏子无情 提交于 2019-12-03 13:38:26
I have a little drawing app and want to use "complex" shapes as brushes, i.e. a star. Drawing with a simple brush already works with this code: remotePath.reset(); remotePath.moveTo(start_x, start_y); float dx = Math.abs(end_x - start_x); float dy = Math.abs(end_y - start_y); if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) { remotePath.quadTo(start_x, start_y, (end_x + start_x) / 2, (end_y + start_y) / 2); } remotePath.lineTo(end_x, end_y); // commit the path to our offscreen mCanvas.drawPath(remotePath, remotePaint); // kill this so we don't double draw remotePath.reset(); invalidate(); I

Android Draw 9-patch tool: What is the meaning of black lines outside the figure

[亡魂溺海] 提交于 2019-12-03 07:20:29
问题 I tried enough to find in google & android this question. Also did several trials & errors, but couldn't get this question. I was learning Android's "Draw Nine Patch" images. One basic I know is that, whatever image you process must be in .png format (if it's already in .9.png then it will be ignored by tool). However, I couldn't understand what it literally means by "stretchable patches" ? What exactly happens when you draw black dots outside the .png image ? (preview pane shows changes

Android Draw 9-patch tool: What is the meaning of black lines outside the figure

核能气质少年 提交于 2019-12-02 20:49:56
I tried enough to find in google & android this question. Also did several trials & errors, but couldn't get this question. I was learning Android's "Draw Nine Patch" images. One basic I know is that, whatever image you process must be in .png format (if it's already in .9.png then it will be ignored by tool). However, I couldn't understand what it literally means by "stretchable patches" ? What exactly happens when you draw black dots outside the .png image ? (preview pane shows changes happening, but I am unclear on how it makes those) When I draw black dots in left/top sides of image it

Android: Drawing on Canvas in Scrollview

旧时模样 提交于 2019-12-01 05:12:37
I'm pretty much new in programing for Android. My app is sample app from api demos on developer android website. When I change parameters in that sample drawing it gets larger . That drawing needs to be displayed in scroll view (it doesn't need to be shrinked to fit the screen). This is the code I used: DrawPoints.java public class DrawPoints extends myActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.routes); } public static class SampleView extends View { private Paint mPaint = new Paint(); private float[] mPts;