I have an application written using SFML with a menu bar up at the top and a small box that lets you move things around under it. I need to convert the coordinates that I have from the View that I am using in the box to window coordinates so I can check if they are inside the box or not. I know that convertcoords converts window coordinates to view coordinates but is there a way to do that in reverse?
With the latest SFML version (i.e. directly from GitHub or my Nightly Builds) you'll get the two functions mapPixelToCoords, formerly known as convertCoords, and mapCoordsToPixel, which is what you're looking for. Both functions are defined on the sf::RenderTarget and you can either let it use the view of the render target or provide an custom view.
...um, what? I'm not sure what you mean by 'View coordinates.' I think what you need is CWnd::MapWindowPoints, in which you can read about here.
mmm... I think there is no such function, you'll have to do it manually
http://en.sfml-dev.org/forums/index.php?topic=3257.0
Related
If you look at the thumbnail images in Windows Explorer you'll notice that they have a drop shadow, is this effect associated with the ListView control or does Windows Explorer does some extra coding to accomplish this effect?
Edit:
So it turned out that Windows uses another control. So my question now is how can I add a drop shadow to the "normal" ListView.
For a standard list view, you may want to use a technique called custom draw (https://msdn.microsoft.com/en-us/library/windows/desktop/ff919569(v=vs.85).aspx).
Basically, you ask your list view not to draw its items, but instead send you some window messages for you to draw them yourself. This is a very flexible but also troublesome technique, because you need to handle many things (like whether an item is selected/disabled, font, color etc.)
The drop shadow you see in Windows Explorer is not publicly available for you to use. So you will have to custom-draw the items (NM_CUSTOMDRAW) by yourself.
Not sure if such effect is available in GDI/GDI+, but Direct2D does have one: https://learn.microsoft.com/en-us/windows/win32/direct2d/drop-shadow
I'm working on an application, and part of it is making the user create a shapes such as squares or rectangles. I'm wondering if there is a function in wxwidgets that enable the user to do that. What i want to do is the user will click this button then he/she can draw a square or rectangle in his/her desired size. It is like in paint where you can make your own size in your desired size. Is that possible in wxwidgets and codeblocks? maybe some related links or tutorials or anything that will help. thanks !!
You should use this contrib library:
Object Graphics Library
OGL defines an API for applications that need to display objects connected by lines. The objects can be moved around and interacted with. You can find this in contrib/src/ogl, contrib/include/wx/ogl, and contrib/samples/ogl.
This is the link:
http://docs.wxwidgets.org/2.8/wx_utilities.html
Max
Titles sais context here is "drawing", ok.
But in case you are talking about user-created rectangles as means of selecting stuff (or users end up here while searching for that context), jargon for that is rectangles as selection is "marquee selection", and you would look into Wx::Overlay to accomplish that.
I've been using label to display images. I'd like to be able to click and create a bounding box then be able to drag the cursor to move around in the image. What would I need to do this? Thanks.
I'm not 100% sure I understand what you are trying to do, but I think the QGraphicsScene is what you are looking for. You can (among many other things):
Render images (QGraphicsPixmapItem, for example)
Change the zoom level when rendering the scene on a QGraphicsView.
Select things using a "rubber band"
Move items around with the mouse (see QGraphicsItem::ItemIsMovable)
etc.
You may need to get familiar with Qt's graphics view framework.
I have an visaul object up and running
GetwindowoffsetEx moved the canvas around
But I cannot change the size of the canvas to my needs
Like should I not beable to change the canvas size for a A4-A3 printer or to a picture size
can this be done using the windows API
I do not seem to get the instructions to do this.
I take it that if I want a Zoom, I strech draw from another cavuas
am I asking the obvious in all this.
Lex Dean
I'm struggling to understand exactly what I need but you seem to want to map between two coordinate spaces in GDI.
Whilst you can use the fully general SetWorldTransform(), I suspect you are better off with the following functions:
SetWindowOrgEx(), SetWindowExtEx()
SetViewportOrgEx(), SetViewportExtEx()
The MSDN documentation also includes a full list of functions related to coordinate space transformations.
I have just installed a program on my pc and after that, an animated arrow is appeared on the screen showing me a new element on the bar:
How can I create this animated arrow ? What API do I have to use ?
It can be made with a window that has a custom shape. One of my colleagues documented how to do this in .NET here:
http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx
http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx
The same thing can be done in C++ by following the technique
I'm not aware that such a capability is exposed in an API. I expect the app draws it directly which it is of course perfectly entitled to do.