1 / 13

GDI+ getting started

GDI+ getting started. GDI+. Class-based API for C/C++ Windows Graphics Device Interface (GDI) Device-independent applications Services 2D vector graphics Drawing primitives Imaging Bitmap Typography Display of text. Setup. Header file #include <gdiplus.h> Linking library

thetis
Download Presentation

GDI+ getting started

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GDI+ getting started

  2. GDI+ • Class-based API for C/C++ • Windows Graphics Device Interface (GDI) • Device-independent applications • Services • 2D vector graphics • Drawing primitives • Imaging • Bitmap • Typography • Display of text

  3. 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);

  4. 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);

  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);

  6. Brush Graphics 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);

  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);

  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)

  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

  11. Setup • Header file • #include <Dshow.h> • Linking library • #pragma comment (lib, “Strmiids.lib”) • Set the path in your IDE • Platform SDK • DirectX SDK

  12. Writing DirectShow

  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.

More Related