SlideShare une entreprise Scribd logo
1  sur  47
Xamarin
   Seminar
    26th January 2012
    Copyright 2012 © Xamarin Inc. All rights reserved
Agenda
Getting Started with Core
        Graphics

                       Mike Bluestein
                       Technical Writer
                       Xamarin Documentation Team
                       mike.bluestein@xamarin.com




                                                        Xamarin
    Copyright 2012 © Xamarin Inc. All rights reserved
Introduction
This session will be a primer on using Core Graphics
with MonoTouch.



               What is Core Graphics?
         What are its fundamental concepts?
                   How is it used?
                       Examples



                                                                     Xamarin
                 Copyright 2012 © Xamarin Inc. All rights reserved
What is Core Graphics?
What is Core Graphics?
What is Core Graphics?

            • Quartz 2D
What is Core Graphics?

            • Quartz 2D
            • 2D Drawing API
What is Core Graphics?

            • Quartz 2D
            • 2D Drawing API
            • Images
What is Core Graphics?

            • Quartz 2D
            • 2D Drawing API
            • Images
            • PDF
It’s Device Independent
It’s Device Independent

• Also resolution independent
It’s Device Independent

• Also resolution independent
• Don’t work in pixels
It’s Device Independent

• Also resolution independent
• Don’t work in pixels
• Instead use geometric points
It’s Device Independent

• Also resolution independent
• Don’t work in pixels
• Instead use geometric points
• Code will generally work on any iOS device
Draw with Primitives
Draw with Primitives
• To create geometry
Draw with Primitives
• To create geometry
• Describe how to connect points
Draw with Primitives
• To create geometry
• Describe how to connect points
 • Bezier curves
Draw with Primitives
• To create geometry
• Describe how to connect points
 • Bezier curves
 • Lines
Draw with Primitives
• To create geometry
• Describe how to connect points
 • Bezier curves
 • Lines
 • Paths
Draw with Primitives
• To create geometry
• Describe how to connect points
 • Bezier curves
 • Lines
 • Paths
 • Arcs
Ask to be Drawn
Ask to be Drawn

• Specify various fill and stroke attributes
Ask to be Drawn

• Specify various fill and stroke attributes
• Ask the system to draw the geometry
Ask to be Drawn

• Specify various fill and stroke attributes
• Ask the system to draw the geometry
• Draw during run loop
Draw during Run Loop
Draw during Run Loop
• Drawing with Core Graphics begins life
  during run loop processing
Draw during Run Loop
• Drawing with Core Graphics begins life
  during run loop processing
• During each iteration through the run loop
Draw during Run Loop
• Drawing with Core Graphics begins life
  during run loop processing
• During each iteration through the run loop
 • System checks if any views need to be
    drawn
Draw during Run Loop
• Drawing with Core Graphics begins life
  during run loop processing
• During each iteration through the run loop
 • System checks if any views need to be
    drawn
 • Calls the UIView’s Draw method
Overriding Draw
Overriding Draw

• Subclass UIView and Override Draw to
  introduce drawing code
• When run loop cycles, Draw will be called
Overriding Draw

• Subclass UIView and Override Draw to
  introduce drawing code
• When run loop cycles, Draw will be called
           public override void Draw (RectangleF rect)
           {
               base.Draw (rect);

               // drawing code goes here
           }
Basic Steps to Draw
Basic Steps to Draw

1. Get a graphics context
Basic Steps to Draw

1. Get a graphics context
2. Set up drawing attributes
Basic Steps to Draw

1. Get a graphics context
2. Set up drawing attributes
3. Create geometry from drawing primitives
Basic Steps to Draw

1. Get a graphics context
2. Set up drawing attributes
3. Create geometry from drawing primitives
4. Call a Draw or Stroke method
Example - Draw a Star
Example - Draw a Star
Example - Draw a Star
         public override void Draw (RectangleF rect)
         {
             base.Draw (rect);

              // get graphics context
              CGContext gctx = UIGraphics.GetCurrentContext ();

              // set up drawing attributes
              gctx.SetLineWidth (4);
              UIColor.Yellow.SetStroke ();

              // stroke with a dashed line
              gctx.SetLineDash (3, new float[] {6,2} );

              // create geometry
              var path = new CGPath ();

              PointF origin = new PointF (Bounds.GetMidX (),
                                          Bounds.GetMinY () + 10);

              path.AddLines (new PointF[] {
                  origin,
                  new PointF (origin.X + 35,   origin.Y   +   80),
                  new PointF (origin.X - 50,   origin.Y   +   30),
                  new PointF (origin.X + 50,   origin.Y   +   30),
                  new PointF (origin.X - 35,   origin.Y   +   80) });

              path.CloseSubpath ();

              // add geometry to graphics context and draw it
              gctx.AddPath (path);

              gctx.DrawPath (CGPathDrawingMode.Stroke);
          }
Other Drawing Scenarios
Other Drawing Scenarios

• Images
• Map Overlays
• PDF
Other Drawing Scenarios

• Images
• Map Overlays
• PDF
PDF Drawing Example
References


Apple’s Quartz 2D Programming Guide

MonoTouch Samples - QuartzSample
https://github.com/xamarin/monotouch-samples/tree/master/QuartzSample




                                                                            Xamarin
                        Copyright 2012 © Xamarin Inc. All rights reserved
Xamarin
    Seminar
   Please give us your feedback
  http://bit.ly/xamfeedback


      Follow us on Twitter
        @XamarinHQ

        26th January 2012
        Copyright 2012 © Xamarin Inc. All rights reserved

Contenu connexe

Tendances

SVG - Scalable Vector Graphic
SVG - Scalable Vector GraphicSVG - Scalable Vector Graphic
SVG - Scalable Vector GraphicAkila Iroshan
 
rlottie - a new approach to motion graphics ui
rlottie -  a new approach to motion graphics uirlottie -  a new approach to motion graphics ui
rlottie - a new approach to motion graphics uiHermet Park
 
HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVGyarcub
 
Graphics on the Go
Graphics on the GoGraphics on the Go
Graphics on the GoGil Irizarry
 
Universal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQUniversal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQSergey Tarasevich
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
Beginners Guide to Modeling with Maya
Beginners Guide to Modeling with MayaBeginners Guide to Modeling with Maya
Beginners Guide to Modeling with MayaPaddy Lock
 
Windows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesWindows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesLearnNowOnline
 
Starting Core Animation
Starting Core AnimationStarting Core Animation
Starting Core AnimationJohn Wilker
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive GraphicsBlazing Cloud
 
Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Sigma Software
 
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
4,000 Adams at 90 Frames Per Second | Yi Fei Boon4,000 Adams at 90 Frames Per Second | Yi Fei Boon
4,000 Adams at 90 Frames Per Second | Yi Fei BoonJessica Tams
 
Getting Visual with Ruby Processing
Getting Visual with Ruby ProcessingGetting Visual with Ruby Processing
Getting Visual with Ruby ProcessingRichard LeBer
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvasGary Yeh
 
Scalable Assets Presentation
Scalable Assets PresentationScalable Assets Presentation
Scalable Assets PresentationNigel Barber
 
Performant, accessible animations with CSS & a dash of JavaScript
Performant, accessible animations with CSS & a dash of JavaScriptPerformant, accessible animations with CSS & a dash of JavaScript
Performant, accessible animations with CSS & a dash of JavaScriptsoyarsauce
 

Tendances (20)

Animation in iOS
Animation in iOSAnimation in iOS
Animation in iOS
 
SVG - Scalable Vector Graphic
SVG - Scalable Vector GraphicSVG - Scalable Vector Graphic
SVG - Scalable Vector Graphic
 
rlottie - a new approach to motion graphics ui
rlottie -  a new approach to motion graphics uirlottie -  a new approach to motion graphics ui
rlottie - a new approach to motion graphics ui
 
HTML5 and SVG
HTML5 and SVGHTML5 and SVG
HTML5 and SVG
 
Graphics on the Go
Graphics on the GoGraphics on the Go
Graphics on the Go
 
Animations & swift
Animations & swiftAnimations & swift
Animations & swift
 
Universal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQUniversal Image Loader: Story, Architecture, FAQ
Universal Image Loader: Story, Architecture, FAQ
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
Beginners Guide to Modeling with Maya
Beginners Guide to Modeling with MayaBeginners Guide to Modeling with Maya
Beginners Guide to Modeling with Maya
 
Windows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesWindows 8: Shapes and Geometries
Windows 8: Shapes and Geometries
 
Fastest css3 animations
Fastest css3 animations Fastest css3 animations
Fastest css3 animations
 
Starting Core Animation
Starting Core AnimationStarting Core Animation
Starting Core Animation
 
Interactive Graphics
Interactive GraphicsInteractive Graphics
Interactive Graphics
 
Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»
 
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
4,000 Adams at 90 Frames Per Second | Yi Fei Boon4,000 Adams at 90 Frames Per Second | Yi Fei Boon
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
 
Getting Visual with Ruby Processing
Getting Visual with Ruby ProcessingGetting Visual with Ruby Processing
Getting Visual with Ruby Processing
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
Scalable Assets Presentation
Scalable Assets PresentationScalable Assets Presentation
Scalable Assets Presentation
 
Performant, accessible animations with CSS & a dash of JavaScript
Performant, accessible animations with CSS & a dash of JavaScriptPerformant, accessible animations with CSS & a dash of JavaScript
Performant, accessible animations with CSS & a dash of JavaScript
 
Xtext, diagrams and ux
Xtext, diagrams and uxXtext, diagrams and ux
Xtext, diagrams and ux
 

En vedette

En vedette (14)

Lembaga Keuangan International
Lembaga Keuangan InternationalLembaga Keuangan International
Lembaga Keuangan International
 
Hyperloop.shankey.slideshare.pptx2
Hyperloop.shankey.slideshare.pptx2Hyperloop.shankey.slideshare.pptx2
Hyperloop.shankey.slideshare.pptx2
 
hyperloop tain..
hyperloop tain..hyperloop tain..
hyperloop tain..
 
Hyperloop project
Hyperloop projectHyperloop project
Hyperloop project
 
Hyper loop train
Hyper loop trainHyper loop train
Hyper loop train
 
Hyperloop
HyperloopHyperloop
Hyperloop
 
Schoolgids 2016-2017
Schoolgids 2016-2017Schoolgids 2016-2017
Schoolgids 2016-2017
 
Biofisica de membranas
Biofisica de membranasBiofisica de membranas
Biofisica de membranas
 
Hyperloop transportation system
Hyperloop  transportation systemHyperloop  transportation system
Hyperloop transportation system
 
Hyperloop
HyperloopHyperloop
Hyperloop
 
Hyperloop
HyperloopHyperloop
Hyperloop
 
Hyperloop
HyperloopHyperloop
Hyperloop
 
The usain bolt of bullet trains - hyperloop
The usain bolt of bullet trains - hyperloopThe usain bolt of bullet trains - hyperloop
The usain bolt of bullet trains - hyperloop
 
Hyperloop
HyperloopHyperloop
Hyperloop
 

Similaire à Getting Started with CoreGraphics

Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextMugunth Kumar
 
Mechanical Designing 6 Months
Mechanical Designing 6 MonthsMechanical Designing 6 Months
Mechanical Designing 6 MonthsPratima Parida
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartDavid Keener
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsSpiffy
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...Sébastien Levert
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Marakana Inc.
 
Quartz 2D with Swift 3
Quartz 2D with Swift 3Quartz 2D with Swift 3
Quartz 2D with Swift 3Bob McCune
 
CATiled Layer - Melbourne Cocoheads February 2012
CATiled Layer - Melbourne Cocoheads February 2012CATiled Layer - Melbourne Cocoheads February 2012
CATiled Layer - Melbourne Cocoheads February 2012Jesse Collis
 
Introduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphIntroduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphICS
 
UML for Aspect Oriented Design
UML for Aspect Oriented DesignUML for Aspect Oriented Design
UML for Aspect Oriented DesignEdison Lascano
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Farshid Pirahansiah
 
Motion design in FIori
Motion design in FIoriMotion design in FIori
Motion design in FIoriRoman Rommel
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸Hao Peiqiang
 
Programming iOS in C#
Programming iOS in C#Programming iOS in C#
Programming iOS in C#Frank Krueger
 
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJSFestUA
 
The not so short
The not so shortThe not so short
The not so shortAXM
 
Graphics for adjecency matrices
Graphics for adjecency matricesGraphics for adjecency matrices
Graphics for adjecency matricesLakshika Rasanjali
 

Similaire à Getting Started with CoreGraphics (20)

Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreText
 
Mechanical Designing 6 Months
Mechanical Designing 6 MonthsMechanical Designing 6 Months
Mechanical Designing 6 Months
 
Creating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChartCreating Dynamic Charts With JFreeChart
Creating Dynamic Charts With JFreeChart
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
 
Vector Graphics in Xamarin
Vector Graphics in XamarinVector Graphics in Xamarin
Vector Graphics in Xamarin
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)
 
Quartz 2D with Swift 3
Quartz 2D with Swift 3Quartz 2D with Swift 3
Quartz 2D with Swift 3
 
Core animation
Core animationCore animation
Core animation
 
CATiled Layer - Melbourne Cocoheads February 2012
CATiled Layer - Melbourne Cocoheads February 2012CATiled Layer - Melbourne Cocoheads February 2012
CATiled Layer - Melbourne Cocoheads February 2012
 
Introduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene GraphIntroduction to the Qt Quick Scene Graph
Introduction to the Qt Quick Scene Graph
 
UML for Aspect Oriented Design
UML for Aspect Oriented DesignUML for Aspect Oriented Design
UML for Aspect Oriented Design
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
 
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit, Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
Install, Compile, Setup, Setting OpenCV 3.2, Visual C++ 2015, Win 64bit,
 
Motion design in FIori
Motion design in FIoriMotion design in FIori
Motion design in FIori
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
 
Programming iOS in C#
Programming iOS in C#Programming iOS in C#
Programming iOS in C#
 
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
 
The not so short
The not so shortThe not so short
The not so short
 
Graphics for adjecency matrices
Graphics for adjecency matricesGraphics for adjecency matrices
Graphics for adjecency matrices
 

Plus de Xamarin

Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin
 
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinXamarin
 
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinGet the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinXamarin
 
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushCreative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushXamarin
 
Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureXamarin
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksXamarin
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinXamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningXamarin
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UIXamarin
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesXamarin
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilityXamarin
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeXamarin
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Xamarin
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsXamarin
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureXamarin
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Xamarin
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureXamarin
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Xamarin
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioXamarin
 

Plus de Xamarin (20)

Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...
 
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
 
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinGet the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
 
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushCreative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
 
Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft Azure
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin Workbooks
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine Learning
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UI
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and Resources
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and Profitability
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile Practice
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.Forms
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft Azure
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual Studio
 

Dernier

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 

Dernier (20)

Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 

Getting Started with CoreGraphics

  • 1. Xamarin Seminar 26th January 2012 Copyright 2012 © Xamarin Inc. All rights reserved
  • 2. Agenda Getting Started with Core Graphics Mike Bluestein Technical Writer Xamarin Documentation Team mike.bluestein@xamarin.com Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
  • 3. Introduction This session will be a primer on using Core Graphics with MonoTouch. What is Core Graphics? What are its fundamental concepts? How is it used? Examples Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
  • 4. What is Core Graphics?
  • 5. What is Core Graphics?
  • 6. What is Core Graphics? • Quartz 2D
  • 7. What is Core Graphics? • Quartz 2D • 2D Drawing API
  • 8. What is Core Graphics? • Quartz 2D • 2D Drawing API • Images
  • 9. What is Core Graphics? • Quartz 2D • 2D Drawing API • Images • PDF
  • 11. It’s Device Independent • Also resolution independent
  • 12. It’s Device Independent • Also resolution independent • Don’t work in pixels
  • 13. It’s Device Independent • Also resolution independent • Don’t work in pixels • Instead use geometric points
  • 14. It’s Device Independent • Also resolution independent • Don’t work in pixels • Instead use geometric points • Code will generally work on any iOS device
  • 16. Draw with Primitives • To create geometry
  • 17. Draw with Primitives • To create geometry • Describe how to connect points
  • 18. Draw with Primitives • To create geometry • Describe how to connect points • Bezier curves
  • 19. Draw with Primitives • To create geometry • Describe how to connect points • Bezier curves • Lines
  • 20. Draw with Primitives • To create geometry • Describe how to connect points • Bezier curves • Lines • Paths
  • 21. Draw with Primitives • To create geometry • Describe how to connect points • Bezier curves • Lines • Paths • Arcs
  • 22. Ask to be Drawn
  • 23. Ask to be Drawn • Specify various fill and stroke attributes
  • 24. Ask to be Drawn • Specify various fill and stroke attributes • Ask the system to draw the geometry
  • 25. Ask to be Drawn • Specify various fill and stroke attributes • Ask the system to draw the geometry • Draw during run loop
  • 27. Draw during Run Loop • Drawing with Core Graphics begins life during run loop processing
  • 28. Draw during Run Loop • Drawing with Core Graphics begins life during run loop processing • During each iteration through the run loop
  • 29. Draw during Run Loop • Drawing with Core Graphics begins life during run loop processing • During each iteration through the run loop • System checks if any views need to be drawn
  • 30. Draw during Run Loop • Drawing with Core Graphics begins life during run loop processing • During each iteration through the run loop • System checks if any views need to be drawn • Calls the UIView’s Draw method
  • 32. Overriding Draw • Subclass UIView and Override Draw to introduce drawing code • When run loop cycles, Draw will be called
  • 33. Overriding Draw • Subclass UIView and Override Draw to introduce drawing code • When run loop cycles, Draw will be called public override void Draw (RectangleF rect) { base.Draw (rect); // drawing code goes here }
  • 35. Basic Steps to Draw 1. Get a graphics context
  • 36. Basic Steps to Draw 1. Get a graphics context 2. Set up drawing attributes
  • 37. Basic Steps to Draw 1. Get a graphics context 2. Set up drawing attributes 3. Create geometry from drawing primitives
  • 38. Basic Steps to Draw 1. Get a graphics context 2. Set up drawing attributes 3. Create geometry from drawing primitives 4. Call a Draw or Stroke method
  • 39. Example - Draw a Star
  • 40. Example - Draw a Star
  • 41. Example - Draw a Star public override void Draw (RectangleF rect) { base.Draw (rect); // get graphics context CGContext gctx = UIGraphics.GetCurrentContext (); // set up drawing attributes gctx.SetLineWidth (4); UIColor.Yellow.SetStroke (); // stroke with a dashed line gctx.SetLineDash (3, new float[] {6,2} ); // create geometry var path = new CGPath (); PointF origin = new PointF (Bounds.GetMidX (), Bounds.GetMinY () + 10); path.AddLines (new PointF[] { origin, new PointF (origin.X + 35, origin.Y + 80), new PointF (origin.X - 50, origin.Y + 30), new PointF (origin.X + 50, origin.Y + 30), new PointF (origin.X - 35, origin.Y + 80) }); path.CloseSubpath (); // add geometry to graphics context and draw it gctx.AddPath (path); gctx.DrawPath (CGPathDrawingMode.Stroke); }
  • 43. Other Drawing Scenarios • Images • Map Overlays • PDF
  • 44. Other Drawing Scenarios • Images • Map Overlays • PDF
  • 46. References Apple’s Quartz 2D Programming Guide MonoTouch Samples - QuartzSample https://github.com/xamarin/monotouch-samples/tree/master/QuartzSample Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
  • 47. Xamarin Seminar Please give us your feedback http://bit.ly/xamfeedback Follow us on Twitter @XamarinHQ 26th January 2012 Copyright 2012 © Xamarin Inc. All rights reserved

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n