-
Notifications
You must be signed in to change notification settings - Fork 0
/
CImage.cpp
executable file
·60 lines (42 loc) · 1.01 KB
/
CImage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
CImage.cpp
Author: Tom Naughton
Description: <describe the CImage class here>
*/
#include <UGWorld.h>
#include "CImage.h"
#include "CGLImage.h"
#include "CPakStream.h"
#include "utilities.h"
#include "CPakRatApp.h"
CImage::CImage()
{
::SetRect(&_bounds, 0, 0, 0, 0);
_depth = 32;
}
CImage::~CImage()
{
}
PicHandle CImage::CreatePict()
{
LGWorld *gWorld = CreateGWorld();
RgnHandle theCurrentClipRgn = ::NewRgn();
::GetClip(theCurrentClipRgn); // Save the current clip region
Rect thePICTRect = {0, 0, _bounds.bottom, _bounds.right};
OpenCPicParams myOpenParams = { {0,0, _bounds.bottom, _bounds.right}, _72dpi, _72dpi, -2, 0, 0};
PicHandle thePicH = ::OpenCPicture(&myOpenParams);
if (gWorld) {
::ClipRect(&thePICTRect);
GrafPtr thePort;
::GetPort(&thePort);
gWorld->CopyImage(thePort, _bounds, srcCopy);
delete gWorld;
}
::ClosePicture();
::SetClip(theCurrentClipRgn); // Restore the clip region
return thePicH;
}
LGWorld *CImage::CreateGWorld()
{
return nil;
}