Home / iPhone

Beginning Core graphics on the iPhone

Rating: 4.0Blog-star
Views: 1996
by Ruchitha Geebu
Last modified: March 2nd 2021

Core Graphics Framework Reference:

The Core Graphics Framework is a c-based API that is based on the quartz advanced drawing engine. It provides low-level light 20 renderings with unmatched output fidelity. You use this framework to handle path–based drawing, transformation, color management, offscreen rendering, patterns, gradients and shadings, image data management, Image Creation masking, and POF document creation, display, and parsing.

Inclined to build a profession as IOS Developer? Then here is the blog post on IOS Development Certification Training.

Structures:-

a) CGpoint
b) CGRect
c) CGSize

A) Struct   CGpoint
     {
       CGFloat   x;
       CGFloat   y;
      } b) struct    CGRect
    {
       CGRect
       CGpoint    Origin;
       CGSize      Size;
    }
c) struct CGSize
    {
      CGFloat width;
      CGFloat  height;
    }

// preparing CGPoint:   (x,y)

CGPoint    pnt;   object   creating   for   CG point
  Pnt .x     =    200;
  Pnt .y     =    50;
           (or)
CGPoint  make   (200,50);

// preparing     CGSize  :     ( width ,   height)

CG size     Size;
Size.    Width     =200;
Size.    Height    =  100;
         (or)
CGSizeMake  (  200,100);
// preparing CGRect   (x,y,  width, height)

CGRect  re;

rc. Origin .x=20;
rc. origin .y=30;

rc. Size. Width= 100;
rc. size. height=200;
(or)
CGRectMake  (20,30,100,200);

Bounds:-

. h file:-

#  import    
@  interface   UI titledViewController   :   UIViewController
{
IBOutlet     UIImage   view*  imgview;
}
-(IBAction )  button   click;
@  end

  . m file:-

#  import   “ UItitledViewController. h”
@  implementation   UItitledViewController
-(void) viewDidload
 {
  Imgview.  Image   =  [UIImage  imageNamed@  “I phone – 4.jpg”]
  Imgview .frame   =    self  .  view   . frame;
 Imgview . alpha  = 1;
[  Super viewDidload];
}
-(IBAction )   button   click
 {
CGRect    rc   =  imgview. Frame;
NSLog   (@  “rc  is    c  %     0. Of,   %  0.of,  %0.of”);
rc .origin  x ,rc. Origin .y,          rc. size. width ,rc size. Height);
                                                       ↓           ↓  
        Point origin             +         point   size  =   CGRect

Dimensions

// Imgview. frame=  CGRectMake  (rc.origin.x+100,
(To make changes                 rc.origin.y+150,                          
    In the image                 rc.size.width+50;
Which is in the Rect )           rc .size. height+50);
// center
Imgview .Center    = self .view .center;
Img view.  bounds

 

Frequently Asked IPhone Interview Questions & Answers

 

 

About Author

author
NameRuchitha Geebu
Author Bio

I am Ruchitha, working as a content writer for MindMajix technologies. My writings focus on the latest technical software, tutorials, and innovations. I am also into research about AI and Neuromarketing. I am a media post-graduate from BCU – Birmingham, UK. Before, my writings focused on business articles on digital marketing and social media. You can connect with me on LinkedIn.