-
Notifications
You must be signed in to change notification settings - Fork 3
/
listing7.html
executable file
·596 lines (515 loc) · 24.2 KB
/
listing7.html
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<!-- BEGIN META TAG INFO -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="home" href="http://developer.apple.com/">
<link rel="find" href="http://developer.apple.com/search/">
<link rel="stylesheet" type="text/css" href="../../documentation/css/adcstyle.css" title="fonts">
<script language="JavaScript" src="../../documentation/js/adc.js" type="text/javascript"></script>
<!-- END META TAG INFO -->
<!-- BEGIN TITLE -->
<title>GreyscaleEffectSample - /Effect.r</title>
<!-- END TITLE -->
<script language="JavaScript">
function JumpToNewPage() {
window.location=document.scpopupmenu.gotop.value;
return true;
}
</script>
</head>
<!-- BEGIN BODY OPEN -->
<body>
<!--END BODY OPEN -->
<!-- START CENTER OPEN -->
<center>
<!-- END CENTER OPEN -->
<!-- BEGIN LOGO AND SEARCH -->
<!--#include virtual="/includes/adcnavbar"-->
<!-- END LOGO AND SEARCH -->
<!-- START BREADCRUMB -->
<div id="breadcrumb">
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr>
<td scope="row"><img width="340" height="10" src="images/1dot.gif" alt=""></td>
<td><img width="340" height="10" src="images/1dot.gif" alt=""></td>
</tr>
<tr valign="middle">
<td align="left" colspan="2">
<a href="http://developer.apple.com/">ADC Home</a> > <a href="../../referencelibrary/index.html">Reference Library</a> > <a href="../../samplecode/index.html">Sample Code</a> > <a href="../../samplecode/QuickTime/index.html">QuickTime</a> > <a href="../../samplecode/QuickTime/idxVideoEffectsTransitions-date.html">Video Effects & Transitions</a> > <A HREF="javascript:location.replace('index.html');">GreyscaleEffectSample</A> >
</td>
</tr>
<tr>
<td colspan="2" scope="row"><img width="680" height="35" src="images/1dot.gif" alt=""></td>
</tr>
</table>
</div>
<!-- END BREADCRUMB -->
<!-- START MAIN CONTENT -->
<!-- START TITLE GRAPHIC AND INTRO-->
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td><h1><div id="pagehead">GreyscaleEffectSample</div></h1></td>
</tr>
</table>
<!-- END TITLE GRAPHIC AND INTRO -->
<!-- START WIDE COLUMN -->
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td id="scdetails">
<h2>/Effect.r</h2>
<form name="scpopupmenu" onSubmit="return false;" method=post>
<p><strong>View Source Code:</strong>
<select name="gotop" onChange="JumpToNewPage();" style="width:340px"><option selected value="ingnore">Select File</option>
<option value="listing1.html">/ComponentIncludes/ComponentDispatchHelper.c</option>
<option value="listing2.html">/ComponentIncludes/ComponentIncludes.txt</option>
<option value="listing3.html">/ComponentIncludes/Components.k.h</option>
<option value="listing4.html">/ComponentIncludes/ImageCodec.k.h</option>
<option value="listing5.html">/ComponentIncludes/ImageCompression.k.h</option>
<option value="listing6.html">/ComponentIncludes/QuickTimeComponents.k.h</option>
<option value="listing7.html">/Effect.r</option>
<option value="listing8.html">/EffectDefinitions.h</option>
<option value="listing9.html">/EffectDispatch.h</option>
<option value="listing10.html">/EffectRezPB.r</option>
<option value="listing11.html">/GreyscaleEffect.c</option>
<option value="listing12.html">/PrefixIncludes/PrefixCarbon.h</option>
<option value="listing13.html">/PrefixIncludes/PrefixCarbonCFM.r</option>
<option value="listing14.html">/PrefixIncludes/PrefixCarbonMachO.r</option>
<option value="listing15.html">/PrefixIncludes/PrefixPPC.h</option>
<option value="listing16.html">/PrefixIncludes/PrefixPPC.r</option>
<option value="listing17.html">/README.txt</option></select>
</p>
</form>
<p><strong><a href="GreyscaleEffectSample.zip">Download Sample</a></strong> (“GreyscaleEffectSample.zip”, 458.7K)<BR>
<strong><a href="GreyscaleEffectSample.dmg">Download Sample</a></strong> (“GreyscaleEffectSample.dmg”, 803.4K)</p>
<!--
<p><strong><a href="#">Download Sample</a></strong> (“filename.sit”, 500K)</p>
-->
</td>
</tr>
<tr>
<td scope="row"><img width="680" height="10" src="images/1dot.gif" alt=""><br>
<img height="1" width="680" src="images/1dot_919699.gif" alt=""><br>
<img width="680" height="20" src="images/1dot.gif" alt=""></td>
</tr>
<tr>
<td scope="row">
<!--googleon: index -->
<pre class="sourcecodebox">/* File: Effect.r Description: Effect Resources Author: era Copyright: © Copyright 2002 Apple Computer, Inc. All rights reserved. Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Change History (most recent first): <1> 05/23/02 era first file*//* thng_RezTemplateVersion: 0 - original 'thng' template <-- default 1 - extended 'thng' template <-- used for multiplatform things 2 - extended 'thng' template including resource map id*/#define thng_RezTemplateVersion 1/* cfrg_RezTemplateVersion: 0 - original <-- default 1 - extended <-- we use the extended version*/#define cfrg_RezTemplateVersion 1#if TARGET_REZ_CARBON_MACHO #include <Carbon/Carbon.r> #include <QuickTime/QuickTime.r>#elif TARGET_REZ_CARBON_CFM #include <Carbon.r> #include <QuickTime.r>#else #include "ConditionalMacros.r" #include "MacTypes.r" #include "Components.r" #include "ImageCodec.r" #include "CodeFragments.r"#endif#include "EffectDefinitions.h"// These flags specify information about the capabilities of the component// Works with 1-bit, 2-bit, 4-bit, 8-bit, 16-bit and 32-bit Pixel Maps// It can spool image data and the codec implements get effects parameter list call#define kDecoFlags (codecInfoDoes32 + codecInfoHasEffectParameterList)// These flags specify the possible format of compressed data produced by the component// and the format of compressed files that the component can handle during decompression// The component can decompress from files 32-bit and the data can be stored in lossless format #define kDataFormatFlags (codecInfoDepth32 + codecInfoDoesLossless)// This structure defines the capabilities of the codec.// Component Descriptionresource 'cdci' (kEffect_cdci_ResID, kEffectCodecRezInfo, locked) { kEffectCodecFormatName, // Type kVersionNumber, // Version 0, // Revision level 'appl', // Manufacturer kDecoFlags, // Decompression Flags - depth and etc. supported directly on decompress 0, // Compression Flags - depth and etc. supported directly on compress kDataFormatFlags, // Format Flags - which data formats do we understand 100, // Compression Accuracy - compress accuracy (0-255) (relative to format) 100, // Decomression Accuracy - decompress accuracy (0-255) (relative to format) 100, // Compression Speed - millisecs to compress 320x240 image on base Mac 100, // Decompression Speed - millisecs to compress 320x240 image on base Mac 100, // Compression Level - compression level (0-255) (relative to format) 0, // Reserved 2, // Minimum Height 2, // Minimum Width 0, // Decompression Pipeline Latency 0, // Compression Pipeline Latency 0 // Private Data};// ====================================================================================// The Thing resources// ====================================================================================resource 'thng' (kEffect_thng_ResID, kEffectCodecFormatName, locked) { decompressorComponentType, // Type - always 'imdc' for effects kEffectCodecFormatType, // SubType - your format 'appl', // Manufacturer kDecoFlags, // Component flags 0, // Component flags Mask 0, // - use componentHasMultiplePlatforms 0, 'STR ', // Name Type kEffectNameResID, // Name ID 'STR ', // Info Type kEffectDescriptionResID, // Info ID 0, // Icon Type 0, // Icon ID kEffectVersion, // Version componentHasMultiplePlatforms + // Registration Flags componentDoAutoVersion, 0, // Resource ID of Icon Family {#if TARGET_OS_MAC #if TARGET_REZ_CARBON_CFM #define USE_CUSTOM_CFRG_RESOURCE 0 // Single component in file - Custom 'cfrg' not used kDecoFlags, // Component Flags 'cfrg', // Special Case: data-fork based code fragment 0, /* Code ID usage for CFM components: 0 (kCFragResourceID) - This means the first member in the code fragment; Should only be used when building a single component per file. When doing so using kCFragResourceID simplifies things because a custom 'cfrg' resource is not required n - This value must match the special 'cpnt' qualifier 1 in the custom 'cfrg' resource */ platformPowerPCNativeEntryPoint, // Platform Type (response from gestaltComponentPlatform or failing that, gestaltSysArchitecture) #elif TARGET_REZ_CARBON_MACHO kDecoFlags, 'dlle', // Code Resource type - Entry point found by symbol name 'dlle' resource kEffect_dlle_ResID, // ID of 'dlle' resource platformPowerPCNativeEntryPoint, #elif TARGET_REZ_MAC_PPC kDecoFlags, 'imdc', // Code Type kEffectCodeID, // Code ID platformPowerPC, #elif TARGET_REZ_MAC_68K #error "TARGET_REZ_MAC_68K not supported." #else #error "At least one TARGET_REZ_XXX_XXX platform must be defined." #endif#elif TARGET_OS_WIN32 kDecoFlags, 'dlle', kEffect_dlle_ResID, platformWin32,#else #error "At least one TARGET_OS_XXX platform must be defined."#endif };};#if TARGET_REZ_CARBON_CFM#if USE_CUSTOM_CFRG_RESOURCE// Custom extended code fragment resource// CodeWarrior will correctly adjust the offset and length of each// code fragment when building a MacOS Merge targetresource 'cfrg' (0) { { extendedEntry { kPowerPCCFragArch, // archType kIsCompleteCFrag, // updateLevel kNoVersionNum, // currentVersion kNoVersionNum, // oldDefVersion kDefaultStackSize, // appStackSize kNoAppSubFolder, // appSubFolderID kImportLibraryCFrag, // usage kDataForkCFragLocator, // where kZeroOffset, // offset kCFragGoesToEOF, // length "Dimmer2 Effect", // member name // Start of extended info. 'cpnt', // libKind (not kFragComponentMgrComponent == 'comp' as you might expect) "\0x00\0x82", // qualifier 1 - hex 0x0082 (130) must match Code ID in 'thng' "", // qualifier 2 "", // qualifier 3 "Greyscale Filter QuickTime Effect",// intlName, localised }; };};#endif#endif#if TARGET_REZ_CARBON_MACHO || TARGET_OS_WIN32// Code Entry Point for Mach-O and Windowsresource 'dlle' (kEffect_dlle_ResID) { "GreyscaleFilterComponentDispatch"};#endif// ====================================================================================// Name and description strings// ====================================================================================resource 'STR ' (kEffectNameResID) { "Greyscale Filter"};resource 'STR ' (kEffectDescriptionResID) { "Makes your color (and colour) images grey (and gray)."};resource 'vers' (1) { 0x01, 0x00, release, 0x00, verUS, "1.0", "1.0 ©2002 Apple Computer Inc."};// ====================================================================================// The parameter descriptions// You must change these to reflect the paramaters that your effect takes.// Each effect has a set of standard resources that must be present.// A set of optional resources is required for each parameter your effect has.// ====================================================================================/*The standard information stored in an 'atms' resource is made up of three required atomsand five optional atoms. The three required atoms are: kParameterTitleName A string used as the title of the standard parameters dialog box. kParameterWhatName An OSType containing the name of this effect component. kParameterSourceCountName A long integer containing the maximum number of sources that the effect can take. The five optional atoms are kParameterAlternateCodecName An OSType containing the unique identifier of another effect component that should be used to replace this effect if this effect cannot be used. kParameterInfoLongName A string containing the long version of the name of the effect. kParameterInfoCopyright A string containing a copyright statement for the effect. kParameterInfoDescription A string containing a brief description of what the effect does. kParameterInfoWindowTitle A string containing the title of the window that displays the information contained in the optional atoms. kEffectMajorClassType (added in QuickTime 6) The Major Class for an effect defines the purpose of an effect to allow applications to perform better filtering. It is not intended that the user see effects grouped by major class. Effects that fail to include a kEffectMajorClassType will be classified as Miscellaneous. kEffectMinorClassType (added in QuickTime 6) Like the Major Class, the Minor Class of an effect serves to group the effect into a more refined definition. Unlike the Major Class, however, the Minor Class is intended to be used for grouping for the purposes of User Interface presentation. Effects that fail to include a kEffectMinorClassType will be classified as Miscellaneous.The Parameter Information in an 'atms' ResourceFor each parameter of the effect, your 'atms' resource must contain a set of atoms in the 'atms'resource that describes that parameter. This description includes the name of the parameter, thetype and range of values it can take, and hints on appropriate user interface element for settingthis parameter.A complete description of the information you need to provide for each parameter can be found in"The Parameter Description Format".http://developer.apple.com/techpubs/quicktime/qtdevdocs/REF/refEffects.35.htm For a basic parameter, there are five atoms that you should supply: kParameterAtomTypeAndID Contains the type and ID of the parameter (an OSType and a long integer, respectively), the atom flags for the parameter, and a string containing the name of the parameter. kParameterDataType A long integer containing the type of the parameter, such as kParameterTypeDataFixed. kParameterDataRange A set of typed values describing the range of values the parameter can take. The number and type of values you supply depend on the value of the kParameterDataType atom. kParameterDataBehavior two long integer values containing the behavior type, such as kParameterItemControl for a slider, and any flags, such as kAtomNotInterpolated for a parameter that cannot be tweened. kParameterDataDefaultItem the default value of the parameter. Again, the type of this value will depend on the type of the kParameterDataType atom. This atom must be a correctly-formatted parameter atom that can be passed back to your component by client software without modification.*/resource 'atms' (kEffect_atms_ResID){ // number of root atoms 9 + 5, // 9 Standard Atoms + 5 Parameter Atoms{ // --------------------------------------- // The Standard Resources // These must be present - they describe your effect // --------------------------------------- // The name of the parameters - Required kParameterTitleName, kParameterTitleID, noChildren, { string { "Greyscale Filter Parameters" }; }; // The name (subType) of the effect component - Required kParameterWhatName, kParameterWhatID, noChildren, { kEffectParameterWhatName; }; // The maximum number of sources the effect takes - Required kParameterSourceCountName, kParameterSourceCountID, noChildren, { long { "1" }; }; // Information atoms - Optional kParameterInfoLongName, kParameterInfoIDs, noChildren, { string { "Greyscale Filer Effect" }; }; kParameterInfoCopyright, kParameterInfoIDs, noChildren, { string { "Sample QuickTime Effect by Apple Computer, Inc." }; }; kParameterInfoDescription, kParameterInfoIDs, noChildren, { string { "Makes your color (and colour) images grey (and gray)." }; }; kParameterInfoWindowTitle, kParameterInfoIDs, noChildren, { string { "Greyscale Filter Effect Information" }; }; // QuickTime 6 Effect Classes// With an ever increasing number of effect components, it has become difficult for applications and// users to navigate through the effect list. The effect class atoms can be used for tagging// effects into useful catagories. These atoms do nothing in previous version of QuickTime.#if (UNIVERSAL_INTERFACES_VERSION <= 0x0341) || (UNIVERSAL_INTERFACES_VERSION == 0x0400) // Older interfaces so define this stuff #define kEffectMajorClassType 'clsa' #define kEffectMajorClassID (1) #define kFilterMajorClass OSType { "filt" } // one source effects #define kEffectMinorClassType 'clsi' #define kEffectMinorClassID (1) #define kFilterMinorClass OSType { "filt" } // "Filters"#endif // Major Class of effect - Optional but a good thing to have for QT 6+ kEffectMajorClassType, kEffectMajorClassID, noChildren, { kFilterMajorClass; }; // Minor Class of effect - Option but a good thing to have for QT 6+ kEffectMinorClassType, kEffectMinorClassID, noChildren, { kFilterMinorClass; }; // --------------------------------------- // Optional Resources // There is a standard set of resources // for each parameter your effect takes. // See the QuickTime Documentation for // descriptions of the resources you must // supply for your effect // --------------------------------------- // The general information about the parameter // -------------------- // 'bryt' - the Brightness slider // -------------------- kParameterAtomTypeAndID, 1, noChildren, { kEffectBrightnessControl; // The parameter code long { "1" }; // The parameter ID kAtomNotInterpolated; // Parameter flags string { "Brightness" }; // The parameter name }; // The data type of the parameter kParameterDataType, 1, noChildren, { kParameterTypeDataLong; }; // The range of values the parameter can take kParameterDataRange, 1, noChildren, { long { "-100" }; // Minimum value long { "100" }; // Maximum value long { "1" }; // Scale. This value will scale the value set // by the user into the range -100\xC90\xC9100 long { "1" }; // Precision }; // The parameter's "behavior" kParameterDataBehavior, 1, noChildren, { kParameterItemControl; // Display this item using a control. In the case // of a parameter of data type Fixed, this will result // (in the standard parameters dialog box) in a slider // being displayed which the user can use to set the // value of the parameter. long { "0" }; // Flags }; // The default value for the parameter. // In this case this is a tween record kParameterDataDefaultItem, 1, noChildren, { long { "0" }; };};};</pre>
<!--googleoff: index -->
</td>
</tr>
</table>
<!-- END WIDE COLUMN -->
<!-- END MAIN CONTENT -->
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div style="width: 100%; height: 1px; background-color: #919699; margin-top: 5px; margin-bottom: 15px"></div></td>
</tr>
<tr>
<td align="center"><br/>
<table border="0" cellpadding="0" cellspacing="0" class="graybox">
<tr>
<th>Did this document help you?</th>
</tr>
<tr>
<td>
<div style="margin-bottom: 8px"><a href="http://developer.apple.com/feedback/?v=1&url=/samplecode/GreyscaleEffectSample/listing7.html%3Fid%3DDTS10000828-1.0&media=dvd" target=_new>Yes</a>: Tell us what works for you.</div>
<div style="margin-bottom: 8px"><a href="http://developer.apple.com/feedback/?v=2&url=/samplecode/GreyscaleEffectSample/listing7.html%3Fid%3DDTS10000828-1.0&media=dvd" target=_new>It’s good, but:</a> Report typos, inaccuracies, and so forth.</div>
<div><a href="http://developer.apple.com/feedback/?v=3&url=/samplecode/GreyscaleEffectSample/listing7.html%3Fid%3DDTS10000828-1.0&media=dvd" target=_new>It wasn’t helpful</a>: Tell us what would have helped.</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- START BOTTOM APPLE NAVIGATION -->
<!--#include virtual="/includes/footer"-->
<!-- END BOTTOM APPLE NAVIGATION -->
<!-- START CENTER CLOSE -->
</center>
<!-- END CENTER CLOSE -->
</body>
</html>