GLPaint change brush size - iphone

I am new to iPhone application development and currently working on a simple paint application for iPhone. I use GLPaint source code to start with. I tried to change the brush size using the following ways.
I created a UIViewController class and linked it to GLPaint.PaintingView and added different buttons to indicate different brush size.
Tried to dynamically pass images with different images. But initWithCoder was called only when the paint view loads and so the brush image #"Particle.png" is not getting changed
Tried extracting the logic in initWithCoder to another method that takes in brush string as parameter. So that I could call the extracted method while selecting a brush button. Since the brush buttons are in another View/Viewcontroller, the change in image is not applied.
Is there any method to change the brush size just like "(void)setBrushColorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue" that changes color?
Any help will be very much useful. Thank you.

Did you try changing kBrushSize - which is used in call to glPointSize() in -initWithCoder: ?

Related

process brightness on specific part of image

I am creating an application in which i am displaying image view with image and processing brightness on the image using slider. I want that brightness should be done only on the selected part of image and not on the entire image.
I want the brightness should be processed only on the central part of the image without using openGl Image processing.
Please help me to solve this problem. Hey guys Please help me its important for me.
There are several ways to accomplish this. One is to overide the drawRect: UIView method and use a mask. Another is to draw the bitmap yourself in a CGContext. Yet another is with OpenGL.
What have you tried?

how to draw a popover view instead of using image on iPhone?

just like the popover in the attached screenshots, the popover allow user to change themes.
I know that there are some examples around but they are all using images to achieve this, make it hard to change themes.
I believe the app in the screenshots doesn't using images to do it.
thanks for any help!
In my Win background such skins (called "Flat" in Delphi and WinForms) were made by drawing in code: select a color, draw a line, select another color, draw a rounded rectangle and so on.
Also, it is necessary to introduce a class "ColorTheme" with a set of fields for every color used. You may have several ColorTheme instances and swap them when you need to change color theme.

iPhone OpenGL : Adding a background image

Right so I got all my lovely openGL stuff working and I can change the background colour via the property of the view or even the window however for the love of god I cant change it to an image.
I have tried adding it to the nib
I have tried adding a UIImageView as
a subview.
I have tried addiing it as a UIColor
with Pattern
I tried making the OpenGL view have a
clear background and setting the
image on the actual window.
Still no joy!
Issue a glClear then render 2 triangles (ie a quad) to the screen with the appropriate image texture mapped onto them.

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?

Change the resolution of image in iPhone?

I wanted to change the resolution of a image,this image I am getting from remote location.The image I am getting is too large to fit in iPhone screen is their any way to change that resolution?
If you're using a UIImageView then UIView's contentMode is what you need, you should probably set it to UIViewContentModeScaleAspectFit (or the equivalent in Interface Builder).
Assuming you are using some kind of "View" to display the image (rather than custom drawing) you might see if there is some kind of property which would allow you to set the "Mode" of the view to allow various scaling methods.
If you render it, it should scale anyway (see UIImage::drawInRect) However, CGContextDrawImage will scale draw an image into a new context, which you can then use to render to the screen.
If you're looking to actually resize a UIImage to smaller dimensions, this blog post might help.