draw

Create “L” shape curved line with dynamic data

拥有回忆 提交于 2019-12-01 04:44:48
I want to draw a pure dynamic view like below image I have two arraylist List<String> type and List<Float> level; type have name (max,type1,type2, etc) and level have marker value of type level will always lie between 0 to 1 and type will be a string, value of both level and type will come from server. We have two fixed label - min and max . Suppose I got .4 for min and .5 for max from server then all type (type1, type2, type3, etc) will lie between .4 and .5 . Then all rest of types should be arrange like crooked line, but if we get value for min is .001 and for max .9 then we have enough

Draw an arc/circle sector in QML?

匆匆过客 提交于 2019-12-01 04:44:43
I know that it is possible to draw a circle in QML using the following code: Rectangle { width: 150 height: 150 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top color: "#095e7b" border.color: "#0a2f4a" border.width: 2 radius: width*0.5 } My question is: what if I need to draw a sector of a circle. (Pizza Slices) and make each of these slices clickable? Can I do this using QML only? Mitch Yes, using Canvas (and Context2D ): import QtQuick 2.3 Rectangle { width: 400 height: 400 Canvas { anchors.fill: parent onPaint: { var ctx = getContext("2d"); ctx.reset(); var centreX

How to draw a route between two geopoints on the Android

♀尐吖头ヾ 提交于 2019-12-01 03:48:30
问题 I have two OverlayItem's on a MapView. How can I draw a route between the two geopoints? 回答1: This application is contained with source code... It'll solve ur probs. http://www.anddev.org/the_friend_finder_-_mapactivity_using_gps_-_part_i_-_ii-t93.html 回答2: This posting J2ME/Android/BlackBerry - driving directions, route between two locations suggests: you must not use the Map Service with any applications for route guidance, including but not limited to turn-by-turn route guidance that is

How to draw a rectangle in WPF at a specific x,y screen location?

青春壹個敷衍的年華 提交于 2019-12-01 03:47:06
In C#, WPF I've created a rectangle: Rectangle myRgbRectangle = new Rectangle(); myRgbRectangle.Width = 1; myRgbRectangle.Height = 1; SolidColorBrush mySolidColorBrush = new SolidColorBrush(); Yes, I really just want it to be 1 pixel by 1 pixel. And I want to change the color based on the variable height like so: mySolidColorBrush.Color = Color.FromArgb(255, 0, 0, (byte)height); myRgbRectangle.Fill = mySolidColorBrush; Now, how do I draw at a specific x,y location on the screen? I do have a grid (myGrid) on my MainWindow.xaml. Thanks! Here's the pertinent code: myRgbRectangle.Width = 1;

How to pause for 5 seconds before drawing the next thing on Android?

喜欢而已 提交于 2019-12-01 03:43:56
问题 Say I want to draw a line, then wait five seconds, then draw another line. I have a method like this: public void onDraw(Canvas canvas) { int w = canvas.getWidth(); int h = canvas.getHeight(); canvas.drawLine(w/2, 0, w/2, h-1, paint); // PAUSE FIVE SECONDS canvas.drawLine(0, h/2, w-1, h/2, paint); } How do I pause? 回答1: Don't wait in onDraw method it's called in the UI thread and you'll block it. Use flags to handle which line will be drawn boolean shouldDrawSecondLine = false; public void

Draw bitmaps from resources over another

亡梦爱人 提交于 2019-12-01 03:24:45
问题 I have got two bitmaps, background and foreground . How do I draw bitmap foreground on background without using another Canvas? Solution: 1) First create bitmaps from resources with additional option ARGB_8888 BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; 2) Declare bitmaps Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background, options); Bitmap foreground = BitmapFactory.decodeResource

Draw bold/italic text with PIL?

左心房为你撑大大i 提交于 2019-12-01 03:05:14
How to draw bold/italic text with PIL? ImageFont.truetype(file, size) has an option to specify font size only. Use the bold/italic version of the font Many fonts use different TTF files for their bold/italic versions, so I'd imagine if you just specify that file it would work. A rather hacky solution to make a font bold if (for whatever reason) you don't have a separate bold version of the font is to print the same text several times with a slight offset. andaleMono = ImageFont.truetype(ANDALE_MONO_PATH,16) text = "hello world" mainOffset = (50,50) xoff, yoff = mainOffset draw.text(mainOffset

Draw an arc/circle sector in QML?

强颜欢笑 提交于 2019-12-01 02:45:29
问题 I know that it is possible to draw a circle in QML using the following code: Rectangle { width: 150 height: 150 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top color: "#095e7b" border.color: "#0a2f4a" border.width: 2 radius: width*0.5 } My question is: what if I need to draw a sector of a circle. (Pizza Slices) and make each of these slices clickable? Can I do this using QML only? 回答1: Yes, using Canvas (and Context2D): import QtQuick 2.3 Rectangle { width: 400

Create “L” shape curved line with dynamic data

帅比萌擦擦* 提交于 2019-12-01 02:17:50
问题 I want to draw a pure dynamic view like below image I have two arraylist List<String> type and List<Float> level; type have name (max,type1,type2, etc) and level have marker value of type level will always lie between 0 to 1 and type will be a string, value of both level and type will come from server. We have two fixed label - min and max . Suppose I got .4 for min and .5 for max from server then all type (type1, type2, type3, etc) will lie between .4 and .5 . Then all rest of types should

Python & Pygame: Updating all elements in a list under a loop during iteration

你离开我真会死。 提交于 2019-12-01 01:46:13
i am working on a program in Python and using Pygame. this is what the basic code looks like: while 1: screen.blit(background, (0,0)) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type == KEYDOWN and event.key == K_c: circle_create = True circle_list.append(Circle()) if event.type == MOUSEBUTTONDOWN and circle_create == True: if clicks == 0: circle_list[i].center() clicks += 1 if event.type == MOUSEMOTION and clicks == 1 and circle_create == True: circle_list[i].stretch() if circle_create == True: circle_list[i].draw_circle() if clicks == 2: clicks =