turtle graphics

ái này, ai chuyên về Computer Graphics sẽ biết gọi là: Đồ hoạ con rùa (turtle graphics), tập API chỉ có 2 lệnh căn bản: moveBy và rotateBy, ví dụ: tiến 3 bước, xoay 45°, lại tiến 5 bước, xoay tiếp 90°, etc… hệ toạ độ hoàn toàn tương đối. 🙂 Đây là kiểu API tự nhiên, phù hợp để vẽ Hình học Fractal.

Một thời, đám lưu manh cũng kiểu “ta đây biết rồi, chuyên đi đọc vị người khác”, đọc thấy trên blog tkxuyen.com được đúng 1 chữ Computer Graphics nên cũng bô lô bô la: ah, em cũng đồ hoạ máy tính nè, em xài Photoshop, Illustrator… Nhiều kiểu ngu đến mức không tự hiểu ra được ngu chỗ nào!

panorama

ồi đó, không nhớ là năm nào, xài cái iPhone 4S (dạng cũng rất hiện đại lúc đó) chụp ảnh panorama, thấy chất lượng tệ, không bằng lòng nên đi mua cái Sony NEX5R, chiếc máy ảnh không gương lật đầu tiên, chụp panorama khá tốt. Hôm nay thử dùng chỉ 1 cái iPhone 7 cũ rích chụp pano thử xem, cho ra 1 cái ảnh 15000 x 4000 pixel (chờ ảnh load hơi lâu), má ơi, đúng là mình lạc hậu về công nghệ thật rồi! Haiza, đúng là thời thế, công nghệ đi quá nhanh, đẹp hơn hẳn máy ảnh chuyên nghiệp ngày xưa…

P/S: làm nghề lập trình, nói có vẻ ngược đời, nhưng từ xưa giờ vẫn quan niệm rằng: tôi chẳng cần phải biết cái éo gì về công nghệ (technologies) cả! Tôi chỉ biết về kỹ thuật (techniques) thôi! Vâng, nói rõ ràng như vậy! Tôi chỉ biết những mánh mẹo, kỹ xảo lập trình xa xưa, những thủ pháp cấu trúc dữ liệu, tối ưu hoá li ti, thời của “programming pearls” – những viên ngọc lập trình ấy! Coder giờ toàn ở “trên trời”, công nghệ này kia, AI, Machine learning, Big data, nói như vẹt, chỉ có điều mấy cái “rất căn bản” lại không biết! 😢

Ảnh lớn, cuộn theo phương ngang để xem.

coastline paradox

enoit Mandelbrot xuất bản 1 bài báo trên tạp chí Science năm 1967, nhan đề: Đường bờ biển của nước Anh dài bao nhiêu? Giả sử ta dùng một cây thước dài 1 km để đo đường bờ biển, cộng lại với nhau thì được chiều dài ‘x’ km. Nhưng nếu dùng 1 cây thước khác, có chiều dài ví dụ như 100 m để đo thì lại được 1 chiều dài khác lớn hơn, ‘y’ km. Đơn giản vì cây thước 1km là 1 xấp xỉ rất “thô”, ở giữa khoảng cách 1km đó, đường bờ biển không phải là 1 đoạn thẳng. Dễ dàng nhận thấy rằng, nếu dùng cây thước càng ngắn, thì chiều dài đo được càng tăng, và nếu chiều dài cây thước tiến dần về 0 thì chiều dài đường bờ biển tiến dần về vô hạn.

Đó gọi là “nghịch lý đường bờ biển – coastline paradox”, và cũng từ đó (1967) chính thức xuất hiện 1 nhánh toán học mới, gọi là hình học fractal, nghiên cứu 1 loại đối tượng đặc biệt, ví dụ như ở đây là bản đồ nước Anh, một đối tượng hình học có diện tích hữu hạn, nhưng chu vi… vô hạn! Đây là chủ đề yêu thích của tôi những năm cấp 3 và ĐH, vì nó liên quan trực tiếp tới đồ hoạ máy tính (computer graphics). Gọi là “Nghịch lý” vì nó đi ngược với “trực quan” của chúng ta, qua đó nói lên rằng, những gì ta suy nghĩ bằng ngôn từ, đôi khi chỉ là 1 sự lừa dối, sự lừa dối khó nhận ra vì suốt bao nhiêu năm, cách suy nghĩ của chúng ta bị đóng trong 1 cái khuôn máy móc!

Riêng về đường bờ biển Việt Nam, nếu đo bằng phương pháp Việt Nam thì nó có chiều dài khoảng 2400 km, nếu đo bằng cách của Mỹ thì nó lại dài khoảng 3400 km, còn nếu đo bằng “toán học” thì nó dài… vô hạn! Có điều gì rất “Phật giáo” trong phép đo này, chiều dài của một đối tượng hình học không phải là một hằng số, không phụ thuộc vào “các định luật vật lý hiển nhiên”, mà ngược lại, chiều dài đó lại phụ thuộc vào cách chúng ta đo nó! Nói nôm na, phiên phiến là… “tâm” nó tới đâu thì “tầm” (chiều dài đối tượng) nó tới đó. Chiều dài của một “đối tượng hình học Euclide” đơn giản đôi khi nằm ngoài “nhận thức thông thường” của con người! 😀

algorithms

ột phần quan trọng của 4 năm ĐH nằm trong cuốn này. Sách ngoại văn bìa cứng (hard cover), giấy tốt, đồng giá 50K/cuốn. Những năm 199x, FAHASA nhập sách ngoại về, bán chẳng ai mua, canh me đi qua lúc nó sale off, xúc luôn 1 lúc 20 cuốn, từ Algorithms, Data structure, Database… Algebra cho đến Mathematical Analysis, etc… Cũng là lý do tại sao thuật ngữ Toán, Tin… ko hề biết tiếng Việt. Cũng chưa thấy cuốn sách Tin học nào hay và bổ ích như cuốn này.

Nói cho đúng là cái cách hành văn khoa học tiếng Anh của nó ám ảnh mình, ít khi thấy được một cách hành văn hay, súc tích, dể hiểu đến như thế, cộng thêm minh hoạ cực kỳ xinh đẹp. Nếu nói mức độ hiểu 1 vấn đề nó thể hiện qua cái khả năng diễn đạt, trình bày lại để cho người khác cũng hiểu vấn đề đó thì tác giả cuốn này đúng là siêu đẳng !!! Về sau phát hiện ra, cả thư viện ĐH KHTN có đúng 1 cuốn này, mình có riêng 1 cuốn! Không có thói quen đọc nhiều sách, theo mình, cả ĐH chỉ cần đọc chừng 3, 4 cuốn, và cả cuộc đời chắc không cần đến 20 cuốn. Đọc nhiều quá phí hoài… tuổi xanh đi!

Dự định sau này mình sẽ đóng 1 cái kệ sách cao đến sát trần nhà, lý do là bỏ bớt những cuốn không đọc lên trên cao để không phải đụng đến chúng! 😅 Sách thực sự hay ít như sao buổi sớm, mà sách lôm côm nhiều như… lá rụng mùa thu! Sau bác nào đó thấy sách ngon, mượn ko trả, tiếc đứt ruột! 😥

lés travailleurs de la mer

Nơi nghĩa trang chật hẹp, tiếng vọng âm vang,
Chẳng một nhánh liễu xanh mùa thu trút lá,
Không một khúc hát ngây thơ buồn bã,
Góc cầu xưa người hành khất thường ca.

ritten with a Pencil stylus on an iPad using our own home – brew inking technology. Excerpt from the famous novel Lés travailleurs de la mer (Toilers of the Sea), Victor Hugo, and my literal, clumsy English translation: Navigation, it is education, sea is the brave school… The voyageur Ulysse had done lots more deeds then the Achille combatant. The sea quenches man, if soldiers are made of iron, then the mariners must have been made of steel. Look at them, in the ports, those tranquil martyrs, the silent winners, man figures with a religious look in their eyes as they’ve come out of the abyss…

the man of wisdom delights in water…

仁者樂山
智者樂水

ritten with a Bamboo stylus on iPad, using my inking mentioned earlier! A quote from Confucius’ Analects, and its partial, literal equivalence in English on this post’s title… Looks like there’s still lots of space for improvements on creating real, good — looking strokes (for Chinese round brush and other kinds of brushes). Really discontent with my Chinese handwriting ever since, it’s never been good enough for me, it’s been degrading greatly over time without practicing! My handwriting reflects my messy, chronically — undisciplined character! 😢

inking

y proudly – announced achievement for the last 6 working months, now is a registering (pending) patent in the U.S. It’s about create inking effect to handwriting on iPad (ideally with a stylus): you can apply many pen styles: ball pen, fountain pen, calligraphy pen, Chinese round brush, and different levels of ink wetness. You may have seen my handwriting in severalpreviousposts, but this is completely different, a big step forward, much more a realistic look like ink on paper. You need to see it in action to witness how interesting the “beautification effect” it is!

Different pen styles:

Different ink wetness:

Another writing example, a poem in both Vietnamese and Chinese:

And now, a real world application, my new year greeting card, hand – written on iPad, printed on paper, with my signature and personal seal on it. Old vintage things are not to be perished, they just come back in new neoclassical forms, to have “inflated”, “degraded” contemporary values reprimanded! 😀

styli

was playing around with some iPad’s styli lately and here they’re: the Wacom Bamboo stylus, TruGlide, Adonit Jot, Adonit Jot Touch, Jaja, Cregle’s iPen and ByZero. I’ve been loving the smoothness of Bamboo, but TruGlide is really an excellent one! The new Adonit Jot Touch seems to be promissing, and on the second position is Jaja (for pressure sensitive styli).

wwdc 2012

t would start within a week from now, the well – expected event of Apple’s world – wide developers conference of 2012 – WWDC 2012. To welcome the tech fair 😛😛, on the left is a screen capture of what I’ve been working hard on for the whole last month (the video is not really clear since it’s shot with my phone), a photo browser UI like iPad’s Photos app. It takes time to learn insights into Core Graphics, Core Animation, and I’m still learning. For all those years of graphics I’ve been through, Apple UI and its graphics sysem are still sooo… brilliant and amazing to me! (and “our love has just begun”!) Keep heading North!

chuyện tình tự kể

gày nào, cho tôi biết, biết yêu em rồi, tôi biết tương tư, sau đây là câu chuyện tình tôi tự kể, ngày nào, biết mong chờ, biết rộn rã buồn vui đợi em dưới mưa… Chúng tôi quen nhau tính về thời gian chưa phải là quá lâu, chỉ một vài năm gì đó. Nhưng nguồn cơn, nguyên do câu chuyện có lẽ đã được vun vén, manh nha từ lâu rất lâu về trước, tôi thương em dễ có từ thủa mẹ về với cha.

Bao giờ biết tương tư - Tuấn Ngọc 

Những lý do, ngọn nguồn chẳng thể nào mà giải thích và truy nguyên cho được đã dần đưa chúng tôi lại với nhau tự lúc nào. Tình yêu nào rồi cũng sẽ đi qua nhiều thăng trầm, đã có lúc tôi cảm giác chẳng hiểu gì về em, nhiều khi sự khó khăn của em làm tôi nản chí, cũng có khi tôi đã hoang mang, nghi ngờ em và chính mình.

Nhưng với tình cảm chân thành, bằng trực giác tự nhiên mách bảo, chúng tôi đã vượt qua nhiều sóng gió, để đến một ngày: ngày nào, cảnh thiên đường, đã mở hé tình yêu là trái táo thơm, tôi ghé răng cắn vào… Đến đây thì hẳn các bạn đã đoán ra nàng thơ của tôi tên là… Apple –  hiện diện trên các MacBook, iPhone, iPod, iPad xinh xắn! 😬

the new ipad

ust got the new iPad (or we called it: the iPad 3) in hand today and I’m stunned by it’s new retina display. There’s not such a fever like when the iPad 2 was released, I guess since the new iPad is almost identical to iPad 2 in appearance, people will consider about the fact that they won’t be able to show it off. In term of general performance, iPad 3 does not stand out to the previous iPad, or it could be worse in term of 3D – OpenGL performance according to some reviews. From a programmer’s point of view, this could easily be understood since doubling the resolution means 4 times the memory and processing power for each graphics API, which also means Apple has been pushing things over the Moore law’s limit!

Personally I’m not really a passionate fan of these Mắc – Xinh – Tốt (Macintosh) assets, but professionally as a computer – graphics coder, I’ve always admired the prestigous 2D graphics tradition come with Apple’s products. Back to the retina display, on the left is a reduced – size screenshot of this blog taken on the iPad 3 (see full version here, it would take some times to load).

2048 x 1536 is a huge resolution that does magic to the vector things, e.g: displaying fonts! Not only the screen is much sharper, even at first look, its color tone appears to be truer, and the new iPad gamut covers 44% more into the sRGB color space compared to the previous iPad. The second picture: funny capture of Walter Isaacson’s Steve Jobs autobiography put on – top the God of Wealth’s altar in our office 😀!

⓵⏎Mắc – Xinh – Tốt: a phonetical transcription of the name: Macintosh, which is a play–on–words, Mắc means: expensive, Xinh means: cute and Tốt means: good in Vietnamese 😀.


ios-widgets

aving written myself numerous UI widgets, from simple to complex, from Windows to Linux, from 2D to 3D… but I’ve just started writing iOS widgets not too long ago. Making iOS widgets is really fun, for we have supports from the most powerful 2D graphics system ever built, that is CoreGraphics (Quartz 2D). The code, hosted on github, is released under MIT license, check it out for a demo project, I hope that these widgets would be useful somewhere, but yes, I know, don’t complain about the code quality, most is written in a rush and still have flaws in it, use at your own discretion!

1.   XFilePathHeader

This tabular header let you quickly browse a hierachy structure (like file system directories). The levels are shown as tabs, tap on a tab to jump to a parent folder, tap on the “Home” icon to jump to root folder.

2.   XSegmentedControl

The Apple’s standard UISegmentedControl only displays text, not image. This class lets you use image along with text (or image or text alone) in any orders (image then text, or text then image).

3.   XProgressTextField

This is a copy of Safari’s address textfield which shows a progress bar while the webpage is loading. Would continue to add more of these miscellaneous tiny widgets just for fun when I have time.

handwriting

his is part of the really fascinating broader concept of neo – analog as mentioned in a previous post. Below is my handwriting with a stylus on my iPad (click to see large version), not too bad after 10 years of solely keyboard and mouse, not pen, right? Also, I’m quite excited with the coming Kindle touch (which should be delivered at end of the month). My thought is that it’s just a matter of time before e – ink would have color and refresh rate capabilities near those of conventional displays, and serious applications would be feasible within the vintage look and feel of e – ink!

7554 – the điện biên phủ game

game to be published this October, to be precise, the first Vietnamese FPS (first person shooter) 3D game, and you know what it’s about, the famous Battle of Điện Biên Phủ. The game features 4 main characters, all joined the anti – colonial – French movements from the very early days, participated in various operations before arriving at the final confrontation at Điện Biên Phủ. Not yet to be released, but below are some nice preview screenshots. Having some experiences with game engines, I could say that PC 3D games nowadays are not that hard as before.

They are not really about low level graphics techniques, you would rarely even touch to OpenGL (or DirectX), the engines support most elements you would need. To make a game interesting, it is more about storyboard, scene building, animation, physical modeling and game AI. Anyhow, this is an interesting and promising project, since not only it’s the 1st real FPS game made in Vietnam, but also the first game that takes its inspirations and stories from our history!

svg morphing

ector graphics has always been my fascinating topic ever since the time of DOS (and Borland C++ 3.1): path, stroke, fill functions… Never really consider JavaScript as “real programming” 😀, but today, we’ve got many of the 2D, 3D capabilities with this language, and sometime we just need to have our idea implemented quick! The little fun below tries morphing the drawing paths, hence transforming one painting into another. Vector graphics are acquired using AutoTrace, the open source tool that helps converting (tracing) bitmap image into vector form (SVG). Loading SVG and morphing paths are easily done with the Raphaël.js library.


Click on the white arrow button to begin animating, click again to reverse the transformation, move mouse over each path to get it highlighted. Click here to see the artist‘s original paintings and finer SVG tracings!

verlet integration

little fun with gaming physic, written using Three.js, the 3D library built ontop of HTML5 and WebGL. Physics engines like ODE or PhysX support a wide range of simulation: rigid body, soft body objects… While those engines are powerful, they are somewhat weak in scalability, e.g: to simulate the flag below, we need to create an array of hundreds of objects, which may not really feasible on small devices.

This demo tries its own physical calculation called Verlet integration: numerical method to apply Newton’s second law of motion to a system of point masses. Verlet integration, despite its complicated formal description, is simple enough to be calculated and executed in real time on the low end mobile devices.

The demo works best on Chrome but it should work on any browser that supports <canvas> (try dragging the flag to add some motion).

game terrain



little technique to create terrains for use in game. Sometimes, we need to create game spaces with: mountain, plain, valley, river… the environment where our game scenes take place. It could be a labour – intensive task unless we can make use of the existing geographic data. Some games like Flight Simulator have the scenes modelled exactly after the real world.

First, we would need a topographic map, typically the height – contour map used in artillery. Nowadays, the SRTM and ASTER GDEM projects provide these data for free in digital format. They are satellite (radar) images of the earth surface with resolution upto 90m for SRTM and 30m for ASTER GDEM. I would recommend the ASTER GDEM for its higher resolution. Go to the site, follow its complicated registration process to download the data via NASA’s ftp server.

The downloaded data would be Zip packages with height info in GeoTIFF format. Next, we would use this MicroDem utility to convert it into PGM, an intermediate format that can be read by Photoshop (or GIMP). Then we save it as heightmap (PNG or TIFF format) which can be imported into most game editors. By now, the terrains are recreated exactly as they appear in our real geographical world. Just apply textures, lighting, water and other stuffs then to make it look good!

Images on the left: 1. topographic data as rendered by MicroDem, 2. heightmap (grayscale image) as viewed by Photoshop, 3. the terrain created and roughly decorated (a low – poly version), here is the Sơn Trà peninsula (or les vallées de mon coeur 😀), the shape, the silhuette that’s long been in my heart!

unity




Screenshots of the new Unity desktop. There’s certainly a harsh non – exclusive competing between Unity and GNOME Shell. A proxy war between Ubuntu and Fedora Core, which is in turn a proxy war between Canonical and Red Hat.

Eventually, it’s user experiences that would decide which desktop is best (and best for what), and that’s still a long way to come. But technically, Unity is the first huge bold break from tradition, whose real goal deep inside is replacing completely the age – old heritage of X window system by an OpenGL – based one, a problem partially addressed in my previous post.

am trying Ubuntu’s new desktop introduced lately with Natty Narwhal (11.04). After heavy development phases, Unity has reached its alpha stage, a massive move replacing the GNOME desktop environment by a completely new one written from scratch. I’ve read too many negative reviews about Unity already, but personally I think this is a good move. Developed from Ubuntu’s Netbook Remix (which I didn’t like much, you don’t have to maximize windows like that all the time), switched from Clutter to Compiz 3D windows compositing system (my last experiment with Clutter also hinted potential performance problems), the new Unity shows a huge shift toward Mac’s style desktop. Though there’s still lots of bugs and missing features, a few things can be said about this new Unity.

First, people complains about the break from the norms, some hates Unity because it stops their accustomed habits. The GNOME community (with its long development history) can feel like being betrayed. But for all I knew after some years in graphics, UI design is the job of personality, it’s the task of a small group who decides what is “nice and beautiful”, and which is the way (for other users) to follow, it’s not the task of a committee (that is “People’s Committee” I mean 😬). As a developer, I’m often in the self – conflicting state of wondering what is “nice and beautiful”, modify over and over again some simple UI widgets. It’s no strange that UI always becomes a huge diversity (and problems) for community – driven projects. Key requirements for a UI system in my opinion are: simplicity, consistency and elegance.

For consistency and simplicity, Unity is a big step forward, reasons given that GNOME has become too complex and inconsistent (then how about the much more complex KDE?). Maximized windows have the caption and menu bars all incorporated into the system bar on top, a feature clearly borrowed from Mac, yet further varied and developed. A simple dock bar is positioned on the left, and system menu button doesn’t bring up menu but a searching panel with which you can launch programs, open files… with a few key strokes. I like this much cause it offers a form of GNOME – Do: it’s harder to launch rarely – used items (especially if you don’t remember the names) but it’s more convenient for frequently – used ones. After all, lexical memory is much faster than spatial memory, if one has been trained to that.

One more apparent physical factor is that the vertical screen space is more scarce compared to horizontal space, and 16:9 screens has become quite popular. To conserve useful screen space, UI must make constraints to the caption, menu bars, especially tool bars, there’s even recommendations on eliminating the status bar and minimizing scroll bar at Mark Shuttleworth’s (Canonical’s founder) blog. For scroll bar, that’s quite sure a mimic and modified version taken from iOS. Actually with my recent experiences with Mac and iOS, there’s still a lot of lessons to be learned from these two OSes on how to use space efficiently: remove heavy windows decorations and borders, use lighter UI fonts, smaller and more symbolic icons, design simpler widgets… and in cases even sacrifice some less – used UI features.

The trend of UI becoming simpler and more consistent is quite obvious. Efficient uses of space is the key, but spatial is not all for user experiences: keyboard and mnemonic are also important parts of the learning path (UI effects can be fancy, but over time, people get to love the simplest keystrokes that do the job). The third factor: elegance is even more a topic of debate, people can largely agree to what is simplicity and consistency, but what is aesthetics remains mysterious! Unity claims that it would directly compete Mac on UI designs and user experiences, but my opinion is that its aesthetic aspect is still far behind that of Mac, e.g: Compiz’s effects are numerous, but actually not very fine – tuned compared to the smaller set of animations Mac offers… And even Mac still doesn’t satisfy my eyes in quite many cases…

vectorial

The classical SVG example rendered using a thin OpenVG layer on top of OpenGL (or Quartz) on a Mac. This is also to say goodbye to the old Lunar year (year of the tiger) that is ending!

inished with my survey on vectorial graphics, in details, about rendering SVG using Quartz, OpenGL (ES) on Mac, iOS and some Android flatforms. I’d had the chances to systematize more my knowledge on vectorial: path, stroke, anti – aliasing, solid, gradient and pattern fill, etc… Todays, people’s all talking about 3D, OpenGL, DirectX, etc… While few mentions much about 2D stuffs, I’ve traced back some historical evolution paths, since I believe that it’s through history would we understand technologies.

In the beginning, there was… PostScript

It was John Warnock who kindled the idea, he joined Xerox in 1978 and an early version of PostScript (named InterPress) became the language to drive a laser printer. Laser printer was then a revolutionary device, which offers extraordinary graphics compared to the capability of dot or matrix printers. Warnock left and founded Adobe in 1982, the company that produced well – known graphics softwares including Illustrator, king of the vectorial editors.

Then there was DPS, PDF and Quartz

But it was Steve Job who realized the superiority of PostScript and urged John Warnock to popularize it. When Steve Jobs left Apple and started NeXT, he co – developed with Adobe DPS – Display PostScript, a derivative of PostScript – the language that drives the NeXT computer’s graphics system. When Steve has got back to Apple, DPS then evolved into what is now known as PDF, and Quartz is the C binding that bridges traditional Unix programmers to the Mac graphics world.

The X window system

The X’s designers also started with a PostScript RedBook in hand. But due to various reasons including the lack of in – depth consensus about vectorial, X maintains until now low level of PostScript support. The X server can only handle basic PostScript commands (it can’t even draw splines). X took a hybrid approach using both vectorial and raster – based solutions to the problem. Also the Unix root has an impact: X is the only true client/server windowing system to the current day.

Until now, the NeXT computer remains an idealistic symbol, pure vectorial remains a pursuit, perhaps for higher – standard devices, such as with this Backbone:

Backbone is an attempt (our attempt) at creating a Really Good Desktop. The metric we use for “Really Good” is our own. In short, to us, to carry on the NeXTSTEP® and OPENSTEP® spirit!

The Windows’ GDI

Born to be the youngest of all graphics systems, GDI learns nothing from it predecessors. Neither it is device and resolution independent (like Macs) nor a true client/server system (like X). GDI sticks to screen and the pixel unit with quite a lot implementation flaws. These flaws won’t become obvious until we come to serious editing, publishing and printing: text documents and graphics designs would never has the on – screen – display and printing qualities we would expect, though various 3rd party softwares would come to rescue somewhat the situations.

Then, things change with time

The 2D graphics systems on Mac, Windows, Unix… all has different origins, and all targets different real – world problem domains. All has hardware acceleration to various levels and qualities, and it’s hard to compare them in some cases. To the present day, no system is known to keep the original idealistic model that uses pure PostScript: X has been mixed from the beginning, Mac & iOS have switched to raster to some extent, GDI is essentially pixel – based. Then come the wind of change! It would be another story, another evolution path, but today, 3D hardwares has become quite popular with reasonable prices. It’s counter – intuitive to treat 2D as a separate part from 3D, and the trend is merging 2D to become a subset of 3D rendering. However, the process hasn’t been very easy, it would take some more time to reach maturity:

  • WPF (Windows Presentation Foundation): first came with Windows Vista, GDI now runs as part of DirectX 3D rendering environment. Vista was not a success indeed!

  • QuartzGL: Quartz2D runs on top of OpenGL since OS X 10.2 (Jaguar). However, QuartzGL is not enabled by default even in the current version (10.6 – Snow Leopard) since it’s still quite buggy.

  • GLX & AIGLX: both has some implementation problems and is competing to each other to become the official 3D extension for X.

Taken an arbitrary GDI’s API (such as MoveTo, LineTo…) we can see the parameters’ type is integer, which is in reality the pixel unit. The Quartz’s counterparts are always in float, a virtual unit so that the APIs can be device and resolution independent.

The so called “GDI printer” is actually a bitmap device, it lacks a PostScript interpreter and hence need to be attached to a computer to do the actual computing. Reason is obvious: cheapness, adding a PostScript interpreter would significantly raise the cost!