Short Courses on Computer Graphics, Image Processing and Computer Vision

Let me know what you think Mail me...

Course 2D_MFC: 2D-Computer Graphics with C++/MFC

Copyright © by V. Miszalok, last update: 2011-03-25

  Visitors since 01-01-2002 layout: thanks to Stefan Münz

deutsch english
Einführung
C1: Intro, erste Graphikbefehle
C2: Draw, ein Malprogramm
C3: Anim, eine Animation
C4: File, Polygone in Dateien
Introduction
C1: Intro, some simple graphic commands
C2: Draw, a scribble program
C3: Anim, an endless animation
C4: File, store and read polygones

C1: Intro, erste Graphikbefehle

Schreiben Sie ein erstes zweckloses Graphikprogramm. Es enthält den Hello-World-Text, es erfragt die dehnbare Fenstergröße, schreibt zwei Linien, ein Rechteck, eine Ellipse. Es zieht sternförmig dicke Linien mit Zufallsfarben und speichert die Endpunkte in einem Polygonarray, das am Ende zackenförmig rot gezeichnet wird.
Spielen Sie mit dem Programm, indem Sie das Fenster mit der Maus zoomen.

C1: Intro, some simple graphic commands

Write Your first useless MFC-program that demonstrates some simple graphic commands. It demonstrates a Hello-World-text, it evaluates the variable window size, draws two lines, a rectangle and an ellipse. It draws thick radial lines using random colors. Finally it stores the end points of the lines in form of a polygon array which forms a final red splash. It redraws everything in a different way from scratch when you change the window size by dragging one of its borders.

Exe 28 kB Download and try C2DC7Intro.exe EXE 52kB Download and try C2DC8Intro.exe
Link Fragen und Antworten  
PDF Fragen und Antworten drucken    
Link Bauanleitung Link Guidance
PDF Bauanleitung drucken PDF Guidance Print Version
    Link Complete Code
    PDF Complete Code Print Version
    Link Code Comments
    PDF Code Comments Print Version

C2: Draw, ein Malprogramm

neu: OnLButtonDown, OnMouseMove, Polyline, Polygon, PolyBezier
V1: Zeichne die Mausbewegungen ohne sie zu speichern
V2: Anzeige der laufenden Mauskoordinaten
V3: Markieren der Vertices als Kästchen
V4: Minimalabstand zwischen Vertices verlangen
V5: Vertex Array, Umfang, Fläche, Schwerpunkt
V6: Bezier Kurven

C2: Draw, a scribble program

This is a scribble program in 5 increasingly complex versions V1 - V6.
V1: Draw the raw mouse mouvements and forget them
V2: Display the current mouse coordinates
V3: Mark the vertices as small rectangles
V4: Ask for a minimal distance between adjacent vertices
V5: Vertex array, perimeter, area, center of gravity
V6: Bezier curves

EXE 28kB Vorschau C2_Draw_Demo.exe EXE 28kB Download and try C2_Draw_Demo.exe
Link Fragen und Antworten
PDF Fragen und Antworten drucken
Link Bauanleitung Link Code Comments
PDF Bauanleitung drucken PDF Code Comments print

C3: Anim, eine Animation

neu: OnTimer, Scroll, Zoom, Rotate
Malprogramm mit Daueranimation. Die Kritzelfigur dreht und schrumpft um ihren Schwerpunkt und fängt dann an, rhytmisch zu pumpen in Schrittweiten von 1 Grad und 5% Zoom. Geschwindigkeit und Umkehrpunkte sind im Code frei regelbar.

C3: Anim, an endless animation


Scribble program followed by an endless animation.
The cribble rotates and shrinks around its center of gravitiy and starts to breath in steps of 1 degree and a zoom of 5%. The animation velocity and the reversal points are programmable.

EXE 28kB Vorschau C3_Anim_Demo.exe EXE 28kB Download and try C3_Anim_Demo.exe
Link Fragen und Antworten
PDF Fragen und Antworten drucken
Link Bauanleitung Link Code Comments
PDF Bauanleitung drucken PDF Code Comments print

C4: File, Malprogramm mit speichern auf Harddisk

neu: std::vector, CDoc * pDoc→, Serialize, VML
Projektgerüst mit Unterstützung der Dokument-/Ansicht-Architektur
Doc-Klasse und View-Klasse
Dyn. Array der STL vom Typ vector< CPoint > in CFile1Doc
Der Pointer CFile1Doc* pDoc
Serialisierung: schreiben und lesen von Files
WEB-Dateiformat für Polygone: VML

C5: File, a scribble program with file I/O


Project framework with Document-/View-architecture
The Doc-class and the View-class
Dyn. array from the STL vector< CPoint > in CFile1Doc
The pointer CFile1Doc* pDoc
Serialize: writing and reading files
Vector file format for the WEB: VML


EXE 32kB Vorschau C4_File_Demo.exe EXE 32kB Download and try C4_File_Demo.exe
Link Fragen und Antworten
PDF Fragen und Antworten drucken
Link Bauanleitung Link Code Comments
PDF Bauanleitung drucken PDF Code Comments print

top of page: