|
Dear All
Regards!
I am using OpenGL(CSGL) in C#, i draw a line and now want to zoomin and zoomout it in OpenGL, kindly help me while developing program for Zooming in openGL.
Regards
David
david
|
|
|
|
|
How can i change alpha channel values without rinning Height*width loop
Is there any way that i can drawimage without altering alpha values of background??.
i mean i have two images where bye sequences of pixels will be as follows
22 0
34 0
56 0
255 14
55 0
22 0
44 0
255 10
23 0
37 0
56 0
255 14
51 0
28 0
44 0
255 10
now i want to replace 255 with other values or Replace 0's with values from first column.
|
|
|
|
|
I'm confused. How does a drawimage alter alpha values of a background?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If i create the graphics object from a bitmap object which has some alpha values.
Now using this graphics object if i draw some other bitmap on firstbitmap the alpha values are altered i mean they will be set to 255.
|
|
|
|
|
Gotcha.
Since there's only two compositing modes, you may have to loop through and combine the alpha
values the way you want to.
SandipG wrote: now i want to replace 255 with other values or Replace 0's with values from first column.
CompositingModeSourceOver works for the "Replace 0's with values from first column" case but not
for the "replace 255 with other values" case.
Here's some code you can play with to see the compositing results...
Gdiplus::Bitmap Bitmap1(20, 20, PixelFormat32bppARGB);
Gdiplus::Rect rect(0, 0, 20, 20);
Gdiplus::Graphics *pBitmapGraphics1 = Gdiplus::Graphics::FromImage(&Bitmap1);
pBitmapGraphics1->SetCompositingMode(Gdiplus::CompositingModeSourceOver);
Gdiplus::SolidBrush solidbrush(Gdiplus::Color(0xFF,0x00,0xFF,0x00));
Gdiplus::Pen solidpen(Gdiplus::Color(0x40,0xFF,0x00,0x00), 1.0);
pBitmapGraphics1->FillRectangle(&solidbrush, rect);
pBitmapGraphics1->DrawLine(&solidpen, 0, 0, 19, 0);
delete pBitmapGraphics1;
pBitmapGraphics1 = 0;
Gdiplus::BitmapData bitmapData;
Bitmap1.LockBits(&rect, ImageLockModeRead, PixelFormat32bppARGB, &bitmapData);
RGBQUAD *pRGBQuads = (RGBQUAD *)bitmapData.Scan0;
Bitmap1.UnlockBits(&bitmapData);
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I played with it but it works with pens and brushes only.
No change in effect of DrawImage.
|
|
|
|
|
With DrawImage(), on the destination Graphics...
SetCompositingMode(CompositingModeSourceCopy) will cause the drawn image to replace whatever was
in the destination image.
SetCompositingMode(CompositingModeSourceOver) will cause the drawn image to be blended with
whatever was in the destination image (the resulting alpha values are not always set to 255).
You should get the same results as with a pen and a brush. A bitmap filled with values with alpha
set to 0 drawn on an image with alpha set to, say, 0x80, will leave the destination alpha 80.
That matches your replace 0s with the first column alpha value, just like with a brush or pen.
Regardless, I guess my point was that to get the results you want with the alpha channels, I
don't believe the APIs are going to do it.
Even though you were looking to avoid it, LockBits/UnlockBits makes it relatively trivial to loop
through the images and combine them yourself.
Mark
-- modified at 13:09 Monday 25th June, 2007
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi ,
I need a function to warp image .
Warp(HBITMAP,HBITMAP,point1,point2,point3,point4) or
Warp(Byte*,Byte*,inputsize,point1,point2,point3,point4)
this function would tranform image to fit the quadrilateral pointed by four points.
there is artical on codeproject AAform which is really very good but it is very slow.
for me that quadrilateral will always be convex.
Some help in this will be highly appreciated
Thanks in advance.
Sandip.
|
|
|
|
|
There's the old PlgBlt fron GDI:
"The PlgBlt function performs a bit-block transfer of the bits of color data from the specified rectangle in the source device context to the specified parallelogram in the destination device context."
However, it probably doesn't do the anti-aliasing mentioned in the AAForm article.
Have you looked at the GDI+ functions? There looks to be about twenty different 'DrawImage' methods in the Graphics class, as well as a SetSmoothingMode method with a SmoothingModeAntiAlias as an option (although this method may just apply to lines and curves).
|
|
|
|
|
I tried GDI+ DrawImage but it will always fit image in parallelogram where is in my case it always need not be parallelogram.
|
|
|
|
|
I want to know how can i make Intelligent Connectors,like those in MS Visio that connect 2 or more blocks and when the blocks are moved, the connectors position themselves accordingly without interferring with any other block.
Is it possible to make such connectors using VC++? I need this as i have to do a the same for my project.
Pls help
Meenu
|
|
|
|
|
whatitis wrote: Is it possible to make such connectors using VC++?
Yes.
|
|
|
|
|
How....can u explain a bit more..
Regards
|
|
|
|
|
I want to know how can i make Intelliegnt Connectors,like those in MS Visio that connect 2 or more blocks and when the blocks are moved, the connectors position themselves accordingly without interferring with any other block.
Is it possible to make such connectors using VC++? I need this as i have to do a the same for my project.
Pls help
Meenu
|
|
|
|
|
Hi all, I'm having trouble with drawing on a secondary screen. When I use IDirectDrawSurface7::Blt to draw with a window totally inside the primary screen, it works well. However, when I move the window so that it's half on primary screen and half on secondary screen or move the window so that it's inside the secondary screen, this function returns E_NOTIMPL. What should I do to make it works on secondary screen? Please help me!
Thanks.
-- modified at 23:03 Sunday 17th June, 2007
|
|
|
|
|
My application is a scrolling histogram. With each tick of the clock I add another rectangle to the graphicspath and then use TranslateTransform() to scale and "scroll" the data.
Unfortunately this app must run 24/7 for weeks (months?!) at a time so the GraphicsPath gets very big. Does anyone know a way to remove PathPoints from a GraphicsPath? Something better than the following barebones class?
Thanks for having a look.
Public Class SizeLimitedGraphicsPath
Private Gp1 As New GraphicsPath
Private Gp2 As New GraphicsPath
Private ActivePtr As GraphicsPath
Private InActivePtr As GraphicsPath
Private NextActiveGp As Integer
Private _minimumSize As Integer
Public Sub New(ByVal MinimumSize As Integer)
_minimumSize = MinimumSize
ActivePtr = Gp1
InActivePtr = Gp2
NextActiveGp = 2
End Sub
Public Sub AddRectangle(ByVal rect As RectangleF)
Gp1.AddRectangle(rect)
Gp2.AddRectangle(rect)
SwapIfNecessary()
End Sub
Public ReadOnly Property gp() As GraphicsPath
Get
Return ActivePtr
End Get
End Property
Private Sub SwapIfNecessary()
If InActivePtr.PointCount > _MinimumSize Then
If NextActiveGp = 1 Then
ActivePtr = Gp1
InActivePtr = Gp2
Gp2.Reset()
NextActiveGp = 2
Else ' Nextgp = 2
ActivePtr = Gp2
InActivePtr = Gp1
Gp1.Reset()
NextActiveGp = 1
End If
End If
End Sub
End Class
Wfanning@gso.uri.edu
-- modified at 8:29 Monday 18th June, 2007
|
|
|
|
|
Hello Everybody,
Currently, programming in C, C++, VC++ 7.0, GDI, GDI+.
Trying to develop Bevel Effect that can be applied on 32 bit images (Tiff, etc) depending upon the shape of alpha channel.
Need some guidance in the form of links, articles or code.
Regards,
Sameer.
|
|
|
|
|
I need a routine that, given a target bitmap and a mask, will smooth the contours of the portion of the target indicated by the mask, e.g. "AntiAlias(HBITMAP hbmp, HBITMAP mask))" I phrase it this way, because the little I understand about anti-aliasing, it needs to know the target background to achieve optimal effect.
The mask could be a piece of text for example, (e.g for font smoothing), or some other shape on a monochrome bitmap, corresponding to the item on the target bitmap whose outline is to be anti-aliased.
Supposedly, the anti-aliasing capabilities of The AGG Project[^] are the best, but their package looks very complex. However something based on their algorithms would be good. There is also a Code Project article[^] on anti-aliasing as well but it concerns straight lines exclusively.
Thanks for any help.
|
|
|
|
|
Looks to me like you're asking for a blur filter, because you want to 'antialias' a bitmap, when the method really works when you're in the process of drawing lines. If you read my image prcoessing articles, I talk about bilinear and bicubic filters there. Basically, what antialiasing does, is it says for an edge pixel, I really want to only draw on x% of this pixel, but as that's not possible, I merge the color of the underlying pixel with the color I want to draw, so it's x% the color I want to draw, and 100-x% the color that it was before.
The issue you will have is working out both which areas you're antialiasing ( assume all the pixels that differ ), and how much they need to be antialiased, which is probably impossible to work out. Some sort of general algorithm that does a good enough job to improve your image is probably fairly easy, however.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
"Looks to me like you're asking for a blur filter, because you want to 'antialias' a bitmap, when the method really works when you're in the process of drawing lines."
Say you have some text or other shape on a monochrome bitmap. Are you saying its not feasible are hasn't been conceived of for an algorithm to examine the contour (i.e. border) of this shape and produce a smooth (anti-aliased) version as output, on a target bitmap? Or are you saying this is what a "blur filter" would achieve?
OK here's my application: bitblt-ing textured text to the printer. The resolution of the screen doesn't come close to matching the printer resolution, so I have to smooth it out somehow. I'm using NT, actually, not a newer windows variant.
Actually, the texture on the text is rendered correctly on the printer, but the outline of the font is jagged.
|
|
|
|
|
Force Code wrote: Are you saying its not feasible are hasn't been conceived of for an algorithm to examine the contour (i.e. border) of this shape and produce a smooth (anti-aliased) version as output, on a target bitmap?
No, I"m saying it's bloody hard work, and if you also have the bitmap WITHOUT the text, to provide the background, you'll get a better result for less hassle if you just rewrite the text with anti aliasing.
Force Code wrote: Or are you saying this is what a "blur filter" would achieve?
A blur filter will recolor all pixels based on the surrounding colours, which will in effect do what anti aliasing does, but blindly and everywhere.
Depending on the nature of the image, a gaussian blur, or similar, may produce an improved result. It may also make it worse
Is the text the only black area on the bitmap ? Do you know where it is ? If you know the area to look, or can identify text, then you can write some code to blur the edges, pretty trivially, which will not be quite what you're looknig for, but it's what I had in mind when I said you could write something easily that won't be 100% what you want, but could give enough of the effect to solve your issue.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As it turns out the AGG project does have some code that I can pretty much paste directly into my project. Actually, its a five hundred line Hello World program[^] that renders text utilizing their Anti-Aliasing process.
|
|
|
|
|
Force Code wrote: As it turns out the AGG project does have some code that I can pretty much paste directly into my project. Actually, its a five hundred line Hello World program[^] that renders text utilizing their Anti-Aliasing process.
I copied this into a test program, compiled it, and it did nothing. So, I replaced their "render_text(ras, ren, sl, gl, 10, 100, "Hello, World!")" with a straight win32 TextOut, and got impeccably rendered "Hello World" output indistinguishable from what AGG supposedly produces. But then, I noticed in their code they were calling the Win32 CreateFont with ANTIALIASED_QUALITY specified. So, I have no idea what AGG achieves on its own. As it turns out, ANTIALIASED_QUALITY was all I needed in my own project to begin with. I was utilizing someone else's code in which CreateFont was called with DEFAULT_QUALITY.
So anyway, nevermind.
|
|
|
|
|
Force Code wrote: I copied this into a test program, compiled it, and it did nothing. So, I replaced their "render_text(ras, ren, sl, gl, 10, 100, "Hello, World!")" with a straight win32 TextOut, and got impeccably rendered "Hello World" output indistinguishable from what AGG supposedly produces. But then, I noticed in their code they were calling the Win32 CreateFont with ANTIALIASED_QUALITY specified. So, I have no idea what AGG achieves on its own. As it turns out, ANTIALIASED_QUALITY was all I needed in my own project to begin with. I was utilizing someone else's code in which CreateFont was called with DEFAULT_QUALITY.
Here's an interesting epilogue to this story.
I recently downloaded GDI+ which I haven't used before. As I said above, just using the straight GDI CreateFont (or actually CreateFontIndirect) and specifying ANTIALIASED_QUALITY, gives you as good text quality for large fonts as could possibly be imagined.
So I was curious about the capabilities of GDI+. With it, you call,
graphics.SetTextRenderingHint(TextRenderingHintAntiAliasGridFit), which gives you the highest quality fonts available through GDI+ for non XP systems (I am using Win 2000.) So I tried it and amazingly, the quality was *much* worse than with straight GDI. It looked like it wasn't anti-aliased at all, until you notice that yeah, it is a *little* bit smoother (This was on 72 point Times New Roman; bold, italic).
This is very strange, since GDI+ itself uses over 180 GDI functions. There is one higher quality font level available in GDI+, only for XP and Win Server 2003 - TextRenderingHintClearTypeGridFit. It supposedly uses revolutionary "ClearType" technology.
I think its clear that what happened is that Microsoft just downgraded font rendering for everything prior to XP, and made their old anti-aliasing algorithm only available for XP or higher, and gave it a new name - "ClearType".
Maybe this has been observed before.
|
|
|
|
|
Guys,
I'm trying to look for the best graphics toolkit to help me out in creating my new application. I'm not sure whether I should choose OpenGL with SDL, Microsoft XNA, etc...
Here is a brief idea about the application:
The Warehouse Watcher is a visualization system that helps warehouse personnel see the warehouse in front of their eyes, navigate through it, and get the information required in significantly lesser time.
Display
The WW system displays warehouse(s) in 3D. It should be capable of displaying one or more warehouses based on the customer needs. The primary objects to be displayed in a warehouse are locations, pallets, items, and labels. The secondary objects are forklifts, staff offices, conveyers, workers, trucks, and other objects that make the graphical representation of the warehouse more realistic. The objects must be displayed in right scale and with appealing graphical representations.
Navigation
The user will have the capability to walk through the warehouse. The user can look and move in any direction. S\he will have the option of exiting the warehouse through its doors and entering into another warehouse. A collision detection system must be implemented in order to make the user’s movement more realistic. The user has the option of whether to enable collision detection or disable it. The user will also have options of magnifying objects, looking into their details and rotating them. The user will also have the capability to increase\decrease his\her speed while walking\running around the warehouse.
Selection
While navigating, the user must have the option of selecting a certain object and looking into its details. When the mouse moves over a certain object, it must be highlighted. This functionality is optional as it would affect performance. In order to implement the selection and highlighting of objects, the selection mode picking method must be used in order to keep track of all objects displayed in the 3D coordinate system. When an object is selected, the user will be taken near to that object and the major information about the object must be displayed on a side pane.
Search
So we were able to walk around the warehouse and navigate the objects, but what if we really want to check a single SKU? Walking around and trying to find this SKU manually will be as much headache as trying to find it physically. That’s why the search functionality would prove to be very useful in trying to find specific objects in the warehouse. For example, if the user is trying to see how an SKU is distributed in a warehouse, s\he can simple search for it, and the system will highlight all the occurrences of this SKU in the warehouse and take the user to its first occurrence.
Data Analysis
This should be the most important part of the project and the reason why a customer would purchase such a product. This part would analyze the customer data and give customers key performance indicators and tips on improving their warehouse operations.
Database Connectivity
Libraries I am thinking of are DLINQ and NHibernate.. Would appreciate if someone can tell me which is better it if there is some other alternative.
Best Regards,
Ali B,
|
|
|
|
|