|
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:
|
|
|
|
|
Source is now available to download!
|
|
|
|
|
Hi,
I am trying to develop a CAD like application using OpenGL and wxWidgets... I have reached at a stage where i can draw a circle, square, load an image, polygon etc.. am also able to zoom and pan..
as a further step, i want to move object, scale it and rotate.. to do this i have written a code to select and pick object that lies under mouse pointer.. Now what do i have to do to move the picked object..?? I tried by finding the difference of old and new points and recalculating the points of the object..
C.x += dx;
C.y += dy;
where dx and dy are differences of old and new x, and y values resp.. And C.x C.y are original x and y coordinates
This is showing some movement. but not as desired.. it isnt moving along with the mouse movement.. For a small mouse movement, it shows a huge displacement and also very fast... so what can be done to make a selected object move along wiith the mouse pointer...??
Also i'm not able to zoom with reference to the mouse pointer.. it zooms with reference to the origin (0,0,0) only.. please help me..
Thanks in advance..
|
|
|
|
|
I have a program running on Windows 2000 or better PC's that needs to do a per-pixel operation on a Windows bitmap. Currently I'm using a tight loop that does little more than a pointer increment followed by a quick add operation on each pixel over the entire bitmap. This is done in real-time so I need it fast. On a 320 x 240 image that ends up being 230,400 addition operations since they are RGB bitmaps (320 x 240 x 3). This is being done in real time on an image stream that is pumping out 25 frames per second. At that resolution it's fast enough, but at 640 x 480 I have to start dropping frames significantly to keep up. I am not displaying the modified bitmap to the screen at any time. Instead I am shipping it off to a remote location over the Internet for display at the destination system.
I was wondering if I could push this operation to the Graphics Accelerator using one of Windows Graphics API's like DirectDraw, etc.? Or do PC Graphic accelerators only help with operations that are drawn to the screen (local PC video memory)? I assume that if it's possible I'd need to pump the bitmap to the Graphics Accelerator and then know how to do a global operation on each pixel and then copy it back to local RAM? If it is possible to use the Graphics Accelerator to help with per-pixel operations on a off-screen bitmap, what are the pros and cons?
Finally, is there a way to push JPEG decompression and compression operations onto the Graphics Accelerator?
If it is possible to do these things I would like to know where a quick easy to dive into sample is. I don't have any need for shading or rotations or any complex graphics operations at all like that. Therefore I would like to avoid wading through a ton of reading just to learn how to do a simple global pixel operation task.
Thanks in advance.
|
|
|
|
|
It is well known that calling GetPixel and SetPixel on a bitmap by addressing each pixel separately is an extremely time consuming graphics operation. I recently ran into this thread, (at the MASM32 forum) that tests a number of typical graphics operations and determines the required clock cycles: Graphics, Memory DIB[^]. Skip the assembly code and just check out the listings of clock cycles for the GDI operation,...I think you'll be amazed.
The DirectX SDK comes with a utility that displays the capabilities of your graphics accelerator. Basically, what you want is: GetDeviceCaps[^]. And, if your graphics accelerator supports Pixel Shaders, perhaps that would be faster. But, this is very time-consuming and error-prone.
BitBlt is much faster,...but, I think what you want is to have the bitmap already altered before you need to display it. Undoubtedly, that occurred to you. I'm assuming that you cannot access the bitmap before your application loads, or starts processing.
|
|
|
|
|
Hello Baltoro,
I am not using GetPixel/SetPixel. Instead I am using the Bitmap's scanline property to get a pointer to that memory area and simply walking a pointer over that area in a tight loop.
I do have access to the bitmap, in fact I call Delphi's JPEG code to decompress, with some optimizations I added to avoid needless memory reallocations between JPEG frames. I have since learned that there is an extension called DXVA (DirectX Video Acceleration), but that it is really tough to work with. However, I was also told that there probably already are JPEG compressors on my system that make use of DXVA. It might end up being an issue of learning how (if possible) to use DirectX to utilize those hardware accelerated compressors, but I have no idea to go about doing that currently.
Thanks,
Robert
|
|
|
|