Xcode image/pixel manipulation realtime - xcode

Hi I'm looking to do the following:
For a game, Create some effects based on the current view.
The code needs to grab part of a view then manipulate it.
One I need is "glass", so when the character walks behind the glass(or where the glass should be), the code will grab the image behind the glass and stretch it and reprint it where the glass should be, to give the effect of walking behind a lens.
What is the best way to do this?
I've never tried any thing like this before, so any help will be great!

I think you're asking about the image manipulation capabilities of the cocoa framework, in which case I reccomend looking into CoreImage:
http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185
The NSBox draws on top of the player view, the resulting composition gets a CIFilter (distortion) applied to it before drawing.

Related

SFML RenderWindow Views and GUI

I dont know how many people have use SFML, but I basically want to draw my GUI and am unsure of how to do so.
To clarify I know how to draw a GUI but I don't know the 'correct' way to do so.
Currently I am drawing a GUI in the same RenderWindow that is used to draw the Game.
I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).
Now the question is:
Should I render the GUI in the same RenderWindow but in a portion of the 'map' the player is unable to reach and have the GUI View locked on that location displaying the GUI.
Another idea I have thought of (unsure if it is plausible) is to have a second RenderTarget which renders the GUI and is dispalyed in the GUI View.
If there is a method I have not discovered or one that is recommend I am happy to hear about it, I searched but all I have found is the SFML Documentation in which I couldn't find my answer.
Your question is slightly confusing as I do not know whether you are having a design issue, or a technical issue of implementing the UI. In terms of the design issue:
I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).
I haven't encountered where using multiple views will be needed for an UI. Take this example:
The UI consists of all the images in the black area. The positions' of those images are always updated relative to the position of the game view that follows the player around, nothing more. A second view isn't needed because the components (images) of the UI follow the view around, just as the view follows the player around.
Now, if you are having a technical issue, then please elaborate on the exact issue that has some accompanying code and I will do everything I can to help out.

How to make a sort of scratchboard in flash?

I was wondering if someone could teach me how to make a scene in flash where you have an image on top of the other, and you can scratch the top one off to show what's below.
Kinda like those prize cards where you have to scratch the silver thing to see if there's a prize below.
Anyone has any idea if this is even possible in flash?
Yes it's possible, here is one example. I'm sure there are others.
The concept is that you use a mask to hide the image. Then use a mouse move event listener to draw on the mask as the user mouses over the object. Parts of the mask that have something on them (ie: the stuff you're drawing in the mouse move listener) will then reveal the underlying object that was being masked.

Non Opengl es drawing app that uses tool to draw with?

Apparently asking about glpaint raises the ire of many on stackoverflow, so let me ask the question this way in a non-opengle es way.
I have been look at example app's with source code for drawing (like the painting app in the "iPhone for Programmers An App-Drive Approach). I understand how these apps work. My dilemma is this:
I want to have a tool like a pencil on the screen that jumps to any spot I touch and then when I hold it down and move the pencil tool it draws and then when I stop the pencil remains on the screen. I can make an app that displays and moves the pencil. I can make an app that draws without the pencil. I just can't seem to figure out how to do both at the same time.
Any ideas on this?
Wouldn't a draggable UIImageView on top of the OpenGL ES view work? I have made an app that does this and it works well.

Qt - Drawing a Rect/Frame out of a bigger Pixmap image

I've been banging my head about this seemingly easy task and I could really use some help.
I have a wide Image loaded in the gui (using the designer..) and I want to be able to draw only a portion of it, a rectangle.
I need to be able to change this rectangle position over the large image, in order to draw a different part of the larger image at will. In this process the rect must maintain its size.
Using the Ui::MainWindow object I'm able to access the label holding the image and a solution that involves using this option is preferred (in order to keep up with the rest of the code I've already written )
Any solution will be much appreciated :)
Thanks,
Itamar
I would definitely (for ease of use) just place an empty label as placeholder in Designer.
Then implement the paintEvent for this label (delegate it to your own method). You'll have also have to look into QPainter, QPixMap, etc... Should be doable based on these hints and the documentation.
If you want more, I suggest you provide a small code snippet to work upon.
If you want to do this more or less purely through designer, you could put a QScrollArea where you want the portion of the image to appear. If you set the scroll area's scrollbar policy to be never shown, you can then manually change what part is visible via the scroll area widget. However, this would probably be more complex that creating a derived widget and reimplementing the paint function.

Creating a quick look style zooming effect

I would like to create an effect than an image zooms up from a thumbnail size to full screen.
I am not sure what's the right steps to achieve this. Should I create a transparent full screen window and animate a layer on top of it?
Take a look at this CoreGraphics example. Specifically, take a look at the "grow" and "shrink" animations. That's how Apple does it, and that's what you'll want to do too.
Your solution of a transparent window with a CALayer inside is probably the best supported way to do it.
One thing that seems like it should be a good solution (at least it's the first thing I thought of when I wanted to do this) but isn't is NSView's enterFullScreenMode:withOptions:. If memory serves, it was originally meant to do what you're talking about here, but the animation was taken out and it generally doesn't work that well now.

Resources