Here is implementation of color picker control which is similar to one that used in original Mac applications like Numbers, Pages, Keynote. Original one has lots of small pictures. This control based on NSSegmentedControl and have numbers of useful thinks to know, so it’s not just implementation but also good place to look:
- how to subclass NSSegmentedCell
- how is working NSTrackingArea
- create NSPopover
Easy to use. Just create view and add on your master view:
A stripped, optimized version of Sketch was built as an x86_64 position-independent executable (PIE)
into /BuildProducts/Release. Full debug symbol information is available in Sketch.app.dSYM, which sits
alongside Sketch.app. When Sketch.app was run, the Sketch binary (which was built at 0×100000000) was
loaded at 0x10acde000. Running ‘sample Sketch’ showed 3 addresses that we want to get symbol informa-tion information
tion for — 0x10acea1d3, 0x10ace4bea, and 0x10ace4b7a.
First notice that the .dSYM is next to the .app:
% ls -1 /BuildProducts/Release/
Now, to symbolicate, we run atos with the -o flag specifying the path to the actual Sketch executable
(not the .app wrapper), the -arch x86_64 flag, and the -l _x1_acde___ flag to specify the load address.
% atos -o /BuildProducts/Release/Sketch.app/Contents/MacOS/Sketch -arch x86_64 -l 0x10acde000 0x10acea1d3 0x10ace4bea 0x10ace4b7a
-[SKTGraphicView drawRect:] (in Sketch) (SKTGraphicView.m:445)
-[SKTGraphic drawHandlesInView:] (in Sketch) (NSGeometry.h:110)
-[SKTGraphic drawHandleInView:atPoint:] (in Sketch) (SKTGraphic.m:490)
Height of zNear, another words it’s height of near plane:
float H_near = 2*near*tan(fovy/2);
And the same for zFar, to get height of far plane:
float H_far = 2*far*tan(fovy/2);
To get width, just multiple on aspect ratio of your screen.
What is Perspective Projection? Perspective projection is a form of pictorial drawing that gives the illusion of depth onto a flat surface, very similar to that of viewing of the object through the human eye. In comparison to other types of projection systems, for example orthographic and oblique, the spectator is viewing the object from infinity. The projection rays radiate parallel to each other from the object back to the spectator, compared to perspective projection where the projected rays radiate from the object to a single point at a given distance from the object. source
Very good material about perspective projection. A computer monitor is a 2D surface. A 3D scene rendered by OpenGL must be projected onto the computer screen as a 2D image. GL_PROJECTION matrix is used for this projection transformation. First, it transforms all vertex data from the eye coordinates to the clip coordinates. Then, these clip coordinates are also transformed to the normalized device coordinates (NDC) by dividing with w component of the clip coordinates.
Не судите меня строго, но на порыве популярности #selfie решил сделать приложение :)
Хочется посмотреть, выйдет ли что-то из этого.
Сам же таким не страдаю и нравится использовать приложение для других целей.
Написал за нескольно дней и поэтому не может подвергаться критике ;)
Доступно со вчерашнего дня и бесплатно. Всю собранную статистику опубликую.