Рубрики

drawing

Drawing the American flag for beginners

Since the star pattern alternates every row, we need to position another star. Duplicate (CTRL+D) the star and position it to X: 633 px and Y:8386 px. Now we’re prepared to create the rest of the stars.


Drawing the American flag for beginners

Im vinay.. I Need to Draw a sine wave on the form based on the X and Y values..I have stored those values in List variable..

OrlandoCurioso 7-Dec-07 13:39
Wyld_One 14-Nov-07 22:32

Only the points are computed in the same order you draw them on a paper with only 5 strokes. (0,4,8,2,6)

The second difference is the FillMode. Using the Winding fill method it becomes aware of the line crossings and what is ‘inside’ all of the borders. the default FillMode is Alternate.

This way you don’t even have to compute the ‘inner’ circle.

private void DrawStar( Graphics g, float r, float xc, float yc ) < // simpler version only five points and only one angle needs computing int xp = 0; // r: determines the size of the star. // xc, yc: determine the location of the star. float radian72 = (float) ( (float) Math.PI * (float) 4.0 ) / (float) 5.0; // Fill the star: PointF[] pts = new PointF[ 5 ]; //Start a loop through all the points for ( xp = 0; xp < 5; xp++ ) < pts[ xp ] = new PointF( xc + r * (float) Math.Sin( xp * radian72 ), (float) yc - r * (float) Math.Cos( xp * radian72 ) ); > g.FillPolygon( Brushes.White, pts, FillMode.Winding); >

Lalito80 19-Jun-07 5:51

I am Eduardo, writing from Peru (Lima) and the author of program Secciones (http://sourceforge.net/projects/secciones/) developed with .NET 2 and CSharp and i realize that you have experience with graphics management, viewpoints, viewports, etc. and I was wondering if you can help me improve my little program Secciones.

If you have a look on my program, you will see that the graphics are poor and i need to improve them (now i am using ZedGraph). I would like to have a graphics interface like Autocad or any CAD Tools (maybe not so advanced), with the following features:

* Allow me to see the Polygons and 2d figures defined by (x,y) points in their real form (Scale on X = Scale on Y).
* Zooming functions (In / Out / Rectangular area)
* Panning
* Grids with points
* Able to have “sensible” areas, like the tag of html.
* Obviously FREE or Open Source .

Is there any way to do this? Can you help on that, giving some directions or related information?

pd. Sorry for my bad english.

Thanks in advance.
Regards

michael_rost 11-Jun-07 10:07
Eric Engler 2-Apr-07 11:26
Jack J. H. Xu 2-Apr-07 12:53

Thank you for your interest in my work.

I notice that the price seems little bit high. However you should know that the book is not simply a tutorial. Most of the book content is from my original work. It took me a lot of effort and time to write such a book. In this book, I emphasize the practical usefulness for .NET developers who want to create real-world C# applications. Some examples in the book are actually powerful 2D and 3D chart and graphics packages, which can be directly used in your C# applications. You will find that these example chart and graphics packages alone will be worth much more than the cost of the book.

Dr. Jack Xu has a Ph.D in theoretical physics. He has over 15 years programming experience in Basic, FORTRAN, C, C++, Matlab, and C#.

Eric Engler 2-Apr-07 13:16

Indeed, your skill set is hard to find in the .NET world. And these graphics can also be used in ASP.NET by creating bitmapped images, and then streaming them directly to the browser. That way the image never needs to get saved in a hard disk file.

There’s a lot of good graphics code on Code Project, but it takes a long time to go through it all and make it useful. And most of the graphics code on Code Project comes with very little explanation of how it works. Judging from what I’ve seen so far, it looks like you do explain your code.

Paul Selormey 22-Apr-07 19:03

So what is up with your publisher? it cannot simply meet the demand. I ordered a copy more than 2 weeks ago on Amazon.com, but it is still no shipped and Amazon.com claims the problem is with their supplier!

It will have being better if you simply did, a PDF e-book.

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
Jack J. H. Xu 23-Apr-07 10:33

Sorry to hear that. I contacted to the publisher and they told me that the first run of the book copies were sold out in few days mainly due to the bulk purchases from book resellers. Now they got second run out a week ago, so the book is available in stock. They also told me that they have completed all orders for amazon except for orders placed after April 18. They don’t know why amazon takes so long to ship your book. You need to ckeck with amazon again because this is not due to the publisher for the delay.

Hope you can get your book soon.

Dr. Jack Xu has a Ph.D in theoretical physics. He has over 15 years programming experience in Basic, FORTRAN, C, C++, Matlab, and C#.

Michael Sync 1-Aug-07 22:50

I got this from the link you posted.

Not Found
The requested URL /~jack_xu/TableContents.htm was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.37 Server at authors.unicadpublish.com Port 80

Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)

If you want to thank me for my help, please vote my message by clicking one of numbers beside “Rate this message”. Why vote? Plz Read it here. Thank you.

Eric Engler 6-Aug-07 6:19

The URL changed:

DigitalKing 26-Mar-07 20:10

This is probably slower (I haven’t tested for speed), but it’s more flexible.

private const double DEGREE = 0.017453292519943295769236907684886; //number of radians in one degree public static GraphicsPath Star(int c_x, int c_y, int inner_radius, int radius, int n, int rot) < rot %= 360; Point[] points = new Point[n*2]; byte[] types = new byte[n*2]; int index = 0; for (int a = rot; a < 360+rot; a += 180/n) < if (index >= points.Length) break; points[index] = new Point( c_x + (int)(((index % 2 == 0) ? radius : inner_radius) * Math.Cos(DEGREE * a)), c_y + (int)(((index % 2 == 0) ? radius : inner_radius) * Math.Sin(DEGREE * a))); types[index] = (byte)PathPointType.Line; index++; > types[0] = (byte)PathPointType.Start; return new GraphicsPath(points, types); >

Example usage:

protected override void OnPaint(PaintEventArgs e) < base.OnPaint(e); GraphicsPath star = Star(110, 110, 40, 100, 5, 270); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.FillPath(Brushes.Black, star); >

Paul Selormey 26-Mar-07 21:14

Nice, you can get ride of the the “types” to make it a bit more efficient.

GraphicsPath path = new GraphicsPath(); path.AddPolygon(points); return path;

BTW, what ratio of inner_radius to radius gives the “best” or “standard” apperance?

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
Jack J. H. Xu 26-Mar-07 21:54

Thank you for your comment.

The ratio of inner_radius to outer_radius is fixed:
inner_radius = outer_radius *cos(72/180)/cos(36/180)
This means only one radius is enough for the problem. I used two radii here only for saving the typing.

Dr. Jack Xu has a Ph.D in theoretical physics. He has over 15 years programming experience in Basic, FORTRAN, C, C++, Matlab, and C#.

Paul Selormey 26-Mar-07 22:03

Are you sure there is no mistake in the code? I have just tried it and it is not working. Or this refers to your own code not the one give in this thread?

You still have not answered my earlier post. how do we buy the book it seems not available for sale on your link.

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
Jack J. H. Xu 26-Mar-07 22:43

You mean my code does not work on your computer? I tested it again. It works fine on my VS 2005.

The book will come out next week. You can order it from Amazon and book stores such as Borders or Barnes & Noble.

We will accept direct order from our website that will setup soon. Then you will get 20% discount if you order it directly from publisher.

Thank you very much for your interest in my work.

Dr. Jack Xu has a Ph.D in theoretical physics. He has over 15 years programming experience in Basic, FORTRAN, C, C++, Matlab, and C#.

Paul Selormey 26-Mar-07 23:04

Jack JH Xu wrote:
You mean my code does not work on your computer? I tested it again. It works fine on my VS 2005.

No not your codes, I mean DigitalKing’s code with your suggestion for calculating the inner radius.

Jack JH Xu wrote:

The book will come out next week. You can order it from Amazon and book stores such as Borders or Barnes & Noble.

I will be looking forward to it – thanks for your work.

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
DigitalKing 26-Mar-07 22:24

I coded it without the types at first, but it wouldn’t compile (I’m using .net 2).

Paul Selormey 26-Mar-07 23:02

If you wish to pass the points in the constructor, there is no such contructor and even if you pass a null it will throw exception, so just create an empty path and add a polygon, which the points defined. It works in both .NET 1x/2.

DigitalKing wrote:
I tested a few ratios, and 3/8 (inner to outer) looks nice.

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.

General News Suggestion Question Bug Answer Joke Praise Rant Admin

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

USA Flag Dimensions

The specifications say that the height (hoist) is a 1.0, while the width (fly) is a 1.9. That means we’ll go to File > Document Properties and set the Width to 19000 px and Height to 10000 px.

Why such a ridiculously large page size you ask? A lot of the American flag dimensions rely heavily on weird fractions, which doesn’t fly with pixels unless you’re ready to do some serious conversions. Starting with a gigantic canvas will reduce our chances of coming across decimalized pixels.

inkscape document properties

Red and White Broad Stripes

Step 1

Each stripe will be 1/13th of the flag height, so go ahead and use the Rectangle Tool to draw the first stripe 769 px tall and 19000 px wide. Make sure it’s perfectly to the top using Snapping, Align and Distribute, or enter X: 0 px and Y: 9231 px.

Go to Object > Fill and Stroke to set the Fill color to the question mark, which means Undefined. I’ll show you why next.

inkscape undefined fill

Step 2

We’re going to do a fun trick here. Head up to Edit > Clone > Create Tiled Clones which will bring up a new window. Select the Color tab and click on Initial color. This will bring up another small window where you get to pick a color. In the RGBA box, enter b22234ff, which is the color code for the official Old Glory Red.

create tiled clones initial color

Step 3

The other setting we need to set is Per row: L: 100% and check Alternate. Then we need to set the Rows to 13 and the columns to 1. Now make sure your rectangle is selected and click Create.

inkscape rows and columns

Step 4

You should have ended up with 13 red and white stripes. I thought this was a useful and easy trick!

red and white stripes

The Blue Canton

That top blue rectangle at the top left corner of the American flag is called a canton, which will have a Width of 7600 px and a Height of 5385 px. Use the Rectangle tool once more to draw the canton and set the Fill to 3c3b6eff, which is the official Old Glory Blue.

Again, use Snapping or Align and Distribute to align it perfectly to the top left. If you’re feeling a tad lazy, just enter X: 0 px and Y: 4615 px.

usa flag blue canton

Drawing the American flag for beginners

You can help by being ready to provide the information and documents listed below.

Information About You

  • Your date and place of birth and Social Security number;
  • The name, Social Security number and date of birth or age of your current spouse and any former spouse. You should also know the dates and places of marriage and dates of divorce or death (if appropriate);
  • The names of any unmarried children under age 18, age 18-19 and in elementary or secondary school, or disabled before age 22;
  • Your bank or other financial institution’s Routing Transit Number and the account number [more info];.
  • Your citizenship status;
  • Whether you or anyone else has ever filed for Social Security benefits, Medicare or Supplemental Security Income on your behalf (if so, we will also ask for information on whose Social Security record you applied);
  • Whether you have used any other Social Security number;
  • If you are applying for retirement benefits, the month you want your benefits to begin; and
  • If you are within 3 months of age 65, whether you want to enroll in Medical Insurance (Part B of Medicare).

Information About Your Work

  • The name and address of your employer(s) for this year and last year;
  • The amount of money earned last year and this year. If you are filing for benefits in the months of September through December, you will also need to estimate next year’s earnings;
  • A copy of your Social Security Statement or a record of your earnings. If you do not have a Statement, you can view your Social Security Statement online by creating an account and signing in with us. Even if you do not have a record of your earnings or you are not sure if they are correct, please fill out the application. We will help you review your earnings when you apply;
  • The beginning and ending dates of any active U.S. military service you had before 1968;
  • Whether you became unable to work because of illnesses, injuries or conditions at any time within the past 14 months. If “Yes,” we will also ask the date you became unable to work;
  • Whether you or your spouse have ever worked for the railroad industry;
  • Whether you have earned Social Security credits under another country’s social security system; and
  • Whether you qualified for or expect to receive a pension or annuity based on your own employment with the Federal government of the United States or one of its States or local subdivisions.

Note

If you are outside the U.S., we may need to know if you worked or will be working over 45 hours a month outside the United States.

Documents You May Need To Provide

We may need to see certain documents in order to pay benefits. If you apply online, a list of documents we need to see will appear at the end of the application, along with instructions on where to submit them. The documents we may ask for are:

  • your original birth certificate or other proof of birth [more info] (You may also submit a copy of your birth certificate certified by the issuing agency);
  • proof of U.S. citizenship or lawful alien status if you were not born in the United States [more info];
  • a copy of your U.S. military service paper(s) (e.g., DD-214 – Certificate of Release or Discharge from Active Duty) if you had military service before 1968; [more info]; and
  • a copy of your W-2 form(s) [more info] and/or self-employment tax return [more info] for last year.

Important

We accept photocopies of W-2 forms, self-employment tax returns or medical documents, but we must see the original of most other documents, such as your birth certificate. (We will return them to you.)

Note

If our records show that documents proving age or citizenship/lawful alien status have already been submitted for an earlier Medicare or Social Security claim (such as Disability, Supplemental Security Income, etc.), you do not need to submit the documents again.

What If I Don’t Have All Of The Documents?

Even if you don’t have all the documents we need, you should still submit the application and any documents you do have. You can provide the missing documents later or we may be able to help you get them.

In many cases, your local Social Security office can contact your state Bureau of Vital Statistics and verify your information online at no cost to you. If we can’t verify your information online, we can still help you get the information you need.

If you delay submitting the application, you could lose some benefits you may be due.

Mailing Your Documents

If you mail any documents to us, you must include the Social Security number so that we can match them with the correct application. Do not write anything on the original documents. Please write the Social Security number on a separate sheet of paper and include it in the mailing envelope along with the documents. If you do not want to mail these documents, you may bring them to a Social Security office.

Do not mail foreign birth records or any documents from the Department of Homeland Security (DHS), formerly the Immigration and Naturalization Service (INS), especially those you (the applicant) are required to keep with you at all times. These documents are extremely difficult, time-consuming and expensive to replace if lost. Some cannot be replaced. Instead, bring them to a Social Security office where they will be examined and returned.

Colin Wynn
the authorColin Wynn

Leave a Reply