|
How about trying DrawImageUnscaled?
|
|
|
|
|
Hi Leppie,
That wont work - I need the image scaling.
Looking around a bit, I think that GDI+ is being too clever. I noticed that the PNGs that didnt work well had a different Dots-per-inch setting to ones that did.
So, I suppose I aught to amend my question to say how do I get GDI+ to ignore these values, and simply do what I asked of it - scale a bitmap to fit a rectangle
thanks
Jason
|
|
|
|
|
I don't htink GDI+ does anything with DPI. You can set DPI in code tho, if you need to try that.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Am in a windows application(C#) where i need to rotate,move,pan for the loaded DWG file through "CODE".Is that possible??
Priya
|
|
|
|
|
I just posted this in the VB group, but then realized that this is most likely the proper place to post my question. Here it goes:
I have opened an image as a bitmap using GDI+. Before I save it I want to know if the image has transparency in it. That is; is there any pixels in the bitmap that has the transparent color? I have made a solution that looks like this:
Dim objImage As Drawing.Bitmap = Drawing.Image.FromFile("png_with_transparent_bg.png")
Dim booTransparentColorFound As Boolean = False
If Bitmap.IsAlphaPixelFormat(objImage.PixelFormat) Then
For y As Integer = 0 To objImage.Height - 1
If booTransparentColorFound Then Exit For
For x As Integer = 0 To objImage.Width - 1
Dim objColor As Drawing.Color = objImage.GetPixel(x, y)
If objColor.A = Color.Transparent.A And _
objColor.R = Color.Transparent.R And _
objColor.G = Color.Transparent.G And _
objColor.B = Color.Transparent.B _
Then
booTransparentColorFound = True
Exit For
End If
Next
Next
End If
The problem is that if the image is very big, and there is no transparent pixel in it (or a transparent pixel is located in the lower right corner), the routine is very slow. Is there some quicker way to determine if there is transparency in the image?
Thanks in advance.
...Allan, Denmark
|
|
|
|
|
There are two things you could do (first way will not speed up the processing but is just a method improvement):
1) Only need to check the alpha channel (assuming any transparent colour is counted)...
If objColor.A != 255 Then ...
(As the alpha channel IS the 'trasparency' aspect of the colour, you only need to check this).
2) Lock the Bitmap and loop through the raw data (this is REALLY fast)... loads of examples on web... from msdn[^]
Also... if all you want to know is if the image could contain transparency... check the PixelFormat of the bitmap for transparency.
Hope this helps.
Matthew Butler
|
|
|
|
|
You will have to use C# and go unsafe for better performance.
|
|
|
|
|
Hi all,
i make one application in which i have one picturebox and i want to make picturebox mirror vertically. so image is displayed mirror vertically. so is there any methode or property available for this situation ?
Thanks in advance ..
Rana Krishnraj
|
|
|
|
|
Before you load the PictureBox with the image...
theImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
Hope this helps.
Matthew Butler
|
|
|
|
|
hi Matthew,
Thanks for replying.. Its a perfect solution
Rana Krishnraj
|
|
|
|
|
hi
it dosent work for an image that captured by BitBlt?!!!
what should i do if i want to mirror this image(a BitBlt image)?
و این منم زنی تنها در آستانه فصلی سرد...
|
|
|
|
|
i fix that!
System.IntPtr srcDC = GetDC(f.Handle);<br />
Bitmap bmp = new Bitmap(50, f.Height + 30);<br />
Graphics g = Graphics.FromImage(bmp);<br />
System.IntPtr bmDC = g.GetHdc();<br />
BitBlt(bmDC, 0, 0, 50, bmp.Height, srcDC, r, -30, 0x00CC0020 );<br />
r += 10;<br />
ReleaseDC(f.Handle, srcDC);<br />
g.ReleaseHdc(bmDC);<br />
g.Dispose();<br />
<br />
Image img;<br />
img = bmp;<br />
img.RotateFlip(RotateFlipType.RotateNoneFlipX);<br />
f3.pictureBox1.Image = img;
i should set bitmaps width to 50!(because my pixtureboxs width and actually my last images width is 50);
tnx.
و این منم زنی تنها در آستانه فصلی سرد...
|
|
|
|
|
Alan Simes did the port. Is it avaialable anywhere?
|
|
|
|
|
seriously, try looking here:[^]
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
I did try using google. All the links I found are no longer functioning.
|
|
|
|
|
Sorry, I was not pulling your chain.
There is a J# version out there, and I suspect you can just use the project in a solution,just like it was a C# project(only it's J#).
The code is similar enough that your c# knowledge will let you figure out the algorithms. Other than that,it is no different than having both c# and vb in separate projects in the same solution.
So download the J# project, and just pretend it's c#.
Silver member by constant and unflinching longevity.
|
|
|
|
|
The original C# version is still available if you dig at: https://xgsuite.svn.codeplex.com/svn/Warp3D/Warp3D/
Can anyone clarify the license of Warp3d though?
|
|
|
|
|
That was a real dig!
I asked Brian Keller if he has any idea bout the license.
I will pass it on if he responds.
is IDX3D worth using at this point, or is it good for studying technique?
Are you using it for a project?
Silver member by constant and unflinching longevity.
|
|
|
|
|
From Brian Keller:
-----------------------------------------------------------------
Sorry, I have no idea.
-----Original Message-----
From: rmustakos@att.net [mailto:rmustakos@att.net]
Sent: Wednesday, October 28, 2009 8:49 AM
To: Brian Keller (DPE)
Subject: (Brian Keller: Technical Evangelist for Team System) : warp3d/idx3d
license
Importance: High
Do you know how t ofind out what the license terms are on warp3d? I am having a
hard time finding any references to it other than yours.
Here is a link to the c# code, if you want to fix the link in your bolg (from
2005 ;^P)
<http://blogs.msdn.com/briankel/archive/2005/08/02/446780.aspx>
<http://blogs.msdn.com/briankel/archive/2005/08/02/446772.aspx>
-----------------------------------------------------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi! I 'm studing on visualization raw data
I displayed image on base plane But Image is shear. How can I compute final image from image on base plane
|
|
|
|
|
Hi Guys,
I have a .net application, in which a frequently used screen experience a GDI leak. Using GDILeakDetector, i found the kernel address of the bitmap object, which is causing the leak.
Handle : 0x3a0509ea
ObjectType : Bitmap
Kernel Address : 0xe2cc9d28
Extended Information : Width: 12, Height: 12 , Bits/Pixel: 32
Now i need to find out what is that object in the screen (i.e) object details, from the kernel address. Can u pls help me out in this how could i point out the object in the screen and also how to dispose it on form close.
Thanks in advance 
|
|
|
|
|
How many forums did you post this in?
Anyway, why not ask it in the forum specifically for GDILeakDetector? Personally, i'd be more interested in finding the code that's forgetting to release the handle - since that you can actually find fairly easily...
Citizen 20.1.01 'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'
|
|
|
|
|
Noordeen Shah wrote: I have a .net application, in which a frequently used screen experience a GDI leak.
Everyone knows .NET languages prevent leaks. That's a C++ problem and why everyone should switch to proprietary Microsoft languages.
2 75 22 6
|
|
|
|
|
I had this incredible idea and i dun know how to implemnt it.
I want to create an external graphics card(i have no idea how to make 1) attached via USB port which can run games(not the current released versions but games made for this graphics card) ppl with sh***y graphics card would not have to waste money on new cards. Although they will not be able to play new games made to run on Nvidia/Ati graphics card.
The biggest problem i'm facing now is how to display all these 3d calculations of images or models onto the desktop.
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">duo!@# wrote:</div>The biggest problem i'm facing now is how to display all these 3d calculations of images or models onto the desktop. </blockquote>
Well, no, that's not your biggest problem.
This post has nothing to do with this forum, that's problem 1.
A USB port is not fast enough to run a high speed 3D card, that's problem 2
You want people to buy a special card, then buy games especially for this card, rather than wasting money on a new card ? Buy a new card to avoid spending money on a card ? That's a doozie.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|