|
You can not do this with arbitrary spacing of the new points, if the old points are not co-linear.
You have to find the common denominator of the length of distance between the given point, and to get even spacing your units-between-new-vertices have to be that number divided by an integer. If, for instance the distance between starting vertices are: {10,6,8,2)
The largest distance between resulting vertices would be 2 (though it could be 1, 0.66, 0.5, 0.4, etc).
If the distances are (10.1,6.07,8,2), then the maximum distance between vertices would be on the order of 0.01 units.
Hope this is not too late, and hope it helps. If it does, it is because you understand what I said, as opposed to me telling you how to do it.
Unless this was a yes or no answer for a test...
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi,
I want to scale and rotate a bitmap (loaded using GDI+) and save the rotated and scaled bitmap to a file using GDI+.
How can I do it?
Thanks,
modified on Friday, July 31, 2009 5:09 PM
|
|
|
|
|
Did you read the GDI+ documentation on bitmaps?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Did you really understand GDI+? I read GDI+ several days and try to use following code:
Graphics g(hdc);
Image i(L"HelloWorld.bmp");
g.DrawImage(&i,0,1024);
g.TranslateTransform(100.0f, 50.0f);
g.RotateTransform(45.0f);
g.DrawImage(ℑ,0,0);
CLSID jpgClsid;
GetEncoderClsid(L"image/jpeg", &jpgClsid);
i.Save(pIStream1, &jpgClsid);
I had no luck. Did you save a scaled or rotated bitmap using GDI+ before?
|
|
|
|
|
Yes. Read up on the following:
Bitmap.CreateGraphics
Graphics.RotateTransform
Graphics.DrawImage
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thank you very much for reply.
I want to save the rotated Image to a file.
"Graphics.DrawImage" can not save to a file?
Right? Can I get bitmap from rotated "Graphics"?
Best regards,
|
|
|
|
|
I gave you all the pointers you need, and you need all I gave you.
Do some reading and use your brain, I'm not going to hold your hand.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I did not find following function call for the Bitmap class.
Bitmap.CreateGraphics
I tried following:
Graphics g(hdc);
Image i(L"HelloWorld.bmp");
g.DrawImage(&i,0,1024);
g.TranslateTransform(100.0f, 50.0f);
g.RotateTransform(45.0f);
g.DrawImage(ℑ,0,0);
CLSID jpgClsid;
GetEncoderClsid(L"image/jpeg", &jpgClsid);
i.Save(pIStream1, &jpgClsid);
I had no luck.
Any ideas? Did you try to save a rotated or scaled Bitmap before?
|
|
|
|
|
Sorry, my mistake, it is Graphics.FromImage I was thinking of.
transoft wrote: I had no luck.
That is uninformative and unscientific. Doesn't provide a single clue. Read my sig.
transoft wrote: Did you try to save a rotated or scaled Bitmap before?
Yes. I've done many things with images in .NET
However your latest code makes me doubt it is .NET code you want; what's all that hdc and CLSID stuff, I wouldn't need that to solve your original problem.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi
I am using C++ native. I did not using .NET.
It looks like to me that Graphics object would not affect the Bitmap object. I am guessing that before Graphics Object does anything, it will create a copy the Bitmap object and then does bitmap transformation to the copy, and finally delete the Bitmap copy. The original Bitmap did not change.
Thanks
|
|
|
|
|
transoft wrote: it will create a copy the Bitmap
I doubt that verrrrrrrrrrry much.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I've built a utility that grabs the frames from a multi-frame .tif or gif so I can save them to individual files. In one file (a tif fax document) the dimensions are reversed - 11 x 8.5 instead of 8.5 by 11. Text orientation is correct, but not the dimensions.
I assume the problem is on my end because when I open the file in Irfanview it displays correctly. None of the other TIFs I'm testing with are fax documents, and they display correctly. Worth noting that both Paint.net and MS Paint have the same problem I'm having.
Anyone have an idea as to the root of the problem?
|
|
|
|
|
|
hi, please help me to wrtie code project of jawbreaker game in c++.
|
|
|
|
|
Why?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Please deposit $15,000 in my account and I'll get started.
Oh, and by the way I can only do it in my spare time.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi.
How can we convert a RGB code to its equivalent in Hsv ?
Thanks.
|
|
|
|
|
by using some code, that can be found in a CP article; search for RGB HSV
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Or by doing a simple web search? That's how I found out how to do it.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hello!
I have implemented a barchart on the surface of Windows-Form. how to print it into hard copy.
regard,
Sohail
|
|
|
|
|
Assuming that you are using .NET, and you don't say!!!
All Control descendants have a DrawToBitmap method. Use that, then all you have to do is work out how to print a Bitmap.
Seriously, there are thousands of examples of how to do this, both here on CP and on t'web. Do a little Binging!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi!
i m using .Net and have drawn a chart on windows form's client rectangle. i wanna print it.
Thanks alot sir Henry.
|
|
|
|
|
Then I suggest that you do as I said in the my last post. Look up the documentation for Form.DrawToBitmap , read it and experiment.
After that try Googling, or Binging for c# print bitmap
You might also want to consider filling your Forms client area with a Panel and drawing your bar chart on that, then use Panel.DrawToBitmap instead of the Form version.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank You very much sir...!
|
|
|
|
|
I found this OpenGL 3.1 tutorial on Wikiscripts, this is the first part, but author promised that soon there will be a sequel:
|
|
|
|