(Ebook) Graphics and Animation on iOS: A
Beginner's Guide to Core Graphics and Core
Animation by Vandad Nahavandipoor ISBN
1449305679 download
https://ebooknice.com/product/graphics-and-animation-on-ios-a-
beginner-s-guide-to-core-graphics-and-core-animation-2228724
Explore and download more ebooks at ebooknice.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebooknice.com
to discover even more!
(Ebook) Graphics and animation on iOS Cover title. - ''A
beginner's guide to core graphics and core animation.'' by
Nahavandipoor, Vandad ISBN 9781449305673, 1449305679
https://ebooknice.com/product/graphics-and-animation-on-ios-cover-title-a-
beginner-s-guide-to-core-graphics-and-core-animation-11902144
(Ebook) Core HTML5 Canvas: Graphics, Animation, and Game
Development by David Geary ISBN 9780132761611, 0132761610
https://ebooknice.com/product/core-html5-canvas-graphics-animation-and-
game-development-2587096
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling and Animation by John M. Blain ISBN 9781466517035,
1466517034
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-and-animation-4421502
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling and Animation by John M. Blain ISBN 9780367553616,
0367553619
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-and-animation-11734746
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling and Animation - Fourth Edition by John M. Blain ISBN
B075Z5Z281
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-and-animation-fourth-edition-35191086
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling & Animation by John M. Blain ISBN 9780367536190,
0367536196
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-animation-23977204
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling and Animation by John M. Blain ISBN 9780367536190,
9780367553616, 0367536196, 0367553619
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-and-animation-36528950
(Ebook) Core Animation: Simplified Animation Techniques for Mac
and iPhone Development by Marcus Zarra, Matt Long ISBN
9780321617750, 0321617754
https://ebooknice.com/product/core-animation-simplified-animation-
techniques-for-mac-and-iphone-development-1295824
(Ebook) The Complete Guide to Blender Graphics: Computer
Modeling & Animation, Fifth Edition by John M. Blain ISBN
9780367184742, 0367184745
https://ebooknice.com/product/the-complete-guide-to-blender-graphics-
computer-modeling-animation-fifth-edition-11111154
Graphics and Animation on iOS
Graphics and Animation on iOS
Vandad Nahavandipoor
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Graphics and Animation on iOS
by Vandad Nahavandipoor
Copyright © 2011 Vandad Nahavandipoor. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or [email protected].
Editor: Andy Oram Cover Designer: Karen Montgomery
Production Editor: Kristen Borg Interior Designer: David Futato
Proofreader: O’Reilly Production Services Illustrator: Robert Romano
Printing History:
May 2011: First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Graphics and Animation on iOS, the image of an Asian civet, and related trade dress
are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-30567-3
[LSI]
1303483294
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Graphics and Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Basic Concepts for Adapting to Different Screen Sizes 2
Creating the Project Structure in Xcode 3
Enumerating and Loading Fonts 10
Drawing Text 12
Constructing, Setting, and Using Colors 13
Drawing Images 18
Drawing Lines 20
Constructing Paths 27
Drawing Rectangles 31
Adding Shadows to Shapes 34
Creating and Drawing Gradients 40
Displacing Shapes on Graphic Contexts 48
Scaling Shapes Drawn on Graphic Contexts 51
Rotating Shapes Drawn on Graphic Contexts 54
Animating and Moving Views 54
Animating and Scaling Views 65
Animating and Rotating Views 66
v
Preface
Face it—animations make apps really attractive to users. If your app presents a simple
user interface, but only does what it says it does, chances are that users will choose a
competitor’s app, one with a better user interface that makes use of iOS SDK’s fantastic
animation and graphics capabilities.
This book is written to teach programmers how to incorporate smooth animations,
along with skills such as loading custom fonts and drawing images in their apps.
Audience
This book is written for programmers who are fairly new to Cocoa and iOS program-
ming. However, it is assumed that you know basic Objective-C and have done some
Cocoa programming. I also assume you know some elementary principles of computer
graphics, such as coordinates and the RGB color scheme.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements
such as variable or function names, databases, data types, environment variables,
statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter-
mined by context.
vii
This icon signifies a tip, suggestion, or general note.
This icon indicates a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in
this book in your programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this book does not require
permission. Selling or distributing a CD-ROM of examples from O’Reilly books does
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example code
from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Graphics and Animation on iOS
by Vandad Nahavandipoor (O’Reilly). Copyright 2011 Vandad Nahavandipoor,
978-1-449-30567-3.”
If you feel your use of code examples falls outside fair use or the permission given above,
feel free to contact us at
[email protected].
Safari® Books Online
Safari Books Online is an on-demand digital library that lets you easily
search over 7,500 technology and creative reference books and videos to
find the answers you need quickly.
With a subscription, you can read any page and watch any video from our library online.
Read books on your cell phone and mobile devices. Access new titles before they are
available for print, and get exclusive access to manuscripts in development and post
feedback for the authors. Copy and paste code samples, organize your favorites, down-
load chapters, bookmark key sections, create notes, print out pages, and benefit from
tons of other time-saving features.
O’Reilly Media has uploaded this book to the Safari Books Online service. To have full
digital access to this book and others on similar topics from O’Reilly and other pub-
lishers, sign up for free at http://my.safaribooksonline.com.
viii | Preface
How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at:
http://www.oreilly.com/catalog/9781449305673
To comment or ask technical questions about this book, send email to:
[email protected]
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
In 2007, after iOS became so popular among programmers, I started to learn how to
program in iOS SDK using an Xcode that was much less advanced than what we use
today. My first impression after seeing some iOS apps was: “My God, they look gor-
geous!” I had never seen such smooth interfaces, graphics, and animations rendered
on a mobile device before, and the big touch-screen added to that excitement. If you
are thinking of writing iOS apps that require smooth animations and graphics render-
ing, then this is the book for you.
Although I did my part to write this book, I feel the need to thank my wonderful col-
leagues and friends, Andy Oram and Brian Jepson of O’Reilly, for their continuous
support and help in every project we have worked on together so far, including the
book you are reading right now.
Preface | ix
I would also like to thank Sarah Schneider, Rachel James, Betsy Waliszewski, and
Gretchen Giles of O’Reilly for always being very helpful and responsive to my annoying
requests to create SVN repositories, change book titles, and so on. Thanks also go to
Gary McCarville, Kirk Pattinson, Shaun Puckrin, Sushil Shirke, Simon Whitty, Mark
Harris, and Shency Revindran for being great friends and colleagues.
A big thanks to you as well for deciding to read this book. I hope that you will enjoy
reading this book as much as I enjoyed writing it.
x | Preface
Graphics and Animations
You’ve certainly seen applications with beautiful graphics effects on iPhones or iPads.
And you’ve probably also encountered impressive animations in games and other apps.
When the iOS runtime and Cocoa programming frameworks combine, they make an
amazing variety of graphics and animation effects possible with relatively simple cod-
ing. The quality of these graphics and animations depends partly, of course, on the
aesthetic sensitivities of the programmer and artistic collaborators. But in this short
book, you’ll see how much you can accomplish with modest programming skills.
I’ll dispense with conceptual background, preferring to introduce ideas such as color
spaces, transformation, and the graphics context as we go along. I’ll just mention a few
basics before leaping into code.
In Cocoa Touch, an app is made up of windows and views. An app with a UI has at
least one window that contains, in turn, one or more views. In Cocoa Touch, a window
is an instance of UIWindow. Usually, an app will open to the main window and the
programmer will then add views to the window to represent different parts of the UI:
parts such as buttons, labels, images, and custom controls. All these UI-related com-
ponents are handled and drawn by UIKit.
Some of these things might sound relatively difficult to understand, but I promise you
that as we proceed through this book, you will understand them step-by-step with the
many examples I will give.
Apple has provided developers with powerful frameworks that handle graphics and
animations in iOS and OS X. Some of these frameworks and technologies are:
UIKit
The high-level framework that allows developers to create views, windows, but-
tons, and other UI related components. It also incorporates some of the low-level
APIs into an easier-to-use high-level API.
Quartz 2D
The main engine running under the hood to facilitate drawing in iOS; UIKit uses
Quartz.
1
Core Graphics
A framework that supports the graphics context (more on this later), loading im-
ages, drawing images, and so on.
Core Animation
A framework that, as its name implies, facilitates animations in iOS.
Basic Concepts for Adapting to Different Screen Sizes
When drawing on a screen, one of the most important concepts to grasp is the relation
between points and pixels. I’m sure you’re familiar with pixels, but what are points?
They’re the device-independent counterpart of pixels. For instance, compare the
iPhone 3GS to the iPhone 4. Both devices have 3.5-inch displays. However, the number
of pixels that iPhone 3GS can draw in portrait mode is 320×480. The same screen size
on the iPhone 4 is capable of drawing twice as many, or 640×960, pixels in portrait
mode.
Now imagine you are writing an iPhone app that has only one screen, and that you are
simply filling the whole screen with the color green. Imagine that you naïvely specify a
rectangular area of 320×480 pixels. When iPhone 3GS users run your app, they will be
quite happy because “it does what it says it does”—fill the entire screen with the color
green. iPhone 4 users, on the other hand, will be quite unhappy: what they will see is
quite different, as shown in Figure 1.
To remedy this problem, Apple introduced device-independent drawing methods to
help developers focus on how their shapes and graphics have to appear on a device
instead of worrying about the screen sizes and resolutions of different devices that run
the same code. To fix the issue we saw in Figure 1, the developer of the app can simply
use the relevant APIs to specify the green rectangle in points instead of pixels. That will
allow the same code to run on the iPhone 3GS and the iPhone 4, ensuring that the
screen on the iPhone 4 will be filled with the rectangle. For this reason, many of the
methods that you will see in this book will rely on points (or as Apple calls them, logical
points) instead of pixels.
The origin point of the screen on an iOS device is the top-left corner.
Screens whose drawing origin is on the top-left corner are also referred
to as Upper Left Origin, or ULO, screens. This means that point (0, 0)
is the topmost and the leftmost point on the screen, and that positive
values of the x axis extend towards the right, while positive values of
the y axis extend towards the bottom. In other words, an x position of
20 is further right on the screen than a position of 10 is. On the y axis,
point 20 is further down than point 10.
2 | Graphics and Animations
Figure 1. Device-dependent pixel rendering yields different results on different devices
Creating the Project Structure in Xcode
In this book, we will be using view objects of type UIView to draw shapes, strings, and
everything else that’s visible on the screen.
I assume you have the latest Xcode from Apple. If not, please head to
Xcode’s website in order to download it.
In order to be able to incorporate some of these code snippets in an application, I will
first show you the required steps to create a new project in Xcode and subclass
UIView, where we can place our code:
1. Open Xcode.
2. From the File menu, select New→Project.
3. On the left side of the screen, make sure the iOS category is selected. Select Ap-
plication under that category (see Figure 2).
Creating the Project Structure in Xcode | 3
Figure 2. Creating a View-based Application for iOS in Xcode
4. On the right side of the screen, select View-based Application, and press Next (see
Figure 2).
5. In the Product Name box (Figure 3), select a name for your project. I’ve entered
Graphics and I suggest you enter the same name to avoid confusion later on.
6. In the Company Identifier box, enter a bundle identifier prefix, which will be pre-
pended to the Product Name you chose. This is usually com.company. I have chosen
com.pixolity.
7. In the Device Family, select iPhone, and then press Next.
8. On the next screen (Figure 4), select where you want to save your project. I’ve
selected Desktop. Press Create.
Now your Xcode project is open. On the left side of Xcode, expand the Graphics group
to reveal all the files that Xcode created for us when we created the project. Now we
shall create a view object for our view controller. Please follow these steps to do so:
1. Select the Graphics group from the left hand side in Xcode.
2. Right click on the Graphics group and select New File….
3. In the New File dialog box, make sure iOS is selected as the category on the left
side, and select Cocoa Touch as the subcategory (see Figure 5).
4 | Graphics and Animations
Figure 3. Setting the options for a new project in Xcode
Figure 4. Saving the view-based Xcode project to the desktop
Creating the Project Structure in Xcode | 5
Figure 5. Creating a new Objective-C class in Xcode
4. On the right side, select Objective-C class, and then press Next (see Figure 5).
5. In the next screen (Figure 6), make sure that the Subclass box has UIView written
inside it, and then press Next.
6. In the Save As dialog, set the file name to GraphicsViewControllerView.m.
7. Select Graphics in the Group drop-down box (see Figure 7).
8. Make sure the “Add to targets” checkbox is checked for the project that we created
earlier, and then press Save (see Figure 7).
9. On the left side of Xcode’s main window, click on the GraphicsViewController.m
file. Interface Builder will be displayed on the right side of Xcode’s screen, as shown
in Figure 8. We will not be using the .xib file at this point.
10. From the Xcode menu, select View→Utilities→File Inspector. The file inspector will
be displayed, by default, on the right side of Xcode’s window.
11. Click somewhere inside the gray view that is created for you in Interface Builder.
The contents displayed in File Inspector (on the right) will change to reflect your
selection (see Figure 9).
6 | Graphics and Animations
Figure 6. Creating a subclass of UIView
Figure 7. Saving a subclass of UIView
Creating the Project Structure in Xcode | 7
12. In File Inspector, choose the Identity Inspector tab on top (see Figure 10).
13. In the Class box, under the Custom Class section, enter GraphicsViewController
View (the view object we created before), and press Return on your keyboard.
Figure 8. Selecting our view controller’s xib file
Now we are ready to start coding. What we did was simply creating a view class of type
UIView so that later on in this book, we can change the code in that class. Then we used
Interface Builder to set our view controller’s view class to the same view object that we
created. This means that now our view controller’s view will be an instance of the
GraphicsViewControllerView class that we created.
8 | Graphics and Animations
Random documents with unrelated
content Scribd suggests to you:
13
A song of my heart, as the sun peered o’er
the sea,
Was born at morning to me:
And out of my treasure-house it chose
A melody, that arose
Of all fair sounds that I love, remembered
together
In one; and I knew not whether
From waves of rustling wheat it was,
Recoveringly that pass:
Or a hum of bees in the queenly robes of the
lime:
Or a descant in pairing time
Of warbling birds: or watery bells
Of rivulets in the hills:
Or whether on blazing downs a high lark’s
hymn
Alone in the azure dim:
Or a sough of pines, when the midnight wold
Is solitary and cold:
Or a lapping river-ripple all day chiding
The bow of my wherry gliding
Down Thames, between his flowery shores
Re-echoing to the oars:
Or anthem notes, wherever in archèd quires
The unheeded music twires,
And, centuries by, to the stony shade
Flies following and to fade:
Or a homely prattle of children’s voices gay
’Mong garden joys at play:
Or a sundown chaunting of solemn rooks:
Or memory of my books,
Which hold the words that poets in many a
tongue
To the irksome world have sung:
Or the voice, my happy lover, of thee
Now separated from me.
A ruby of fire in the burning sleep of my
brain
Long hid my thought had lain,
Forgotten dreams of a thousand days
Ingathering to its rays,
The light of life in darkness tempering long;
Till now a perfect song,
A jewel of jewels it leapt above
To the coronal of my love.
14
FOUNDER’S DAY. A SECULAR
ODE
ON THE NINTH JUBILEE OF
ETON COLLEGE
Christ and his Mother, heavenly maid,
Mary, in whose fair name was laid
Eton’s corner, bless our youth
With truth, and purity, mother of truth!
O ye, ’neath breezy skies of June,
By silver Thames’s lulling tune,
In shade of willow or oak, who try
The golden gates of poesy;
Or on the tabled sward all day
Match your strength in England’s play,
Scholars of Henry, giving grace
To toil and force in game or race;
Exceed the prayer and keep the fame
Of him, the sorrowful king, who came
Here in his realm a realm to found,
Where he might stand for ever crowned.
Or whether with naked bodies
flashing
Ye plunge in the lashing weir; or dashing
The oars of cedar skiffs, ye strain
Round the rushes and home again;—
Or what pursuit soe’er it be
That makes your mingled presence free,
When by the schoolgate ’neath the limes
Ye muster waiting the lazy chimes;
May Peace, that conquereth sin and death,
Temper for you her sword of faith;
Crown with honour the loving eyes,
And touch with mirth the mouth of the wise.
Here is eternal spring: for you
The very stars of heaven are new;
And aged Fame again is born,
Fresh as a peeping flower of morn.
For you shall Shakespeare’s scene unroll,
Mozart shall steal your ravished soul,
Homer his bardic hymn rehearse,
Virgil recite his maiden verse.
Now learn, love, have, do, be the best;
Each in one thing excel the rest:
Strive; and hold fast this truth of heaven—
To him that hath shall more be given.
Slow on your dial the shadows creep,
So many hours for food and sleep,
So many hours till study tire,
So many hours for heart’s desire.
These suns and moons shall memory save,
Mirrors bright for her magic cave;
Wherein may steadfast eyes behold
A self that groweth never old.
O in such prime enjoy your lot,
And when ye leave regret it not;
With wishing gifts in festal state
Pass ye the angel-sworded gate.
Then to the world let shine your light,
Children in play be lions in fight,
And match with red immortal deeds
The victory that made ring the meads:
Or by firm wisdom save your land
From giddy head and grasping hand:
Improve the best; so shall your sons
Better what ye have bettered once.
Send them here to the court of grace
Bearing your name to fill your place:
Ye in their time shall live again
The happy dream of Henry’s reign:
And on his day your steps be bent
Where, saint and king, crowned with
content,
He biddeth a prayer to bless his youth
With truth, and purity, mother of truth.
15
The north wind came up yesternight
With the new year’s full moon,
And rising as she gained her height,
Grew to a tempest soon.
Yet found he not on heaven’s face
A task of cloud to clear;
There was no speck that he might chase
Off the blue hemisphere,
Nor vapour from the land to drive:
The frost-bound country held
Nought motionable or alive,
That ’gainst his wrath rebelled.
There scarce was hanging in the wood
A shrivelled leaf to reave;
No bud had burst its swathing hood
That he could rend or grieve:
Only the tall tree-skeletons,
Where they were shadowed all,
Wavered a little on the stones,
And on the white church-wall.
—Like as an artist in his mood,
Who reckons all as nought,
So he may quickly paint his nude,
Unutterable thought:
So Nature in a frenzied hour
By day or night will show
Dim indications of the power,
That doometh man to woe.
Ah, many have my visions been,
And some I know full well:
I would that all that I have seen
Were fit for speech to tell.—
And by the churchyard as I came,
It seemed my spirit passed
It seemed my spirit passed
Into a land that hath no name,
Grey, melancholy and vast;
Where nothing comes: but Memory,
The widowed queen of Death,
Reigns, and with fixed, sepulchral eye
All slumber banisheth.
Each grain of writhen dust, that drapes
That sickly, staring shore,
Its old chaotic change of shapes
Remembers evermore.
And ghosts of cities long decayed,
And ruined shrines of Fate
Gather the paths, that Time hath made
Foolish and desolate.
Nor winter there hath hope of spring,
Nor the pale night of day,
Since the old king with scorpion sting
Hath done himself away.
The morn was calm; the wind’s last breath
Had fal’n: in solemn hush
The golden moon went down beneath
The dawning’s crimson flush.
16
NORTH WIND IN OCTOBER
In the golden glade the chestnuts are fallen
all;
From the sered boughs of the oak the acorns
fall:
The beech scatters her ruddy fire;
The lime hath stripped to the cold,
And standeth naked above her yellow attire:
The larch thinneth her spire
To lay the ways of the wood with cloth of
gold.
Out of the golden-green and white
Of the brake the fir-trees stand upright
In the forest of flame, and wave aloft
To the blue of heaven their blue-green
tuftings soft.
But swiftly in shuddering gloom the
splendours fail,
As the harrying North-wind beareth
A cloud of skirmishing hail
The grievèd woodland to smite:
In a hurricane through the trees he teareth,
Raking the boughs and the leaves rending,
And whistleth to the descending
Blows of his icy flail.
Gold and snow he mixeth in spite,
And whirleth afar; as away on his winnowing
flight
He passeth, and all again for awhile is bright.
17
FIRST SPRING MORNING
A CHILD’S POEM
Look! Look! the spring is come:
O feel the gentle air,
That wanders thro’ the boughs to burst
The thick buds everywhere!
The birds are glad to see
The high unclouded sun:
Winter is fled away, they sing,
The gay time is begun.
Adown the meadows green
Let us go dance and play,
And look for violets in the lane,
And ramble far away
To gather primroses,
That in the woodland grow,
And hunt for oxlips, or if yet
The blades of bluebells show:
There the old woodman gruff
Hath half the coppice cut,
And weaves the hurdles all day long
Beside his willow hut.
We’ll steal on him, and then
Startle him, all with glee
Singing our song of winter fled
And summer soon to be.
18
A VILLAGER
There was no lad handsomer than Willie was
The day that he came to father’s house:
There was none had an eye as soft an’ blue
As Willie’s was, when he came to woo.
To a labouring life though bound thee be,
An’ I on my father’s ground live free,
I’ll take thee, I said, for thy manly grace,
Thy gentle voice an’ thy loving face.
’Tis forty years now since we were wed:
We are ailing an’ grey needs not to be said:
But Willie’s eye is as blue an’ soft
As the day when he wooed me in father’s
croft.
Yet changed am I in body an’ mind,
For Willie to me has ne’er been kind:
Merrily drinking an’ singing with the men
He ’ud come home late six nights o’ the se’n.
An’ since the children be grown an’ gone
He ’as shunned the house an’ left me lone:
An’ less an’ less he brings me in
Of the little he now has strength to win.
The roof lets through the wind an’ the wet,
An’ master won’t mend it with us in’s debt:
An’ all looks every day more worn,
An’ the best of my gowns be shabby an’
torn.
No wonder if words hav’ a-grown to blows;
That matters not while nobody knows:
For love him I shall to the end of life,
An’ be, as I swore, his own true wife.
An’ when I am gone, he’ll turn, an’ see
His folly an’ wrong, an’ be sorry for me:
An’ come to me there in the land o’ bliss
To give me the love I looked for in this.
19
Weep not to-day: why should this sadness
be?
Learn in present fears
To o’ermaster those tears
That unhindered conquer thee.
Think on thy past valour, thy future praise:
Up, sad heart, nor faint
In ungracious complaint,
Or a prayer for better days.
Daily thy life shortens, the grave’s dark
peace
Draweth surely nigh,
When good-night is good-bye;
For the sleeping shall not cease.
Fight, to be found fighting: nor far away
Deem, nor strange thy doom.
Like this sorrow ’twill come,
And the day will be to-day.
NEW
POEMS
NEW POEMS
ECLOGUE I
THE MONTHS
BASIL AND EDWARD
Man hath with man on earth no holier bond
Than that the Muse weaves with her dreamy
thread:
Nor e’er was such transcendent love more
fond
Than that which Edward unto Basil led,
Wandering alone across the woody shires
To hear the living voice of that wide heart,
To see the eyes that read the world’s desires,
And touch the hand that wrote the roving
rhyme.
Diverse their lots as distant were their
homes,
And since that early meeting, jealous Time
Knitting their loves had held their lives apart.
But now again were these fine lovers met
And sat together on a rocky hill
Looking upon the vales of Somerset,
Where the far sea gleam’d o’er the bosky
combes,
Satisfying their spirits the livelong day
With various mirth and revelation due
And delicate intimacy of delight,
As there in happy indolence they lay
And drank the sun, while round the breezy
height
Beneath their feet rabbit and listless ewe
Nibbled the scented herb and grass at will.
Much talked they at their ease; and at the
last
Spoke Edward thus, ’'Twas on this very hill
This time of the year,—but now twelve years
are past,—
h k d k ll
That you provoked in verse my younger skill
To praise the months against your rival song;
And ere the sun had westered ten degrees
Our rhyme had brought him thro’ the Zodiac.
Have you remembered?’—Basil answer’d
back,
’Guest of my solace, how could I forget?
Years fly as months that seem’d in youth so
long.
The precious life that, like indifferent gold
Is disregarded in its worth to hold
Some jewel of love that God therein would
set,
It passeth and is gone.’—’And yet not all’
Edward replied: ’The passion as I please
Of that past day I can to-day recall;
And if but you, as I, remember yet
Your part thereof, and will again rehearse,
For half an hour we may old Time outwit.’
And Basil said, ’Alas for my poor verse!
What happy memory of it still endures
Will thank your love: I have forgotten it.
Speak you my stanzas, I will ransom yours.
Begin you then as I that day began,
And I will follow as your answers ran.’
JANUARY
ED. The moon that mounts the sun’s
deserted way,
Turns the long winter night to a silver day;
But setteth golden in face of the solemn
sight
Of her lord arising upon a world of white.
FEBRUARY
BA. I have in my heart a vision of spring
begun
In a sheltering wood, that feels the kiss of
the sun:
And a thrush adoreth the melting day that
dies
In clouds of purple afloat upon saffron skies.
MARCH
ED. Now carol the birds at dawn, and
some new lay
Announceth a homecome voyager every-day.
Beneath the tufted sallows the streamlet
thrills
With the leaping trout and the gleam of the
daffodils.
APRIL
BA. Then laugheth the year; with flowers
the meads are bright;
The bursting branches are tipped with
flames of light:
The landscape is light; the dark clouds flee
above,
And the shades of the land are a blue that is
deep as love.
MAY
ED. But if you have seen a village all red
and old
In cherry-orchards a-sprinkle with white and
gold,
By a hawthorn seated, or a witchelm
flowering high,
A gay breeze making riot in the waving rye!
JUNE
BA. Then night retires from heaven; the
high
winds go
A-sailing in cloud-pavilions of cavern’d snow.
O June, sweet Philomel sang thy cradle-lay;
In rosy revel thy spirit shall pass away.
JULY
ED. Heavy is the green of the fields, heavy
the trees
With foliage hang, drowsy the hum of bees
In the thundrous air: the crowded scents lie
low:
Thro’ tangle of weeds the river runneth slow.
AUGUST
BA. A reaper with dusty shoon and hat of
straw
On the yellow field, his scythe in his armës
braw:
Beneath the tall grey trees resting at noon
From sweat and swink with scythe and dusty
shoon.
SEPTEMBER
ED. Earth’s flaunting flower of passion
fadeth fair
To ripening fruit in sunlit veils of the air,
As the art of man makes wisdom to glorify
The beauty and love of life born else to die.
OCTOBER
BA. On frosty morns with the woods
aflame, down, down
The golden spoils fall thick from the chestnut
crown.
May Autumn in tranquil glory her riches
spend,
With mellow apples her orchard-branches
bend.
NOVEMBER
ED. Sad mists have hid the sun, the land is
forlorn:
The plough is afield, the hunter windeth his
horn.
Dame Prudence looketh well to her winter
stores,
And many a wise man finds his pleasure
indoors.
DECEMBER
BA. I pray thee don thy jerkin of olden
time,
Bring us good ice, and silver the trees with
rime;
And I will good cheer, good music and wine
bestow,
When the Christmas guest comes galoping
over the snow.
Thus they in verse alternate sang the year
For rabbit shy and listless ewe to hear,
Among the grey rocks on the mountain
green
Beneath the sky in fair and pastoral scene,
Like those Sicilian swains, whose doric
tongue
After two thousand years is ever young,—
Sweet the pine’s murmur, and, shepherd,
sweet thy pipe,—
Or that which gentle Virgil, yet unripe,
Of Tityrus sang under the spreading beech
And gave to rustic clowns immortal speech,
By rocky fountain or on flowery mead
Bidding their idle flocks at will to feed,
While they, retreated to some bosky glade,
Together told their loves, and as they played
Sang what sweet thing soe’er the poet
feigned:
But these were men when good Victoria
reigned,
Poets themselves, who without shepherd
gear
Each of his native fancy sang the year
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebooknice.com