draw

How to find current (X, Y) position in iTextSharp?

[亡魂溺海] 提交于 2019-11-30 23:05:49
I need to create a PDF with several sections, and after each section need to add a line, but I don't know where to draw this line. I need to find the exact coordinates [x, y] where the next element in the document will be write. Like @Olaf said, use GetVerticalPosition to get the Y . The X is just the document's LeftMargin . Below is a full working WinForms app targeting iTextSharp 5.1.1.0 that hopefully does what you are looking for: using System; using System.Text; using System.Windows.Forms; using iTextSharp.text; using iTextSharp.text.pdf; using System.IO; namespace

Draw bold/italic text with PIL?

北城以北 提交于 2019-11-30 22:15:11
问题 How to draw bold/italic text with PIL? ImageFont.truetype(file, size) has an option to specify font size only. 回答1: Use the bold/italic version of the font 回答2: Many fonts use different TTF files for their bold/italic versions, so I'd imagine if you just specify that file it would work. 回答3: 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

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

瘦欲@ 提交于 2019-11-30 21:21:20
问题 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:

New to Android - Drawing a view at runtime

妖精的绣舞 提交于 2019-11-30 20:26:40
HI all, I'm just getting started with developing for Android. I'm looking to port one of my iPhone applications, but I'm kind of at a loss for how to draw a view at runtime (a view not declared in the XML). Basically, I want to draw a simple rectangle, but then be able to manipulate its frame after being drawn. Sorry if this is a really, really simple question, but I can't seem to find some equivalent to the iPhone SDK here. Thanks in advance! Steve Haley It sounds like you want to experiment with 2D graphics - for that, you should use a Canvas . You can control the drawing of the Canvas

HTML Canvas - Draw curved arrows

痞子三分冷 提交于 2019-11-30 18:51:58
I'm trying to draw curved arrows in a html canvas. I have no problem to draw a curved line but I don't know how to put the > at the end of the line (direction). ctx.beginPath(); ctx.fillStyle = "rgba(55, 217, 56,"+ opacity +")"; ctx.moveTo(this.fromX,this.fromY); ctx.quadraticCurveTo(this.controlX, this.controlY, this.toX, this.toY); ctx.stroke(); My idea is taking a small part of the line at the end and draw a triangle. How can I get the coordinate of a point in the line? Below is the image for better understanding. Simon Sarris Since you're using a quadratic curve, you know two points that

How to draw a line in android between two or more RadioButtons

会有一股神秘感。 提交于 2019-11-30 16:45:35
I want to draw a line between two or more views like radioButtons when the one is checked? i think below codes can give some ideas about drawing import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.RadioButton; import android.widget.RelativeLayout; public class MainActivity extends Activity { DrawView drawView; RadioButton r1,r2,r3,r4; RelativeLayout rl1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

How to draw a line in android between two or more RadioButtons

↘锁芯ラ 提交于 2019-11-30 16:30:53
问题 I want to draw a line between two or more views like radioButtons when the one is checked? 回答1: i think below codes can give some ideas about drawing import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.RadioButton; import android.widget.RelativeLayout; public class MainActivity extends Activity { DrawView drawView; RadioButton r1,r2,r3,r4;

How to draw a line every 25 words?

[亡魂溺海] 提交于 2019-11-30 10:00:28
问题 Using iTextSharp, I create a pdf writing some text into it. What I need is to draw a line to delimiter the text every 25 words, like the following image: Basically, I need to do that: draw a line every 25 words, just like the image. I'm aware there's a way of finding the position of a word on a page, but considering I'm writing the text to the pdf file, I guess there could be a way of calculating this without really having to find the text position, right? 回答1: Please take a look at the

How to fill a bezier path with gradient color

☆樱花仙子☆ 提交于 2019-11-30 09:44:33
I have a UIBezierPath inside my custom UIView draw(_ rect: CGRect) function. I would like to fill the path with a gradient color. Please can anybody guide me how can I do that. I need to fill the clip with a gradient color and then stroke the path with black color. There are some posts in SO which does not solve the problem. For example Swift: Gradient along a bezier path (using CALayers) this post guides how to draw on a layer in UIView but not in a UIBezierPath . NB: I am working on Swift-3 To answer this question of yours, I have a UIBezierPath inside my custom UIView draw(_ rect: CGRect)

Android draw with blur

十年热恋 提交于 2019-11-30 07:39:14
I need do draw on Android's Canvas using Blur effect, it is a very simple feature, I need to draw a circular area, which is blurred (the foreground) and the background transparent, I can do everything with manipulating the colour alpha to do it with custom transparency but I need it to be blurred instead of transparent.. any ideas? user2903200 (For those who are coming back, though this is an old question) On the Paint object which you are using to draw the Color, set paint.setMaskFilter(new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL)) Then, in Android Manifest.xml, set android