Image Crop component - delphi

I need a simple component to do image crop, to use inside an option where user must select an image, photo, or logo to represent them.
I already done some search with Google but found nothing good.
I would something with source code.

A TRect, DrawFocusRect and some handling of OnMouseDown, OnMouseMove, OnMouseUp for allowing user interaction to draw the cropping frame
and
BitBlt to do the actual cropping after the user is happy with the selection he made.
And look, there is an example which uses those same ideas: http://exampledelphi.com/delphi.php/tips-and-tricks/crop-image-with-drag-the-mouse/.
God bless!

Try ImageEn from http://www.hicomponents.com/main/. It does what you want and a lot more. It is free, but not sure if you can get source with it.

Related

Use image library from Hammerspoon

I'd like to use a more sophisticated graphics or GUI widget library in my Hammerspoon config file, in order to get user input and do more advanced drawing on the screen than Hammerspoon allows (as far as I can tell) by default. I'm new to Lua and Hammerspoon, and so far I've been unable to figure out how to get this working. (Simple drawing on-screen is not a problem, so examples of geometric shapes are not helpful. I can do that already with no difficulty.)
I initially thought one of the Lua libraries designed for building games would have more than I could possibly need, and looked into love2d, but it did not appear to be possible to use with Hammerspoon in any straightforward manner.
To give two concrete examples of things I'd like to do:
I'd like to display a dialog box in which the user can enter two values, to specify how many rows and how many columns they want in their screen grid. A native Cocoa dialog would be better, but something graphically drawn on screen with Lua would be fine, as long as the details of the image are abstracted away for me, and I can just define the text and fields and buttons in the dialog.
I'd like to draw a dotted-line rectangle with curved corners and a shadow around specified grid segments as a preview of where a window would be moved if the user completed a certain command.
There's a lot more, but anything that allows me to do those things should allow me to do anything else I want.
We don't yet have a good answer to generating dialog boxes, although it is possible to do it with AppleScript, which you can call from Hammerspoon with hs.osascript.
As for drawing things like dotted-line rectangles, we can't currently do that, but if you'd like to file an issue on our GitHub project, it's something we can look at for a future release :)

show region with different color

I have an app where I am showing map where I will be showing the driver area allocated to him.
Client want this area will be highlighted with some color.
Sample can be as below.
Any idea how this can be done?
What I was planning to do is having images for different regions and show image for respective area.
However I just wanted to check if this can be done using MapKit that we already have, I don't want to go with images.
More info on this would be appreciated.
I didn't thought this would be so easy...
Below link will do the trick I was looking for...
http://www.shawngrimes.me/2011/04/adding-polygon-map-overlays/
Something you may want to try for performance reasons is to use TileMill to parse the source data (KML, SHP, etc.) and render out raster tiles, possibly with alpha transparency so that they can be used as a true overlay. Then, you could use those tiles in MapKit or something like Mapbox.
you can see HTML "map" tag with "area":
http://www.w3schools.com/tags/tag_area.asp

Obtain iOS7-like blur effect with Qt

I was asking myself how I could obtain an iOS 7 like blur/transparency effect. Something like this:
(source: ilounge.com)
I'd like to apply this to a whole QDialog. I know how to obtain a nice transparency, but not how to get this blur.
Can someone help?
Thanks a lot!
Basically, you need to first get a screenshot of the desktop. Then you need to blur it. Then probably save the image to the harddrive. Then you need to set it as the background for your dialog.
And then you need to make the background for each button transparent, too.
If you use QGraphicsView or OpenGL, the last three steps may be very different.
http://qt-project.org/doc/qt-5.0/qtgui/qscreen.html#grabWindow
http://qt-project.org/doc/qt-5.0/qtwidgets/desktop-screenshot.html
Lines of code where it actually grabs the screen:
QScreen *screen = QGuiApplication::primaryScreen();
if (screen)
originalPixmap = screen->grabWindow(0);
In Qt 4.8, it used to be done this way:
http://qt-project.org/doc/qt-5.0/qtgui/qpixmap.html#grabWindow
To blur the screenshot, use this:
http://doc-snapshot.qt-project.org/4.8/qgraphicsblureffect.html
You may need to save it to the harddrive for QStylesheets to be able to find it.
To set the background image, try something like this:
http://qt-project.org/doc/qt-5.0/qtwidgets/stylesheet-reference.html#background-image-prop
Example of how to set a stylesheet:
qApp->setStyleSheet("QLineEdit { background-color: yellow }");
http://qt-project.org/doc/qt-4.8/stylesheet-examples.html
http://qt-project.org/forums/viewthread/1397
Hope that helps.
Thanks a lot for your help phyatt, I succeeded. Although my code works, the result is not as pretty as iOS':
iOS7-like blur with Qt
however, I'm going to post the whole code on my website, I'll post the link here in a while.
Stay tuned!
[EDIT] here's the link to the detailed how-to: iOS7 like blur effect with QT

Whats the best way to check whether one image is somewhere on/similar to another image?

I want to use openCV to check whether an image is somewhere on another image. This other image could also be a photo. I dont want to know the position or anything, I just want to know whether the image is there or not - or, if the images are "equal enough".
Example: I use my iphone to take a photo of a static object. Now, one day later I take this photo again and I want to check if it is the mostly the same object.
Whats the best way to do this? I alos tried CVMatchTemplate (but was not able to get a working check) and CVNorm.
Maybe SURF (Speeded Up Robust Features) can to this.
I used it to check if an template image can be found on objects along an moving conveyor belt.
Have a look on this page, it describes the usage of SURF with the EMGU-OpenCV wrapper classes.

Where can I find an image watermark control for Delphi?

Is there a good image watermark control for Delphi? It would be nice if it could receive both text and images to insert in a base photo.
I would also prefer it was free.
I couldn't find any pre-packaged controls. But watermarking is not very hard at all. All you simply need to do is draw an image on top of another image with the use of alpha blending. This site has a whole section on alpha blending in Delphi. They provide links to graphics libraries which have implemented it.
However if you're using Delphi.NET, and can access the relevant classes in the framework, there is an easier way using only framework methods.
Take a look at Graphics32 together with GraphicEX.
Or see if PascalMagick does the trick.

Resources