Jump to content
Xtreme .Net Talk

Menge

Avatar/Signature
  • Posts

    108
  • Joined

  • Last visited

Everything posted by Menge

  1. hi guys! i'm posting here because i really couldn't find anywhere else on the net a way to create a bitmap from a 32bit icon. no matter what i do i ALWAYS get a icon with a black border (if it uses alpha) here's what i'm doing. DockTypes.SHFileInfo FileInfo=new DockTypes.SHFileInfo(); SHGetFileInfo(ItemPath, 0, ref FileInfo, (uint)System.Runtime.InteropServices.Marshal.SizeOf(FileInfo), 0x200 | 0x100 | 0x0); Icon ItemIcon=Icon.FromHandle(FileInfo.hIcon); Bitmap IconBitmap=ItemIcon.ToBitmap(); and no matter what i do, it just saturates the alpha channel as if it were 1-bit. All i need is just a bitmap of the icon. nothing more. can anyone please help?
  2. u could try this: on System.Runtime.InteropServices.Marshal [C#] public static void Copy( byte[] source, int startIndex, IntPtr destination, int length ); it copies an array of bytes to a pointer. dunno if its the best... but...
  3. i agree with divil on the solution. all u need is a pointer to the array start. and then it goes smooth from there... with framerates about 10fps i think
  4. hrm... here's the copying from Direct3D to the window. keeping in mind that "front" is the device's render target, or at least an A8R8G8B8 surface with the image to be copied. and the window has the WS_EX_LAYERED attribute Rectangle dock=new Rectangle(new Point(0,0), new Size(500, ProgramConfig.IconSize)); Microsoft.DirectX.Direct3D.GraphicsStream Image=front.LockRectangle(dock, LockFlags.None); Bitmap b=new Bitmap(dock.Width, dock.Height, Convert.ToInt32(this.Width*ProgramConfig.BMPFIX), System.Drawing.Imaging.PixelFormat.Format32bppArgb, Image.InternalData); IntPtr Bmap=b.GetHbitmap(Color.FromArgb(0)); IntPtr memDc = CreateCompatibleDC(GetDC(IntPtr.Zero)); IntPtr oldBitmap = SelectObject(memDc, Bmap); try { size.cx=dock.Width; size.cy=dock.Height; UpdateLayeredWindow(LabelDisp.Handle, IntPtr.Zero, ref topPos, ref size, memDc, ref pointSource, 0, ref blend, ULW_ALPHA); if(Disp.Visible && ProgramDoing==ProgramState.Nothing)PopUp(false); } finally { if (Bmap != IntPtr.Zero) { SelectObject(memDc, oldBitmap); DeleteObject(Bmap); } DeleteDC(memDc); b.Dispose(); Image=null; front.UnlockRectangle(); } any optimizations are EXTREMELY welcome. the bitmap creation part is the slowest part of all... if i could only change the scan0 of the bitmap to the InternalData of the LockRectangle
  5. funny... coz that's what i doing... here's a snip Rectangle dock=new Rectangle(new Point(0,0), new Size(500, ProgramConfig.IconSize)); Microsoft.DirectX.Direct3D.GraphicsStream Image=front.LockRectangle(dock, LockFlags.None); Bitmap b=new Bitmap(dock.Width, dock.Height, Convert.ToInt32(this.Width*ProgramConfig.BMPFIX), System.Drawing.Imaging.PixelFormat.Format32bppArgb, Image.InternalData); IntPtr Bmap=b.GetHbitmap(Color.FromArgb(0)); IntPtr memDc = CreateCompatibleDC(GetDC(IntPtr.Zero)); IntPtr oldBitmap = SelectObject(memDc, Bmap); try { size.cx=dock.Width; size.cy=dock.Height; UpdateLayeredWindow(LabelDisp.Handle, IntPtr.Zero, ref topPos, ref size, memDc, ref pointSource, 0, ref blend, ULW_ALPHA); if(Disp.Visible && ProgramDoing==ProgramState.Nothing)PopUp(false); } finally { if (Bmap != IntPtr.Zero) { SelectObject(memDc, oldBitmap); DeleteObject(Bmap); } DeleteDC(memDc); b.Dispose(); Image=null; front.UnlockRectangle(); } i think u can get something out of it.
  6. this is all i do and it works :P this.IconBgDisplay.Image=Image.FromFile(FileBrowse.FileName); there IconBgDisplay is a PictureBox. nothing special... dunno why it doesn't work there.
  7. the app interface is rendered in Direct3D, then blitted to a 32bit GDI+ image to be blitted to the screen (that's why i say "getting OUT of Direct3D")... but the item config dialog is plain GDI+ and it SHOWS PNGs with per pixel alpha blending.... so does the configuration dialog. if ur really doubting me, download the thing... look at it... delete it after if u want... i searched this forum and did posts while programming that... look around and u will find my posts...
  8. dude, ur wrong. PNGs DO have an 8bit alpha component for each pixel. and they DO work with gdi+ aswell: http://www.ecocardio.com.br/orbit/dev0822.jpg Visit The Orbit Project Homepage for more info and a download.
  9. BMPs have alpha channels? try using PNGs instead
  10. ok lemme explain something... NOTHING u guys see is a shaped form... nor regions are being used... i found out. its all layered windows. render to a Direct3D surface. LockRectangle on it, Create a Bitmap from the InternalData of the GraphicsStream u got, and through windows api update it to a layered window. that's it... here's what I did: http://www.ecocardio.com.br/orbit/dev0822.jpg
  11. ek1, thx. but that's not what i want... if u've seen the pic, i want alpha blending too. i've managed to do this quite fast using the UpdateLayeredWindow function.... it's quite good.... but unfortunately, as Windows sucks at graphics, it's slow when i blit images larger than 400x400 (only 10fps or even less)
  12. hrm i use this method... it is true, it actually creates a hBitmap on memory. i always have to deleteobject later on :P
  13. hello i'm making a program and i need to have a bitmap out of a scan0 line from another bitmap (not really another bitmap - but a Microsoft.DirectX.Direct3D.GraphicsStream object). i know there is this constructor: new Bitmap(this.Width, this.Height, this.Width*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, Image.InternalData); but it takes a while to read and copy the data from the Image.InternalData pointer. my question is: is there a way to alter the destination bitmap object scan0 pointer to be the same as the Image.InternalData pointer? because i need speed on this one. and i need a copy
  14. hrm AndreRyan, that looks somewhat different from what i've seen around. i've taken a look at it, and it doesn't work for me either. it's faster.... twice as fast, i mean... but... just not quite it... i managed to do this: Microsoft.DirectX.Direct3D.GraphicsStream Image=front.LockRectangle(LockFlags.None); Bitmap b=new Bitmap(this.Width, this.Height, this.Width*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, Image.InternalData); the first part is blazing fast. but the bitmap creation one is slow takes about 1 second per frame on my 900Mhz... do any of you guys know how to create a blank bitmap and then simply make it use the GraphicsStream.InternalData as its scan0? they are the same type (the code above works) and all needed was to make the bitmap read from there. not copy as this seems to be going... but just read. this is frustrating :P
  15. Nerseus, i've taken a look at the GetDC method... and it does not work on A8R8G8B8 surfaces. i really need the alpha channel. i've talked to a friend of mine who did something similar in C++, and he used the LockRect method. i've used it and have successfully loaded into a GraphicsObject the image. my problem now is transferring it to a bitmap. i tried going through the bitmap and using the SetPixel method. but it's just Painfully slow to: 1) read 4 bytes from the GraphicsStream for every pixel 2) set the pixel on the bitmap. is there any other way to copy the memory data from the GraphicsStream to a Bitmap?
  16. Co2, it doesn't work on some machines. dunno why. it simply does absoluytely nothing
  17. actually, i like 2003 to some extent as a desktop os. (i use it as) tho i mess a lot with its server stuff. i've found some bugs that were in the initial xp release and slipped into 2003 :P
  18. just remember... that's not viable. to do that, then i'll just take a screenshot.... i want the rendered scene... correctly..... with all the alpha channels too.. i want directx to do it... not windows api which sucks
  19. nope all release binaries just seldom pcs install managed directx... the problem is not the binary... but the managed extensions themselves
  20. i need to render a scene and get that rendered scene to a bitmap image keeping the alpha channels. how can i do this? anyone got any ideas other than the GetFrontBuffer Method which is extremely slow? i need to get a Bitmap object specifically. please help!
  21. installing directx won't enable it. you have to enable it. run > dxdiag.exe go to display and enable everything (agp texture acceleration only if your vid card supports it). and you need to enable the sound service and etc... check out the services.msc tab for it
  22. then you must've forgotten to enable directx on windows server 2003.... yes, it needs to be enabled.. that's why it's good.. because everything comes disabled and you enable what you need to use only. i play everything i played on XP.
  23. i can't find out! all the packages that microsoft distributes don't work (except the chunky-86Mb-developer-runtime) ... damn! and i don't want to be incovenient by asking people to install stuff in orfer to TEST it... since it's still in developement this sux (sorry - i'm really mad)
  24. Co2: that file you mentioned doesn't seem to install on some machines for some weird reason. on all of my windows xp / 2003 machines, it wouldn't even run... it'd open and leave. maybe this is the problem that RazerWriter is having. (sorry for the double post. Co2 posted while i was writing my other post)
  25. i've had that same problem... try downloading the SDK Developer Runtime for directx9.0a... i've set made a custom Visual Studio setup project which (at least on the machines i've tested - winxp/2003) installs managed directx. since NONE of the executables from microsoft installed it - except for the developer runtime. you can try my setup here My Managed DirectX Setup (1.1Mb) (just install it on the same directory which it is... it installs the assemblies to the GAC) or microsoft's developer runtime download. DirectX 9.0a Developer Runtime (86Mb)
×
×
  • Create New...