How does one seperate parts of an image using EaselJS canvas manipulation library - easeljs

I'm trying to create segmented parts of an image... like the top right square of an image can be highlighted or clicked on while the rest of the image isn't. I tried to google this stuff and I found codes related to container but I'm not sure if that's what I want.. How can I make parts of image segmented so I can fire events on mouseover/mouseselect etc...

You could either define a hitArea (http://www.createjs.com/Docs/EaselJS/classes/DisplayObject.html#property_hitArea) if your image only requires one segment or if you want multiple clickeable areas on one image: Split up the image through using multiple Shapes via beginnBitmapFill (an example for bitmapFill can be found here: http://jsfiddle.net/lannymcnie/nmLhu/) and then put the listeners on the individual shapes.

Related

Delphi - How to make a PNG image the main form?

I have an application which the main form of it its called Fmain. How can i make the Fmain to be the PNG image which i have as Image1 assigned in my source?
FMain.brush.bitmap:=Image1.picture.bitmap;
that's for if the Image1 is a *.bmp one, but i need the transperancy of my PNG file.
I don't think you will be able to make a custom shaped TForm with a transparent png.
Have a a look at this answer Irregularly shaped forms and more specifically to this http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Forms.TCustomForm.TransparentColorValue .
Are you wanting to make a form that has an odd shape? As in, you want to have the transparent parts of the PNG not be clickable as a form? If so then you are going about it the wrong way. If you were to put an image on the form and set the transparent properties on the image, then all you will do is see the form behind the image.
If you want to have a form that is the shape of the visible area of the PNG then you need to create an oddly shaped form. This is done by using regions and SetWindowRgn.
Luckily there is a handy tool out there for this: Gabes OddForm Assistant. I have used this to great effect a number of times.
In order to use it you will need to save your PNG as a bitmap and then load it into the utility. Once it is done it will give you the code required to make the form. You can just have a look in the pas file it creates and see how it is done, tinkering if you feel the need. You can either use the form directly or graft the code to where you need it.
Hope this helps.

Populate API data on action button shows in Image

I am working on App in which images comes from the server. Now in that image some of the points will be already there on which on i have to make a click action & show information of that particular touch.
Here is sample Image:
Now here in above image you can see the points. that is a part of image. I need to put action over there if click on that area than show the information of that particular area from API.
Can anyone suggest me the way of it & also any alternative solution if this one is not possible.
Thanks.
Assuming that your API also tells you a co-ordinate for those points that are highlighted in the image, then...
Calculate a CGRect based on the point, either as a fixed size if they are all the same, or based on the text the API would have to supply you.
Add a UIButton as a subview to the view holding the UIImageView, make this button a CustomType, with no text or background image.
Add a tag to the UIButton so that you can uniquely identify an clicks
Add targets for the buttons, in the IBAction, use the tag from the UIButton to work out the element you are interested in and process accordingly.
If you're API isn't given you positions of the points, then I would suggest the API needs improving

Can we identify image having any overlay using quartz?

I have to work with image which is coming from some server. We want to process that image so that we can find out does it contain any specific color region.
Is there any way so that the image coming from server will be overlaid image & on device side we can process it to check if it contains those overlays?
I have never being worked on quartz stuff. If anybody can suggest some other solution?
There are several ways to do this depending on how complex you wish to get. OpenCV has image blocking which can segregate images into distinct regions. Or check out Image tools especially blob extraction and then look at the general pixel colouration in a single blob.

Multi changeable areas of a image on a iPhone

I have an image with picture of a person and I want to let the user to pick some area of the person and change the color. But how can I best create a multi-mask image?
E.g. should the user be able the change the color for a leg or a hand.
I am using Titanium Appcelerator, and right now I had a solution with buttons placed over the image, which is not a pretty and accepted solution.
The Kitchensink example, has only one area which can be changed.
The only solution I found for working with sections of an image is to divide the image into different views then use a vertical or horizontal view to glue them together. Sounds like you took a similar approach using buttons.
Another option might be to use one of the jQuery image libraries within the webview. This most likely will have a performance penalty though.

Modifying, coloring and dragging pre-existing images iPhone application

I am developing an iphone application which would let me modify the image by dragging other images over its top along with functionality that would let me choose a specific color from the image and replace it with some other color shades i choose. If anyone has some clue like how to actually implement it or some code, that would be great help for me to proceed in right direction
Thanks in advance :)
If you just want to overlay images, you can simply drag UIImageViews around and position them within the view hierarchy such that the appropriate images are overlaid one on top of the other.
For generating a new image out of those composited images, you may want to use something like CGContextDrawImage() within a UIView subclass's -drawRect: method or in a custom CGContext. You can also refer to these similar questions:
How can we combine images and get image object from this two images in iphone apps
Combining images
As far as selectively replacing a specific color within a UIImage, that's a commonly asked question here:
In a UIImage (or its derivatives), how can I replace one color with another?
How to make one color transparent on a UIImage?