Компьютерная графика. Лекция 2

  • Published on
    13-Feb-2016

  • View
    95

  • Download
    2

Embed Size (px)

DESCRIPTION

. 2. GDI + WPF. . 2. . API GDI, DirectDraw, Direct3D, OpenGL, GDI+ , WPF - PowerPoint PPT Presentation

Transcript

: ,

. 2 GDI+ WPF1

. 2 APIGDI, DirectDraw, Direct3D, OpenGL, GDI+, WPF

.. Graphics Engine ,

2

. 2GDI, GDI+Graphics Engine 3

. 2GDIGDI (Graphics Device Interface) API Microsoft - Windows 3.116- Windows 95/98 Windows NT/2000+ 32- , GDI+ - API, Windows XP/2003 Server- C++ 4

. 2 GDI

GDI Windows5

. 2 GDI API , , BMP WMF/EMF , , GDI 6

. 2 GDI+ - ++ Windows XP redistributable packages Windows 98/ME/NT4/2000 GDI+7

. 2 GDI+ , GDI+ C++ GDI+ GDI

GDI+ 8

. 2 GDI+ GDI :

Bitmap ;Brush ;Font ;Metafile ;Path ;Pen ;Region .9

. 2Bitmap , , ,

:DDB device-dependent bitmapDIB device-independent bitmap

10

. 2Brush , GDI

, ,

, , 11

. 2

GDI+ .

12

. 2Font GDI+, ( ) ( , )TrueType- OpenType- ( )13

. 2Metafile , , GDI, , bitmap

:WMF windows metafileEMF enhanced metafile

14

. 2Path , /

(, , )

15

. 2Pen ,

Cosmetic Geometric 16

. 2

17

. 2Region , , . , , ,

18

. 2 (Cardinal Splines)Cardinal spline , ,

19

. 2 (Independent Path Objects) GDI+ Graphics, GraphicsPath GraphicsPath 20

. 2 GDI+ Matrix, , , ,

( )

21

. 2 GDI+ , ,

22

. 2 GDI+

23

. 2 GraphicsGDI+ Graphics,

,

GDI+ Graphics24

. 2HDC hdc;PAINTSTRUCT ps;hdc = BeginPaint(hWnd, &ps);{Pen myPen(Color(255, 255, 0, 0), 3);Graphics myGraphics(hdc);myGraphics.DrawLine(&myPen, 20, 10, 200, 100);}EndPaint(hWnd, &ps); GDI+ 25

. 2, , , GDI+ Graphics. Graphics, , , GDI+ , .. , - 26

. 2 MoveTo/LineTo

DrawRectangle FillRectangle

GDI+ Alpha ,

27

. 2 GDI+ Image, Bitmap Metafile , BMPGIFJPEGPNGExifTIFFICONWMFEMF28

. 2 Graphics Pen DrawLine Graphics :myGraphics.DrawLine(&myPen, 4, 2, 12, 6); DrawRectangle GraphicsmyGraphics.DrawRectangle(&myPen, 100, 50, 80, 40);Rect myRect(100, 50, 80, 50);myGraphics.DrawRectangle(&myPen, myRect); 29

. 2

DrawEllipsemyGraphics.DrawEllipse(&myPen, 100, 50, 160, 80);Rect myRect(100, 50, 160, 80); myGraphics.DrawEllipse(&myPen, myRect); 30

. 2

DrawPolygonPoint myPointArray[] ={Point(0, 0), Point(50, 30), Point(30, 60)};myGraphics.DrawPolygon(&myPen, myPointArray, 3); 31

. 2

myGraphics.SetSmoothingMode(SmoothingModeAntiAlias); myGraphics.DrawLine(&myPen, 0, 0, 12, 8); 32

. 2 GDI+ BitmapBitmap myBitmap(L"Spiral.png");

- , 33

. 2 DrawImage

:myGraphics.DrawImage(&myBitmap, 10, 10);

34

. 2 , ,

FontFamily fontFamily(L"Arial");Font font(&fontFamily, 16, FontStyleRegular, UnitPixel); 35

. 2 DrawString GraphicsFontFamily fontFamily(L"Times New Roman");Font font(&fontFamily, 24, FontStyleRegular, UnitPixel);PointF pointF(30.0f, 10.0f);SolidBrush solidBrush(Color(255, 0, 0, 255));

graphics.DrawString(L"Hello", -1, &font, pointF, &solidBrush); 36

Windows Presentation Foundation 4

. 2Windows Presentation Foundation(WPF) Windows , () .NET Framework( 3.0), XAML.

. 2 WPF . , .

. 2 WPFWPF Windows Vista, Windows 7, Windows 8.WPF , XAML(Extensible Application Markup Language), , , , , , , , , , .

. 2 WPF WPF , . , WPF, DirectX, Windows Forms, GDI/GDI+.WPF, GDI+ DirectX

. 2 WPF Silverlight WPF .NET Framework ( , . .). , .NET, WPF. , , Silverlight. Silverlight .

. 2 Silverlight WPF WPF ( ) . WPF . - . WPF-

. 2 WPF , , .WPF ( System.Windows.Controls) ( ): Canvas;StackPanel; WrapPanel;DockPanel;Grid.

. 21) Canvas () - . . 2) StackPanel . 3) WrapPanel StackPanel, . 4) DockPanel , . 5) Grid() - , , . VisualStudio ExpressionBlend Grid . , .

. 2

. 2 , FrameworkElement, Height () Width () ( double), MinHeight, MaxHeight, MinWidth MaxWidth, . , XAML.

. 2 Height Width Margin Padding . Margin , a Padding - . Margin Padding

. 2 Margin Padding HorizontalAlignment VerticalAlignment , . , System.Windows:- HorizontalAlignment - Left, Center, Right, Stretch VerticalAlignment - Top, Center, Bottom, Stretch :

. 2 WPF ( System.Windows.Media.Transform), .

. 2 , System.Windows.Media:RotateTransform;ScaleTransform;SkewTransform; TranslateTransform;MatrixTransform.

RotateTransformScaleTransform

. 2

SkewTransform WPF - .

. 2 , . WPF. (, ListBoxItem ). . : ;;.

. 2 WPF . , . Cut (), () Paste (). : WPF ; (, ); WPF .

. 2 :- - -

. 2

. 2

WPF GDI - , WPF , , . , , , : 10x10 (0,0), - . : 10x10 (0,0) , . , .

. 2 : Drawing, Visual Shape. Drawing - Brush . Visual Drawing , Visual , Drawing. Shape - Visual, ( ) .

. 2 ( D-) WPF, . , 3D , XAML-. WPF , . , .

. 2 - , , . D- - API, , : Material Light Camera

. 2 WPF , Viewport3D, 3D- ( Camera). ( ). , WPF.

. 2 : Light, ; Material, , - ; (Geometry) , . , WPF.

. 2DirectionalLight ( ) , . , . PointLight ( ) . . PointLight , .

. 2 SpotLight () - . . SpotLight , . AmbientLight ( ) . - . , .

. 2 WPF : (, , ..). : SoundPlayer SoundPlayerAction MediaPlayer MediaElement MediaTimeline WPF MediaPlayer, MediaElement MediaTimeline. , , Windows Media Player (WMV, AVI, MPG ), WPF-.

. 2,

. 2 () 18 67

. 2

68

. 2 , , ( ) 69

. 2

(multi-threading)GUI- 70

. 2 , ,

71

. 2 1

72

. 2 2

73

. 2 3

74

. 2 , 75

. 2

1 2 1. 2. 76

Recommended

View more >