GDI+ getting started. GDI+ Class-based API for C/C++ Windows Graphics Device Interface (GDI) ...
-
date post
22-Dec-2015 -
Category
Documents
-
view
274 -
download
2
Transcript of GDI+ getting started. GDI+ Class-based API for C/C++ Windows Graphics Device Interface (GDI) ...
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
Setup Header file– #include <gdiplus.h> Linking library– #pragma comment (lib, “gdiplus.lib”) Namespace– using namespace Gdiplus; Initialization
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup (&gdiplusToken, &gdiplusStartupInput, NULL);
3
Pen
Graphics graphics (hdc);
DrawLine
Pen pen (Color (255, 255, 0, 0));graphics.DrawLine (&pen, 20, 10, 300, 100);
DrawRectangle
Pen blackPen (Color (255, 0, 0, 255), 5);graphics.DrawRectangle (&blackPen, 10, 100, 100, 50);
4
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
BrushGraphics graphics (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
StringGraphics 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
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
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
Setup
Header file– #include <Dshow.h>
Linking library– #pragma comment (lib, “Strmiids.lib”)
Set the path in your IDE Platform SDK DirectX SDK
11