1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <fbs.h> |
|
21 #include "DRMEncryptorImage.h" |
|
22 |
|
23 // ================= MEMBER FUNCTIONS ========================================== |
|
24 |
|
25 CDRMEncryptorImage::CDRMEncryptorImage() |
|
26 { |
|
27 } |
|
28 |
|
29 CDRMEncryptorImage::~CDRMEncryptorImage() |
|
30 { |
|
31 delete iBitmap; |
|
32 } |
|
33 |
|
34 CDRMEncryptorImage* CDRMEncryptorImage::NewLC( const TDesC& aFileName, |
|
35 TInt aBitmapId, |
|
36 TInt aStartLine, |
|
37 TInt aBaseLineDelta ) |
|
38 { |
|
39 CDRMEncryptorImage* self = new( ELeave ) CDRMEncryptorImage(); |
|
40 CleanupStack::PushL( self ); |
|
41 |
|
42 self->iBitmap = new( ELeave ) CFbsBitmap; |
|
43 self->iBitmap->Load( aFileName, aBitmapId ); |
|
44 |
|
45 self->iStartLine = aStartLine; |
|
46 |
|
47 // enough lines so that image and margins fit in them. |
|
48 |
|
49 TInt lines( ( self->HeightInPixels() + |
|
50 KImageTopMargin + |
|
51 KImageBottomMargin + |
|
52 aBaseLineDelta - 1 ) / aBaseLineDelta ); |
|
53 |
|
54 self->iEndLine = aStartLine + lines - 1; |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CDRMEncryptorImage::HeightInPixels() |
|
60 // ----------------------------------------------------------------------------- |
|
61 |
|
62 TInt CDRMEncryptorImage::HeightInPixels() const |
|
63 { |
|
64 return iBitmap->SizeInPixels().iHeight; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CDRMEncryptorImage::WidthInPixels() |
|
69 // ----------------------------------------------------------------------------- |
|
70 |
|
71 TInt CDRMEncryptorImage::WidthInPixels() const |
|
72 { |
|
73 return iBitmap->SizeInPixels().iWidth; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CDRMEncryptorImage::StartLine() |
|
78 // ----------------------------------------------------------------------------- |
|
79 |
|
80 TInt CDRMEncryptorImage::StartLine() const |
|
81 { |
|
82 return iStartLine; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CDRMEncryptorImage::EndLine() |
|
87 // ----------------------------------------------------------------------------- |
|
88 |
|
89 TInt CDRMEncryptorImage::EndLine() const |
|
90 { |
|
91 return iEndLine; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CDRMEncryptorImage::Lines() |
|
96 // ----------------------------------------------------------------------------- |
|
97 |
|
98 TInt CDRMEncryptorImage::Lines() const |
|
99 { |
|
100 return iEndLine - iStartLine + 1; |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CDRMEncryptorImage::Bitmap() |
|
105 // ----------------------------------------------------------------------------- |
|
106 |
|
107 const CFbsBitmap* CDRMEncryptorImage::Bitmap() const |
|
108 { |
|
109 return iBitmap; |
|
110 } |
|
111 |
|
112 // End of File |
|