当前位置: 首页>>代码示例>>C++>>正文


C++ NewHandle函数代码示例

本文整理汇总了C++中NewHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ NewHandle函数的具体用法?C++ NewHandle怎么用?C++ NewHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DWStruct

dw_handle DWENTRY DWStruct(
    dw_client                   cli,
    uint                        kind )
{
    dw_handle                   new_hdl;

    new_hdl = NewHandle( cli );
    CreateExtra( cli, new_hdl )->structure.kind = kind;
    return( new_hdl );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:10,代码来源:dwtype.c

示例2: InitReqList

static void InitReqList (int first, int last, ReqListRec ***reqlistptr)
{
    register i;

    (*reqlistptr) = (ReqListRec**)
                    (NewHandle (sizeof(ReqListRec) + (last-first)*sizeof(short)));
    (**reqlistptr)->reqLSize = last-first;
    for (i=first; i<=last; i++)
        (**reqlistptr)->reqLData[i-first] = i;
}
开发者ID:thickforest,项目名称:SLS-1.02,代码行数:10,代码来源:srgp_color_MAC.c

示例3: DWHandle

dw_handle DWENTRY DWHandle(
    dw_client                   cli,
    uint                        kind )
{
    dw_handle                   new_hdl;

    kind = kind;
    new_hdl = NewHandle( cli );
    return( new_hdl );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:10,代码来源:dwtype.c

示例4: CompressPixMapRLE

// CompressRLE
//		Main compress routine, this function will call the appropriate RLE compression
// method depending on the pixel depth of the source image.
OSErr CompressPixMapRLE(PixMapHandle pixMapHdl, Ptr compressBuffer, Size *compressBufferSizePtr)
{
	Handle hdl = NULL;
	Ptr	   tempPtr = NULL,srcData;
	Ptr	   pixBaseAddr = GetPixBaseAddr(pixMapHdl);
	OSType pixelFormat = GETPIXMAPPIXELFORMAT(*pixMapHdl);
	int		depth = QTGetPixelSize(pixelFormat);
	long   rowBytes = QTGetPixMapHandleRowBytes(pixMapHdl);
	int		width = (**pixMapHdl).bounds.right - (**pixMapHdl).bounds.left;
	int		i, height = (**pixMapHdl).bounds.bottom - (**pixMapHdl).bounds.top;
	Size   widthByteSize = (depth * (long)width + 7) >> 3;
	OSErr  err = noErr;

	// need to remove padding between rows?
	if(widthByteSize != rowBytes){
		// Make a temp buffer for the source
		hdl = NewHandle(height * widthByteSize);
		err = MemError();
		if (err) goto bail;
		
		HLock(hdl);
		
		srcData = tempPtr = *hdl;
		
		// Get rid of row bytes padding
		for (i = 0; i < height; i++) {
			BlockMoveData(pixBaseAddr, tempPtr, widthByteSize);
			tempPtr += widthByteSize;
			pixBaseAddr += rowBytes;
		}
	}else
		srcData = pixBaseAddr;

	// Compress
	switch (depth) {
	case 1:
		CompressRLE8((UInt8*)srcData, height * widthByteSize, compressBuffer, compressBufferSizePtr);
		break;
	case 8:
		CompressRLE8((UInt8*)srcData, height * widthByteSize, compressBuffer, compressBufferSizePtr);
		break;
	case 16:
		CompressRLE16((UInt16*)srcData, height * (widthByteSize >> 1), compressBuffer, compressBufferSizePtr);
		break;
	case 32:
		CompressRLE32((UInt32*)srcData, height * (widthByteSize >> 2), compressBuffer, compressBufferSizePtr);
		break;
	}
	
bail:
	if (hdl)
		DisposeHandle(hdl);

	return err;
}
开发者ID:JanX2,项目名称:Quicktime-Component-for-Electric-Image-Format,代码行数:58,代码来源:EI_RLE.c

示例5: HapQTCreateCVPixelBufferOptionsDictionary

	void MovieGlHap::allocateVisualContext()
	{
		// Load HAP Movie
		if( HapQTQuickTimeMovieHasHapTrackPlayable( getObj()->mMovie ) )
		{
			// QT Visual Context attributes
			OSStatus err = noErr;
			QTVisualContextRef * visualContext = (QTVisualContextRef*)&getObj()->mVisualContext;
			CFDictionaryRef pixelBufferOptions = HapQTCreateCVPixelBufferOptionsDictionary();
			
			const CFStringRef keys[] = { kQTVisualContextPixelBufferAttributesKey };
			CFDictionaryRef visualContextOptions = ::CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys, (const void**)&pixelBufferOptions, sizeof(keys)/sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
			err = QTPixelBufferContextCreate( kCFAllocatorDefault, visualContextOptions, visualContext );
			
			::CFRelease( pixelBufferOptions );
			::CFRelease( visualContextOptions );
			
			if( err != noErr ) {
				CI_LOG_E( "HAP ERROR :: " << err << " couldnt create visual context." );
				return;
			}
			// Set the movie's visual context
			err = SetMovieVisualContext( getObj()->mMovie, *visualContext );
			if( err != noErr ) {
				CI_LOG_E( "HAP ERROR :: " << err << " SetMovieVisualContext." );
				return;
			}
		}
		
		// Get codec name
		for (long i = 1; i <= GetMovieTrackCount(getObj()->mMovie); i++) {
            Track track = GetMovieIndTrack(getObj()->mMovie, i);
            Media media = GetTrackMedia(track);
            OSType mediaType;
            GetMediaHandlerDescription(media, &mediaType, NULL, NULL);
            if (mediaType == VideoMediaType)
            {
                // Get the codec-type of this track
                ImageDescriptionHandle imageDescription = (ImageDescriptionHandle)NewHandle(0); // GetMediaSampleDescription will resize it
                GetMediaSampleDescription(media, 1, (SampleDescriptionHandle)imageDescription);
                OSType codecType = (*imageDescription)->cType;
                DisposeHandle((Handle)imageDescription);
                
                switch (codecType) {
                    case 'Hap1': mCodec = Codec::HAP; break;
                    case 'Hap5': mCodec = Codec::HAP_A; break;
                    case 'HapY': mCodec = Codec::HAP_Q; break;
                    default: mCodec = Codec::UNSUPPORTED; break;
				}
            }
        }

		// Set framerate callback
		this->setNewFrameCallback( updateMovieFPS, (void*)this );
	}
开发者ID:brucelane,项目名称:Cinder-Hap2,代码行数:55,代码来源:MovieHap.cpp

示例6: srVerNo

static int srVerNo(void* p_void)
{
	char cVersionStr[200];
    srUtiVerNo(cVersionStr);

	long LenVersionStr = strlen(cVersionStr);
    Handle VersionStr = NewHandle(LenVersionStr);
	strncpy(*VersionStr, cVersionStr, LenVersionStr);
	((srTIgorVersionStruct*)p_void)->result = VersionStr;
	return 0;
}
开发者ID:ebknudsen,项目名称:SRW,代码行数:11,代码来源:srigintr.cpp

示例7: ThrowIf_

/*============================================
	SUMiscUtils::DuplicateHandle
==============================================*/
Handle SUMiscUtils::DuplicateHandle( Handle source )
{
	ThrowIf_ ( !source || !*source );
	
	SInt32 numBytes = GetHandleSize( source );
	Handle result = NewHandle( numBytes );
	ThrowIfMemFail_( result );
	
	BlockMoveData( *source, *result, numBytes );
	return( result );
}
开发者ID:MaddTheSane,项目名称:tntbasic,代码行数:14,代码来源:SUMiscUtils.cpp

示例8: WritePos

//_______________________________________________________________________________
void WritePos (WindowPtr win, short	resFile)
{
	Handle h = NewHandle (sizeof(Point));
	if (h) {
		Point *p = (Point *)*h;
  		SetPort(win);
		p->h = win->portRect.left;
		p->v = win->portRect.top;
		LocalToGlobal(p);
		WriteRsrc (h, kWinPosRsrc, kWinposID, resFile);
	}
}
开发者ID:AntonLanghoff,项目名称:whitecatlib,代码行数:13,代码来源:msRsrc.c

示例9: write_setting_filename

void write_setting_filename(void *handle, const char *key, Filename fn)
{
    int fd = *(int *)handle;
    AliasHandle h;
    int id;
    OSErr error;
    Str255 pkey;

    UseResFile(fd);
    if (ResError() != noErr)
        fatalbox("Failed to open saved session (%d)", ResError());

    if (filename_is_null(fn)) {
	/* Generate a special "null" alias */
	h = (AliasHandle)NewHandle(sizeof(**h));
	if (h == NULL)
	    fatalbox("Failed to create fake alias");
	(*h)->userType = 'pTTY';
	(*h)->aliasSize = sizeof(**h);
    } else {
	error = NewAlias(NULL, &fn.fss, &h);
	if (error == fnfErr) {
	    /*
	     * NewAlias can't create an alias for a nonexistent file.
	     * Create an alias for the directory, and record the
	     * filename as well.
	     */
	    FSSpec tmpfss;

	    FSMakeFSSpec(fn.fss.vRefNum, fn.fss.parID, NULL, &tmpfss);
	    error = NewAlias(NULL, &tmpfss, &h);
	    if (error != noErr)
		fatalbox("Failed to create alias");
	    (*h)->userType = 'pTTY';
	    SetHandleSize((Handle)h, (*h)->aliasSize + fn.fss.name[0] + 1);
	    if (MemError() != noErr)
		fatalbox("Failed to create alias");
	    memcpy((char *)*h + (*h)->aliasSize, fn.fss.name,
		   fn.fss.name[0] + 1);
	}
	if (error != noErr)
	    fatalbox("Failed to create alias");
    }
    /* Put the data in a resource. */
    id = Unique1ID(rAliasType);
    if (ResError() != noErr)
	fatalbox("Failed to get ID for resource %s (%d)", key, ResError());
    c2pstrcpy(pkey, key);
    AddResource((Handle)h, rAliasType, id, pkey);
    if (ResError() != noErr)
	fatalbox("Failed to add resource %s (%d)", key, ResError());
}
开发者ID:sdottaka,项目名称:cvsnt-sjis,代码行数:52,代码来源:macstore.c

示例10: QT_Process_Audio_Track

static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
{
    AM_MEDIA_TYPE amt;
    WAVEFORMATEX* pvi;
    PIN_INFO piOutput;
    HRESULT hr = S_OK;
    static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0};
    Media audioMedia;

    SoundDescriptionHandle  aDesc = (SoundDescriptionHandle) NewHandle(sizeof(SoundDescription));

    audioMedia = GetTrackMedia(trk);
    GetMediaSampleDescription(audioMedia, 1, (SampleDescriptionHandle)aDesc);

    ZeroMemory(&amt, sizeof(amt));
    amt.formattype = FORMAT_WaveFormatEx;
    amt.majortype = MEDIATYPE_Audio;
    amt.subtype = MEDIASUBTYPE_PCM;
    amt.bTemporalCompression = 0;

    amt.cbFormat = sizeof(WAVEFORMATEX);
    amt.pbFormat = CoTaskMemAlloc(amt.cbFormat);
    ZeroMemory(amt.pbFormat, amt.cbFormat);
    pvi = (WAVEFORMATEX*)amt.pbFormat;

    pvi->cbSize = sizeof(WAVEFORMATEX);
    pvi->wFormatTag = WAVE_FORMAT_PCM;
    pvi->nChannels = ((SoundDescription)**aDesc).numChannels;
    if (pvi->nChannels < 1 || pvi->nChannels > 2)
        pvi->nChannels = 2;
    pvi->nSamplesPerSec = (((SoundDescription)**aDesc).sampleRate/65536);
    if (pvi->nSamplesPerSec < 8000 || pvi->nChannels > 48000)
        pvi->nSamplesPerSec = 44100;
    pvi->wBitsPerSample = ((SoundDescription)**aDesc).sampleSize;
    if (pvi->wBitsPerSample < 8 || pvi->wBitsPerSample > 32)
        pvi->wBitsPerSample = 16;
    pvi->nBlockAlign = (pvi->nChannels * pvi->wBitsPerSample) / 8;
    pvi->nAvgBytesPerSec = pvi->nSamplesPerSec * pvi->nBlockAlign;

    DisposeHandle((Handle)aDesc);

    piOutput.dir = PINDIR_OUTPUT;
    piOutput.pFilter = &filter->filter.IBaseFilter_iface;
    lstrcpyW(piOutput.achName,szwAudioOut);

    hr = QT_AddPin(filter, &piOutput, &amt, FALSE);
    if (FAILED(hr))
        ERR("Failed to add Audio Track\n");
    else
        TRACE("Audio Pin %p\n",filter->pAudio_Pin);
    return hr;
}
开发者ID:Kelimion,项目名称:wine,代码行数:52,代码来源:qtsplitter.c

示例11: QT_GetCodecSettingsFromScene

static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
{	
	Handle           myHandle = NULL;
	ComponentResult  myErr = noErr;

	QuicktimeCodecData *qcd = rd->qtcodecdata;

	/* if there is codecdata in the blendfile, convert it to a Quicktime handle */
	if (qcd) {
		myHandle = NewHandle(qcd->cdSize);
		PtrToHand(qcd->cdParms, &myHandle, qcd->cdSize);
	}
		
	/* restore codecsettings to the quicktime component */
	if (qcd->cdParms && qcd->cdSize) {
		myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
		if (myErr != noErr) {
			BKE_report(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed");
			goto bail;
		}

		/* update runtime codecsettings for use with the codec dialog */
		SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
		SCGetInfo(qtdata->theComponent, scSpatialSettingsType,  &qtdata->gSpatialSettings);
		SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);


		/* Fill the render QuicktimeCodecSettigns struct */
		rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
		/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
		rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
		
		rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
		rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
		rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
		rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
		
		rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
		rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
		rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
		/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
		
	}
	else {
		BKE_report(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed");
	}
bail:
	if (myHandle != NULL)
		DisposeHandle(myHandle);
		
	return((OSErr)myErr);
}
开发者ID:244xiao,项目名称:blender,代码行数:52,代码来源:quicktime_export.c

示例12: InitMacColorTable

static void InitMacColorTable (int first, int last, CTabHandle *ctabptr)
{
    register i;
    CTabHandle ctab;

    *ctabptr = ctab = (CTabHandle)
                      NewHandle (sizeof(ColorTable) + (last-first)*sizeof(ColorSpec));
    (*ctab)->ctSize = last-first;
    (*ctab)->ctSeed = GetCTSeed();
    (*ctab)->ctFlags = (short) (((unsigned short)(-1))<<15);
    for (i=first; i<=last; i++)
        (*ctab)->ctTable[i-first].value = i;
}
开发者ID:thickforest,项目名称:SLS-1.02,代码行数:13,代码来源:srgp_color_MAC.c

示例13: handle_from_c_string

static Handle
handle_from_c_string (char *str)
{
  int len;
  Handle retval;

  len = strlen (str);
  retval = NewHandle (len);

  BlockMove (str, *retval, len);

  return retval;
}
开发者ID:LarBob,项目名称:executor,代码行数:13,代码来源:munger_test.c

示例14: NewHandle

void	CAComponent::SetCompInfo () const
{
	if (!mCompInfo) {
		Handle h1 = NewHandle(4);
		CAComponentDescription desc;
		OSStatus err = GetComponentInfo (Comp(), &desc, 0, h1, 0);
		if (err) return;
		HLock (h1);
		const_cast<CAComponent*>(this)->mCompInfo = CFStringCreateWithPascalString(NULL, (const unsigned char*)*h1, kCFStringEncodingMacRoman);

		DisposeHandle (h1);
	}
}
开发者ID:DanielAeolusLaude,项目名称:ardour,代码行数:13,代码来源:CAComponent.cpp

示例15: allocBufferHandle

/*---------------------------------------------------------------------
 * FUNCTION NAME
 * allocBufferHandle (Macintosh Version)
 *
 * DESCRIPTION
 * This function allocates a buffer and returns a handle to it.  The
 * DOS implementation fakes all this out, of course.
 *
 * AUTHOR
 * Peter Tracy
 *
 * DATE CREATED
 * May 24, 1991
 *
---------------------------------------------------------------------*/
KpHandle_t allocBufferHandle (KpInt32_t numBytes)
{
Size	blockSize;             /* size of memory to allocate */
Handle	hBuffer;               /* handle to allocated buffer */
OSErr	err;

	blockSize = (Size) numBytes;
	hBuffer = NewHandle (blockSize);

	err = MemError();
	if ((err != noErr) && (err != memFullErr)) {
		DEBUGTRAP("\p allocBufferHandle NewHandle")
		hBuffer = NULL;
	}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:29,代码来源:memory.c


注:本文中的NewHandle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。