![]() You could, but remember that every time you made a tiny change, like changing the color or size of the happy face, you’d have to re-export your assets. “But wait”, you cry, “I could just design this in Photoshop or Pixelmator, or better yet, Illustrator or Sketch. How cool is that? Imagine trying to do this on your own via CoreGraphics. LeftEyePath.lineToPoint(NSMakePoint(131.5, 59.5)) LeftEyePath.moveToPoint(NSMakePoint(131.5, 92.5)) RightEyePath.lineToPoint(NSMakePoint(102.5, 59.5)) RightEyePath.moveToPoint(NSMakePoint(102.5, 92.5)) SmilePath.moveToPoint(NSMakePoint(78.5, 53.5)) Let facePath = NSBezierPath(ovalInRect: NSMakeRect(62, 6, 112, 106)) Let faceForeground = NSColor(calibratedRed: 0, green: 0, blue: 0, alpha: 1) Let faceBackground = NSColor(calibratedRed: 0.956, green: 1, blue: 0.204, alpha: 1) For example, here’s the code that was generated for the happy face: You can also name the colors that you use in the Colors pane:īy naming your shapes and colors, the code that PaintCode generates is nice and descriptive. You can easily give a name to each shape you create in the Canvas pane: Here’s a happy face icon that I drew in about a minute using an Oval and three stroked Bezier paths: When you open up PaintCode, you get a blank canvas you can draw into using basic shapes such as rectangles, polygons, ovals, text and Bezier curves. Let’s take a look at how PaintCode works – starting with a tour! PaintCode Quick Tour By generating the graphics at runtime based on Core Graphics code, your graphics can work on any resolution, scaled as much as you would like – and you can customize the graphics programmatically at run-time. Since the images are pre-generated, you can’t customize them easily at runtime. If you want to scale an image to be larger than the original size, it looks pixelated. Since PNGs are made at a specific image size, you need to save multiple versions of each file – such as image.png, and They don’t scale. This works great, but has three major drawbacks: Keep reading to find out! :] Why PaintCode?īefore we begin, it’s important to understand the problem that PaintCode aims to solve.Īs an iOS or OS X developer, you usually receive image assets from designers in terms of PNGs. We’ve covered PaintCode in several tutorials in the past (one for developers, one for designers), but if you don’t have PaintCode yet you might be wondering – is it worth the money? You can then integrate this code into your app, allowing you to dynamically scale your graphics to any size, or programmatically change your graphics based on user input. ![]() PaintCode is an app that allows you to draw controls, icons, and other graphics elements like you would in programs like Sketch, Photoshop, or Illustrator.Įxcept PaintCode has one major difference – it generates Objective-C or Swift Core Graphics code from your drawings in real time!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |