|
I'm quite interested in building a model of the black hole and visualize it like that shown in the movie "Interstellar". I'm good with C/C++/C# and Windows programming, how can I make it?
|
|
|
|
|
|
|
Hi all. I'm sorry, I know that this is going to come out as a "gimme codez" kind of question, but there's nothing much to do about that.
The thing is: I want to paint a brushed metal knob on my Winforms form surface (using C#) - Similarly to what what is mentioned in this Photoshop article[^]. (I'm only interested in the surface itself. All the trimmings around it are easy enough to paint)
I could just embed an image in the application and paint it from that (and that's probably what I'll do if I can't find any other solutions), but I would rather that the code didn't rely on embedded resources.
I guess I can figure it out somehow, but if anybody knows of any links/tips on how to do it, it would save me a lot of time.
I have tried Googling, but either my Google Fu is not strong enough or there are no such tips out there on the entire web.
So If anybody happens to know and can point me in the right direction, I would really appreciate it...!!!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
|
Thanks a lot Richard
Yes, I assume so, but it seems quite hard. Either you have to make up a gradient with a he** of a lot of gradient stops or you have to paint it in several layers. I guess I was hoping that somebody had already walked the long road so that I could just do what we programmers love the best: Cut and paste...
But if not, I might start messing around with gradients (and if I get it right, I can always publish it here). It might turn out a lot easier than it first appears, who knows? Or I could just do the fast hack and paint it from an image file as mentioned... Haven't quite decided yet.
Just to clarify: The purpose of this question is not so much to get around it as easy as possible as it is to save valuable project time...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
modified 20-Aug-15 4:25am.
|
|
|
|
|
I'm sure that I have seen some WPF article on this, but cannot recall where. If you can find it you may be able to convert to C# (try Sacha Barber[^]'s articles). There is also an alternative for creating these images called "ray tracing", but if memory serves, it is also quite labour intensive.
|
|
|
|
|
Another way to achieve this would be to use a Pixel shader and render in the completed image. While this[^] sample is in GL Shader, it is close enough that you could convert it into a DirectX shader.
|
|
|
|
|
Thanks Pete, I'll have a closer look at that!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
I have a deck of Elder Futhark rune cards I hand drew myself some 25 years ago. On a large paper card on a drawing board. Back then Google was the belated Messiah, and online services such as rune drawing or font composition where very scarce. I did it all my little old self with a T-square, ruler, pencil, and other such steam-punk devices.
Having rediscovered the deck, I find the accuracy and attention to detail I put into each card remarkable; runes are drawn with black koki pens, on white card; the uniformity of line thickness close to perfect on most cards, and the points where lines meet have zero smudge or overlap, or whatever. These look, except for one or two, like they were printed.
I want to capture all these cards for part of a digital work, and because the cards have aged some 25 years, their edges are not perfect, although each card is still a very good 80mm x 100mm. I scanned sets of six cards, in a grid style, on A4 paper, and used a white brush to remove edge markings and other unwanted spots from the cards. I now have six perfect enough composite images of 5670mm x 4730mm (3 cards wide, 2 deep on each image). These 'final' images are all nearly perfect size to be divided into 6 smaller images, that make up the large ones, So, from 5680mm wide, we get three cards 1890mm wide, and from 4739mm wide I get 2 2365mm cards.
Now, how do I do this? Using a selection rectangle in Paint.NET is not for the feint of heart, and not much ambition for this task. I have done an incredibly lot of google research before asking here, but nearly all results advised I use the ImageMagic [^]convert command. I have tried several variants of the convert command to no avail, e.g. one gives a very small image out but still containing all six original images. Various other attempts here met with similarly strange results.
The basic command I\m trying to use is: convert 'LargeImage.jpg' -resize 120x120 thumbnail%03d.png
No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde
modified 12-Jul-15 6:51am.
|
|
|
|
|
Sounds like you're looking for the crop command[^].
The width and height of the geometry argument give the size of the image that remains after cropping, and x and y in the offset (if present) gives the location of the top left corner of the cropped image with respect to the original image.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
So I would effectively, on card at a time, crop the whole drawing down to one-card size, save that card size drawing under a new name, then recalculate the offset for the next card, 24 times. No great effort if I get the process right once to start with. Thanks.
No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde
|
|
|
|
|
You should be able to do it with a single -crop command:
You can add the @ to the geometry argument to equally divide the image into the number of tiles generated.
convert -crop 120x120 LargeImage.jpg tiles/tile%03d.jpg
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Here's a link to the ImageMagick documentation for the crop command.
From a quick look it will do exactly what you want.
Link added: http://www.imagemagick.org/Usage/crop/[^]
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
modified 13-Jul-15 9:08am.
|
|
|
|
|
What link?
No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde
|
|
|
|
|
Sorry, I added the link!
Our office is out of coffee and I just came back from a three week vacation.
Now where's that switch to turn my brain back on?
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
I successfully create a custom cursor from a 32x32 32bpppArgb (GDI) Bitmap with the following code:
public static Cursor ToCursor(System.Drawing.Bitmap bmp, byte x, byte y)
{
var stream = new MemoryStream();
var hIcon = bmp.GetHicon();
try
{
System.Drawing.Icon.FromHandle(hIcon).Save(stream);
}
finally { NativeMethods.DestroyIcon(hIcon); }
stream.Seek(2, SeekOrigin.Begin);
stream.WriteByte(2);
stream.Seek(10, SeekOrigin.Begin);
stream.WriteByte(x);
stream.Seek(12, SeekOrigin.Begin);
stream.WriteByte(y);
stream.Seek(0, SeekOrigin.Begin);
return new Cursor(stream);
}
However the colors of my cursor are all wrong!
It looks like it is using a palette / a limited set of 16/32/256 colors?!
Is it possible to have 24bits/32bits colors cursor? (i.e. with millions of possible color value)
[EDIT] Solved!
I found a way to do it! With the following API in sequences:
GetHIcon() <br />
CreateIconIndirect() <br />
CursorInteropHelper<br />
There was just some nagging issue to avoid GDI Object leaks which I solved by creating a
class SafeIconHandle : SafeHandle
modified 4-Jun-15 20:19pm.
|
|
|
|
|
|
My cursor are created from code generated Bitmap, won't work!
Anyhow I found a way to do it! With the following API in sequences:
GetHIcon() <br />
CreateIconIndirect() <br />
CursorInteropHelper<br />
There was just some nagging issue to avoid GDI Object leaks which I solved by creating a
class SafeIconHandle : SafeHandle
|
|
|
|
|
You may want to look at Extended Cursors for .Net[^] as it has a whole bundle of features.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Thanks you!
Anyhow my problem was to make a cursor that like a zoomed version of the screen!! So it doesn't help!
But anyhow, all working by now!
|
|
|
|
|
I want to convert graphics such as rectangles, circles, etc. to truetype files. However, I can't write the geometry data for graphics to these truetype files.Is there have any code or tutorial to achieve this goal?
|
|
|
|
|
I am programming in C++. I have a lot of work that uses the GDI, GDI+ or the older canvas to display graphs and chart. I need to draw a 3D mesh surface using these tools. Is there any sample code using these draw tools?
|
|
|
|
|
Austin_Cpp wrote: Is there any sample code Quite probably, but you have to go and search for it.
|
|
|
|
|
I have searched quite a bit with no luck. Unfortunately GDI is not considered a good option for 3D programming and almost all the samples are in OpenGL or Direct3D. I really can't use OpenGL or Direct3D without major changes to my code. GDI+ almost feels obsolete with very little activity on code web sites.
|
|
|
|