os/graphics/graphicsresourceservices/graphicsresource/inc/sgresource.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @publishedPartner
sl@0
    19
 @prototype
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef SGRESOURCE_H
sl@0
    23
#define SGRESOURCE_H
sl@0
    24
sl@0
    25
#include <e32cmn.h>
sl@0
    26
#include <graphics/sgconst.h>
sl@0
    27
sl@0
    28
sl@0
    29
/**
sl@0
    30
@publishedPartner
sl@0
    31
@prototype
sl@0
    32
@deprecated
sl@0
    33
sl@0
    34
Set of static functions in the Graphics Resource API.
sl@0
    35
*/
sl@0
    36
class SgDriver
sl@0
    37
	{
sl@0
    38
public:
sl@0
    39
	IMPORT_C static TInt Open();
sl@0
    40
	IMPORT_C static void Close();
sl@0
    41
	IMPORT_C static TInt ResourceCount();
sl@0
    42
	IMPORT_C static void AllocMarkStart();
sl@0
    43
	IMPORT_C static void AllocMarkEnd(TInt aCount);
sl@0
    44
	IMPORT_C static void SetAllocFail(RAllocator::TAllocFail aType, TInt aRate);
sl@0
    45
	};
sl@0
    46
sl@0
    47
sl@0
    48
/**
sl@0
    49
@publishedPartner
sl@0
    50
@prototype
sl@0
    51
@deprecated
sl@0
    52
sl@0
    53
A user-defined graphics resource attribute. The Graphics Resource driver can attach
sl@0
    54
attributes defined by the user to a resource at creation time but does not interpret
sl@0
    55
them. The attributes cannot be changed after the resource has been created.
sl@0
    56
*/
sl@0
    57
struct TSgUserAttribute
sl@0
    58
	{
sl@0
    59
	/**
sl@0
    60
	The globally unique identifier of the attribute.
sl@0
    61
	*/
sl@0
    62
	TUid iUid;
sl@0
    63
	/**
sl@0
    64
	The value of the attribute.
sl@0
    65
	*/
sl@0
    66
	TInt iValue;
sl@0
    67
	};
sl@0
    68
sl@0
    69
sl@0
    70
/**
sl@0
    71
@publishedPartner
sl@0
    72
@prototype
sl@0
    73
@deprecated
sl@0
    74
sl@0
    75
This class is used to uniquely identify drawable resources. It represents an opaque
sl@0
    76
192-bit identifier that is unique across the system but not persistent.
sl@0
    77
*/
sl@0
    78
NONSHARABLE_CLASS(TSgDrawableId)
sl@0
    79
	{
sl@0
    80
public:
sl@0
    81
	inline TBool operator ==(const TSgDrawableId& aId) const;
sl@0
    82
	inline TBool operator !=(const TSgDrawableId& aId) const;
sl@0
    83
public:
sl@0
    84
	/**
sl@0
    85
	The identifier stored as an array of six 32-bit integers. The contents have
sl@0
    86
	no meaning to the user, except that all zeros represents a null identifier.
sl@0
    87
	*/
sl@0
    88
	TUint32 iId[6];
sl@0
    89
	};
sl@0
    90
sl@0
    91
sl@0
    92
/**
sl@0
    93
@publishedPartner
sl@0
    94
@prototype
sl@0
    95
@deprecated
sl@0
    96
sl@0
    97
This constant represents the null drawable resource identifier, defined as 192 zero bits.
sl@0
    98
*/
sl@0
    99
const TSgDrawableId KSgNullDrawableId = {0, 0, 0, 0, 0, 0};
sl@0
   100
sl@0
   101
sl@0
   102
/**
sl@0
   103
@publishedPartner
sl@0
   104
@prototype
sl@0
   105
@deprecated
sl@0
   106
sl@0
   107
This globally unique identifier represents the handle type for instances of RSgDrawable.
sl@0
   108
*/
sl@0
   109
const TUid KSgDrawableTypeUid = {0x102858EB};
sl@0
   110
sl@0
   111
sl@0
   112
class MSgDrawableAdapter;
sl@0
   113
sl@0
   114
/**
sl@0
   115
@publishedPartner
sl@0
   116
@prototype
sl@0
   117
@deprecated
sl@0
   118
sl@0
   119
A handle to a reference-counted graphics resource that can be drawn in different
sl@0
   120
rendering pipelines, for example DirectGDI, OpenVG etc. Instances of RSgDrawable
sl@0
   121
allow access to drawable resources created using other APIs without knowing the
sl@0
   122
concrete type of the resource. Since drawable resources are reference-counted they
sl@0
   123
are guaranteed to exist while there are open handles referencing them.
sl@0
   124
sl@0
   125
A new RSgDrawable handle does not refer to a drawable resource until a successful
sl@0
   126
call to Open(). Before that point, the handle is said to be a null handle. Instances
sl@0
   127
of RSgDrawable can be shared among threads in the same process.
sl@0
   128
sl@0
   129
An RSgDrawable handle is said to be invalid if it is not null but it does not
sl@0
   130
reference an existing drawable resource. Copying an instance of RSgDrawable must
sl@0
   131
be done with extreme care, since it does not increment the reference count of the
sl@0
   132
referenced drawable resource and may therefore allow some RSgDrawable handle to
sl@0
   133
become invalid when the drawable resource is destroyed.
sl@0
   134
*/
sl@0
   135
NONSHARABLE_CLASS(RSgDrawable)
sl@0
   136
	{
sl@0
   137
public:
sl@0
   138
	IMPORT_C RSgDrawable();
sl@0
   139
	IMPORT_C TInt Open(const TSgDrawableId& aId);
sl@0
   140
	IMPORT_C TInt Open(const TSgDrawableId& aId, TUint32 aMode);
sl@0
   141
	IMPORT_C void Close();
sl@0
   142
	IMPORT_C const TSgDrawableId& Id() const;
sl@0
   143
	IMPORT_C TBool IsNull() const;
sl@0
   144
	IMPORT_C TUid DrawableType() const;
sl@0
   145
	inline TUid HandleType() const;
sl@0
   146
	template<class M> inline TInt GetInterface(M*& aInterfacePtr);
sl@0
   147
	template<class M> inline TInt GetInterface(const M*& aInterfacePtr) const;
sl@0
   148
private:
sl@0
   149
	IMPORT_C TInt GetInterface(TUid aInterfaceUid, TAny*& aInterfacePtr) const;
sl@0
   150
protected:
sl@0
   151
	TUid iHandleType;
sl@0
   152
	MSgDrawableAdapter* iImpl;
sl@0
   153
	};
sl@0
   154
sl@0
   155
sl@0
   156
#include <graphics/sgresource.inl>
sl@0
   157
sl@0
   158
#endif // SGRESOURCE_H