Constrain image Movement in Specific Area in Window RT App - image-processing

Ok.
To describe what I want to do, have you ever used Telerik Crop function Image Editor control?
I want exactly same functionality.
I want to use that control but, I am working on Universal app that has no control like Image Editor from telerik.
That control does are
1. There is a fixed rect or canvas for cropping image.
2. If the original image is in the area of canvas(or Rect) image's opacity = 1(i guess) and if the original image is out of canvas area, image looks dim(maybe opacity 0.5 or some)
3. Constrain original image movement in the canvas.
I will implement this function in Image.ManipulationDelta event.
Do I have to get each point value of canvas? or can I do it by using Width or Height of Canvas?
How Do I do that?
Can anyone help me?
any hint?

I'm not familiar with that particular control, but I think I understand what you want.
To constrain the movement of an Image within a Canvas you can check where the Image will end up in your ManipulationDelta and limit any translation, scaling, and rotation appropriately. If the bounding box of the Image after the transform applies is within the Canvas then apply the transform. Otherwise roll it back and do nothing. I have sample code for this in my blog entry: Constraining manipulations
To dim the area outside of the crop I'd create a shape and fill it with a partially transparent brush. The all-in-one code framework sample How to crop bitmap in a Windows Store app demonstrates this technique. I believe the sample targets Windows Store 8.0 apps, but essentially the same code should work on Windows Store 8.1 or Windows Phone Store 8.1 apps.

Related

Arcore: How can I get the dimensions of an image that I placed on the surface?

I have placed an image on a surface and I am trying to display the height and width of the image when I tap on it (having an idea to select and resize later).
I am converting the TransformableNode to an imageView and then using getHeight() and getWidth(). but is there a simple way provided by ARCOre?
Thanks in advance.
i have created a project like Google measure App where I am scaling the node placed and then getting its size. Here is the link: Object Measurement

UIImageView - anyway to use 2 content modes at the same time?

So in my scenario, I have a square that is (for understanding's sake) 100x100 and need to display an image that is 300x800 inside of it.
What I want to do is be able to have the image scale just as it would with UIViewContentMode.ScaleAspectFill so that the width scales properly to 100.
However, after that, I would like to then "move" the image up to the top of the image instead of it putting it inside the imageView right in the center, basically what UIViewContentMode.Top does. However that doesn't scale it first.
Is there anyway to do this type of behavior with the built in tools? Anyway to add multiple contentModes?
I already had a helper function that I wrote that scaled an image to a specific size passed in, so I just wrote a function that calculated the scaled image that would fit into the smaller square I had similar to the size AspectFill would do, and then I wrote code that would crop it with the rectangle size I needed at (0,0).

How to get rid of empty transparent areas in a PNG image so that it conforms to actual image size?

I have a series of images that I would look to loop through using iOS's [UIView startAnimating]. My trouble is that, when I exported the images, they all came standard in a 240x160 size, although only 50x50 contains the actual image, the rest being transparent parts that are just taking up space.
When I set the frame of the image automatically using image.size.width and image.size.height, iOS takes into images' original size of 240x160, so I am unable to get a frame that conforms to the actual parts of the image. I was wondering if there is a way using Illustrator or Photoshop, or any other graphics editing software for me to export the images based on their natural dimensions, and not a fixed dimension. Thanks!
I am a fan of vector graphics and thinks everything in the world should be vector ;-) so here is what you do in illustrator: file - document setup - edit artboards. Then click on the image, and the artboard should adjust to the exact size. You can of course have multiple artboards, or simply operate with one artboard and however-many images.

issue on image drawing in pdf page- objective c

I am working on pdf creation right now, everything works fine except image drawing, it draws image's upper left corner only; with extra zoomed. But it works on simulator,code shows below;
UIImage *plotImage=[[UIImage alloc]initWithContentsOfFile:
[localPictureArray objectAtIndex:i]];
[plotImage drawInRect:CGRectMake
(kMargin, currentPageY, plotImage.size.width, plotImage.size.height)];
since iam a starter i need your valuable help. thanks in advance.
The problem is likely your CGRect. Assuming that your x and y margins are OK, you probably have an image that is too large to fit on the page as measured from these margins.
You need to determine how far you can draw to the right and bottom and scale the image accordingly. (e.g. as described here)

How to apply a soft shaped shadow to graphics which have transparent areas in them?

Normally I'm using CALayer shadowRadius, but now I also need to use UIImage and apply shaped shadows to it based on the content in the image.
For example when I have a layer with text in it and I set a shadow, it works automatically on the text and not just on the rectangle of the layer.
In Photoshop this is known as "layer style" and it automatically works based on the shape of the image content.
I am afraid that I need to implement some Harvard-Stanford-MIT-NASA kind of hardcore logic to apply a shadow on a "shaped image", i.e. an image of an round icon where the areas around the icon are fully transparent.
I'm able to manipulate images on a per-pixel level as I'm doing this already to draw charts, so if there was an open-sourced implementation of some fantastic algorithms this would be fantastic. And if not: How does this basically work? My guess is I would "just" try to blur a grayscaled version of my image somehow and then overlay it with the non-blurred version.
My guess is I would "just" try to blur a grayscaled version of my image somehow and then overlay it with the non-blurred version.
That's pretty much it, actually. Except instead of blurring a greyscaled version of the image, blur a solid-colored version of the image (i.e. keep the alpha channel, but make all pixels black). Although CALayer's shadowing should do this already for you.
If your images are already composited onto a background (i.e. without real transparency), you have a harder problem as you first need to "remove" the background before you can have the shape of the object in order to generate the shadow.

Resources