I am developing a tool which will allows the user to import the video clips and make the movie from those video clips.
To represent the imported video clips i have created the IKImageBrowserView and add the frameimage of the videoclip as a Thumbnail image. up to here everything is working.
But now i wanted to display the thumbnail image size based on the video clip duration. i.e each and every thumbnail image have the different size based on the duration. (i wanted to show the thumbnail image width going to be changed based on the duration of the video clip.
If i use [imageBrowser setCellSize:];then it will affect all the thumbnail sizes. but i wanted to apply different size for each and every thumbnail.
Can anybody help me to solve this problem?
if IKImageBrowserView is not the best suitable for my problem then please suggest me the best control to solve my problem.
The best solution will be implementing your own IKImageBrowserCell subclass for your custom IKImageBrowserView
First of all, you need to subclass the IKImageBrowserView and override newCellForRepresentedItem:
In this method, return an instance of your own subclass of IKImageBrowserCell.
In your subclass of IKImageBrowserCell, override the following methods to modify the layout dynamically based on the represented video clip:
(To retrive the video clip data model which should conform to the informal protocol, IKImageBrowserItem, use -[IKImageBrowserCell representedItem])
- (NSRect) imageContainerFrame;
- (NSRect) imageFrame;
- (NSRect) selectionFrame;
- (NSRect) titleFrame;
- (NSRect) subtitleFrame;
- (NSImageAlignment) imageAlignment;
There is also a demo project on ADC which can be found at
http://developer.apple.com/library/mac/#/legacy/library/samplecode/ImageKitDemo/Introduction/Intro.html
Related
I would like to apply a CIFilter to a CGPath. A quick searching around reveals this is fairly straight forward on iOS. What are the options on OS X?
Are the steps,
create a image context,
create CGPath which uses the image context,
apply filter,
draw image into the current graphics context (i.e. for the NSView)?
This seems like a huge amount of boilerplate for a reasonably common task. I just want to check that I have not missed anything!
Core Image operates with image's pixels.
Filters in CoreImage generate CIImage objects and not to change original context. But you can create CIContext to draw to the image context.
You can't apply a filter to the image context directly. But you can create a image from the image context, later you can apply the filter, and blend images together.
I have built so far an application that allows the user to drag and drop images onto a NSImageView. However, I want to be able to move these images by simply clicking on any image and hold down the mouse button to move it's location.
How can I manipulate NSImageView to translate/scale after setting the images down? Is that possible? I've read about the NSAffineTransform, but it seems like that is moving the images before creating the image itself. I already have the images on the canvas, and simply want to click and hold the image and move it with my mouse. Please help anyone!
There are two sides to this.
NSImage is the model object, which you might want to display in different ways, save to disk/archive, etc. If you want to actually change the model (scaling, rotating, etc.), implying a permanent change, then you are going to probably want to look at NSAffineTransform, Quartz drawing, etc.
But you probably didn't mean that. Instead you probably are interested in NSImageView, which is a view object, displaying the contents of the NSImage model object using whatever display attributes are desired. If you only want to change how an image is displayed, not what the actual bytes in the image are, then you are going to manipulate the NSImageView at run-time. You can use NSAffineTransform here as well, but it's somewhat uncommon (and usually unnecessary).
The key thing to note that is the NSImageView inherits from NSView, so you have all its power at your disposal. Take a look at certain methods, such as:
-setFrameSize: - useful for changing the view size, and thus the image display scale
-setFrameOrigin: - useful for changing the view position, and thus the apparent image position
Note again that these have nothing to do with images per se, and apply to all Cocoa views. You may want to take a look at a book like Cocoa Programming for Mac OS X to get you past the basics. (You can then do more interesting things, like rotation, animation, etc.)
I have an image view that i would like to maintain the aspect ratio of but still be able to resize the window.
Set the image view scaling property to "proportionally up or down" in interface builder and set the content aspect ratio of the window containing it:
[window setContentAspectRatio:myImageView.image.size];
As far as I know, there's no way to do this "automatically", you'll need to follow the frame change of the window (with the delegate method windowWillResize:toSize:) and adjust your image view's frame however you want it to change.
Is there a way to make animated NSCursor with my custom gif image?
Unfortunately, no--your best bet is to create an array of NSCursors, one for each frame of your image, and set them yourself using whatever animation strategy you'd like (perhaps an NSTimer?).
Coming from the iOS world where we have UIImageView and the property animationImages:
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImageView/animationImages
Where animationImages is just an array of arbitrary animation frames. You specify the images (maybe 15), then set the total animation time (maybe 4 seconds) in one of the other properties, then just start the anim and the images in animationImages will play sequentially over the specified time with an even frame rate.
How would I do the same with WP7/Silverlight? This all Expression Blend seems wonderful, but I just can't find a way to animate the image source (I'm guessing it might be impossible). How would I do the same? Should I add a unique image object for each frame in the animation, then play around with visibility/opacity properties and manually have to create all the spaced out key frames? That sounds like a lot of extra work + overhead and not a nice way to go...
http://www.windowsphonegeek.com/articles/WP7-Animations-in-depthndash-Overview-and-Getting-Started
http://www.wearerighteous.com/wp7-development/xaml-animation-in-silverlight-for-windows-phone-7/
http://www.windowspresentationfoundation.com/?p=712
Try out these links. Especially the first one, I think the first one resolve all you doubts. In wp7 we can go for two options either XAML based (static) animations / or with the help of C# code. By using blend u can create all sot of static animation with out any issue. Here the animation is working on the basis of page frames. If u are interested in learning more about Animation try this too;
http://msdn.microsoft.com/en-us/library/cc189019(v=vs.95).aspx
You can actually animate the Image.Source property here's a tutorial.
Animating Images in WP7