Download presentation
Presentation is loading. Please wait.
1
GDI+ getting started
2
GDI+ Class-based API for C/C++ Windows Graphics Device Interface (GDI) Device-independent applications Services 1)2D vector graphics –Drawing primitives 2)Imaging –Bitmap 3)Typography –Display of text 2
3
Setup Header file –#include Linking library –#pragma comment (lib, “gdiplus.lib”) Namespace –using namespace Gdiplus; Initialization GdiplusStartupInputgdiplusStartupInput; ULONG_PTRgdiplusToken; GdiplusStartup (&gdiplusToken, &gdiplusStartupInput, NULL); 3
4
Pen Graphics graphics (hdc); DrawLine Penpen (Color (255, 255, 0, 0)); graphics.DrawLine (&pen, 20, 10, 300, 100); DrawRectangle PenblackPen (Color (255, 0, 0, 255), 5); graphics.DrawRectangle (&blackPen, 10, 100, 100, 50); 4
5
Pen DrawPath GraphicsPath path; Pen penJoin (Color (255, 0, 255, 0), 25); path.StartFigure (); path.AddLine (Point (100, 200), Point (200, 200)); path.AddLine (Point (200, 200), Point (200, 300)); graphics.DrawPath (&penJoin, &path); 5
6
Brush Graphicsgraphics (hdc); SolidBrush solidBrush (Color (255, 255, 0, 0)); graphics.FillEllipse (&solidBrush, 10, 10, 100, 60); Image image (L"Glass.bmp"); TextureBrush tBrush (&image); tBrush.SetTransform (&Matrix (75.0/128.0, 0.0f, 0.0f, 75.0/128.0, 0.0f, 0.0f)); graphics.FillRectangle (&tBrush, 0, 150, 150, 250); 6
7
String Graphics graphics (hdc); SolidBrush brush (Color (255, 0, 0, 255)); FontFamily family (L“Arial"); Font font (&family, 24, FontStyleRegular, UnitPixel); PointF pointF (10.0f, 20.0f); graphics.DrawString (L"Hello World!", -1, &font, pointF, &brush); 7
8
PlayCap sample
9
Introduction Based on Win32 API DirectShow API GDI+ API IDE Visual C++ 2005 Express Platform SDK LNK1104: cannot open file 'atlthunk.lib' (www.codeproject.com/wtl/WTLExpress.asp) 9
10
DirectShow Capture and playback of multimedia streams for a variety of formats A media-streaming architecture You can download Platform SDK or previous DirectX SDK from our course webpage 10
11
Setup Header file –#include Linking library –#pragma comment (lib, “Strmiids.lib”) Set the path in your IDE Platform SDK DirectX SDK 11
12
Writing DirectShow 12
13
Your Job In HRESULT ProcessBuffer (HDC hDC) Write a simple image processing program to scan pBuffer. The information (size, RGB,..) of pBuffer is stored in pInfo->bmiHeader. 13
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.