문제

사용하는 기존 코드가 있습니다 CMNewProfileSearch 그런 다음 시스템의 색상 프로파일을 반복하여 이름과 전체 경로를 얻습니다. 안타깝게도, CMNewProfileSearch Mac OS X 10.5에서는 더 이상 사용되지 않으며 64 비트 응용 프로그램을 컴파일 할 때도 사용할 수 없습니다.

Colorsync Manager 2.5 참조를 읽을 때, 초과 설치된 색상 프로파일을 반복하는 새로운 방법은 다음과 같습니다. CMIterateColorSyncFolder 기능.

  1. 그게 사실인가요?
  2. 내가 원하는 대신 코코아 방법이 있습니까?
  3. 샘플 코드가있는 사람이 있습니까?

감사.

도움이 되었습니까?

해결책

  1. 예. 당신이 지적했듯이, Colorsync 관리자 참조 다음을 말합니다.

    CMNewProfilesearch 함수는 Colorsync 버전 2.5로 시작하는 최적화 된 프로파일 검색을 최적화하지 않습니다. 대신 cmiteratecolorsyncfolder를 사용하십시오.

  2. CMIterateColorSyncFolder 입니다 공식적인 이것을하는 방법. 게다가, 그것은 또한입니다 최적화 방법.

  3. 에서 Apple의 ImageApp 샘플 코드:

편집 : 제거 할 코드 샘플을 수정했습니다 NewCMProfileIterateUPP 그리고 DisposeCMProfileIterateUPP.


    // Callback routine with a description of a profile that is 
    // called during an iteration through the available profiles.
    //
    static OSErr profileIterate (CMProfileIterateData *info, void *refCon)
    {
        NSMutableArray* array = (NSMutableArray*) refCon;

        Profile* prof = [Profile profileWithIterateData:info];
        if (prof)
            [array addObject:prof];

        return noErr;
    }

    // return an array of all profiles
    //
    + (NSArray*) arrayOfAllProfiles
    {
        NSMutableArray* profs=[[NSMutableArray arrayWithCapacity:0] retain];
        CMIterateColorSyncFolder(profileIterate, NULL, 0L, profs);
        return (NSArray*)profs;
    }

필요하지 않은 것으로 밝혀졌습니다 NewCMProfileIterateUPP 그리고 DisposeCMProfileIterateUPP 그래서 그들은 내가 말할 수있는 한 아무것도 교체되지 않았습니다. 대신 일치하는 서명으로 콜백 함수를 정의 할 수 있습니다. profileIterate, 위에. 그런 다음 콜백 함수를 직접 전달할 수 있습니다. CMIterateColorSyncFolder.

변경 사항을 테스트했습니다 ImageApp Mac OS X 10.5에서는 예상대로 작동합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top