Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Dears All,
Kindly i need your help.

I’m a C# beginner.
I want to build a windows application in C#.Net, the application should design-on multiple phases- a secure document based on curves generation and exported as Bmp file.
Pseudo procedure:

step1-import bmp file.
step 2-transform the bmp to 2D array.
step 3-draw on the array in specific locations using curves generation(parametric [Bezier, B-spline and cubic B-Spline]).
step 4-add desired text on desired location.
step 4-export the result array as bmp file.
step 5-may be the same file imported again for further drawing—go to step1.

I’m facing a problem with 2D Drawing of curves(parametric [Bezier, B-spline and cubic B-Spline] ) generation programming on 2D matrix then export results as Bmp file.

I surveyed the Web for references about such subject, but I don’t find anything meet my needs.
can you help me please? If you have any useful advice, references, code examples, or anything may help in this subject I’ll be grateful.

Your kind support is highly appreciated.
Posted
Updated 9-Dec-12 2:12am
v2

1 solution

I assume you know how to draw the curves but have a problem with drawing on bitmaps. Here is how you do it: you create a bitmap, obtain and instance of the System.Drawing.Graphics for this bitmap, and use it for drawing. Something like:

C#
int width = //...
int height = //...

//...

string fileName = //...

//...

using (System.Drawing.Bitmap bitmap = new Bitmap(width, height)) {
    System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
    // draw on bitmap using graphics:
                // graphics.DrawBeziers,
                // graphics.DrawBezier,
                // graphics.DrawCurve,
                //etc.
    bitmap.Save(fileName);
} // important: bitmap.Dispose is automatically called here


Please see:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx[^].

—SA
 
Share this answer
 
Comments
as45 19-Dec-12 16:54pm    
many thanks with appreciation
that's was useful to solve important part of the issue
but, do you have any idea about how to control the locations of the image?
i have to design a document in multiple phases then print them all to have one secure document.
can you help please
Sergey Alexandrovich Kryukov 19-Dec-12 18:07pm    
You are very welcome. About the location: I don't see where is the problem. Perhaps you will need to post a separate questions and explain it really well. If you want to notify me on that new question, post a comment to my present comment (by "Reply").

And — good luck, call again.
—SA
as45 20-Dec-12 17:54pm    
Dear Mr. Kryukov,
thank you very much for the help.
may i fail in explaining what i need
but i have to draw secure document using curves generation something like this
http://mocii.com/uploads/2010/12/guilloche-patterns-vector-336x280.jpg
or this http://www.banknotenews.com/files/myanmar_10000_k_2012.00.00_b16a_pnls_ac_4329212_r.jpg

i mean i have to draw 32 bmp image and print them on one photo paper to have on document.
can you guide me on how can i do that? if you have reference , ebook or code example.
your help will be highly appreciated
Sergey Alexandrovich Kryukov 21-Dec-12 0:31am    
Oh, you call that security. Hm...
Well, I think I already answered — the code sample and links show all you need for such rendering. Of course new will need to understand some mathematics behind Bezier and everything else. If you need guidance, please explain what else do you miss...
—SA
as45 22-Dec-12 9:16am    
many thanks Mr. Kryukov.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900