~vorlon/ubuntu/oneiric/lcms/multiarch

« back to all changes in this revision

Viewing changes to src/cmsvirt.c

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2008-07-24 14:29:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080724142936-9fgs00bge01jgdl5
Tags: 1.17.dfsg-1
Removed Adobe sRGB profiles from the testdbed and python/testbed
directories (Closes: #491995).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
//  Little cms
3
 
//  Copyright (C) 1998-2006 Marti Maria
 
3
//  Copyright (C) 1998-2007 Marti Maria
4
4
//
5
5
// Permission is hereby granted, free of charge, to any person obtaining 
6
6
// a copy of this software and associated documentation files (the "Software"), 
291
291
    cmsHPROFILE hICC;
292
292
    _LPcmsTRANSFORM v = (_LPcmsTRANSFORM) hTransform;
293
293
    LPLUT Lut;
294
 
    BOOL MustFreeLUT;
 
294
    LCMSBOOL MustFreeLUT;
295
295
    LPcmsNAMEDCOLORLIST InputColorant = NULL;
296
296
    LPcmsNAMEDCOLORLIST OutputColorant = NULL;
297
297
    
343
343
    cmsAddTag(hICC, icSigMediaWhitePointTag,  (LPVOID) cmsD50_XYZ());
344
344
    
345
345
    if (cmsGetDeviceClass(hICC) == icSigOutputClass) {
346
 
        
347
 
        
 
346
                
348
347
        cmsAddTag(hICC, icSigBToA0Tag, (LPVOID) Lut);
349
348
    }
350
 
    
351
349
    else
352
350
        cmsAddTag(hICC, icSigAToB0Tag, (LPVOID) Lut);
353
351
    
417
415
     
418
416
       // Creates a LUT with prelinearization step only
419
417
       Lut = cmsAllocLUT();
 
418
       if (Lut == NULL) return NULL;
420
419
 
421
420
       // Set up channels
422
421
       Lut ->InputChan = Lut ->OutputChan = _cmsChannelsOf(ColorSpace);
519
518
      
520
519
       // Creates a LUT with 3D grid only
521
520
       Lut = cmsAllocLUT();
 
521
       if (Lut == NULL) {
 
522
           cmsCloseProfile(hICC);
 
523
           return NULL;
 
524
           }
522
525
 
523
526
 
524
527
       cmsAlloc3DGrid(Lut, 17, _cmsChannelsOf(ColorSpace), 
555
558
LPLUT Create3x3EmptyLUT(void)
556
559
{
557
560
        LPLUT AToB0 = cmsAllocLUT();
 
561
        if (AToB0 == NULL) return NULL;
 
562
 
558
563
        AToB0 -> InputChan = AToB0 -> OutputChan = 3;
559
 
 
560
564
        return AToB0;
561
565
}
562
566
 
568
572
        cmsHPROFILE hProfile;        
569
573
        LPLUT Lut;
570
574
 
571
 
 
572
575
        hProfile = cmsCreateRGBProfile(WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL);
 
576
        if (hProfile == NULL) return NULL;
573
577
 
574
578
        cmsSetDeviceClass(hProfile, icSigAbstractClass);
575
579
        cmsSetColorSpace(hProfile,  icSigLabData);
582
586
 
583
587
       // An empty LUTs is all we need
584
588
       Lut = Create3x3EmptyLUT();
585
 
       if (Lut == NULL) return NULL;
 
589
       if (Lut == NULL) {
 
590
           cmsCloseProfile(hProfile);
 
591
           return NULL;
 
592
           }
586
593
 
587
594
       cmsAddTag(hProfile, icSigAToB0Tag,    (LPVOID) Lut);
588
595
       cmsAddTag(hProfile, icSigBToA0Tag,    (LPVOID) Lut);
599
606
        cmsHPROFILE hProfile;        
600
607
        LPLUT Lut;
601
608
 
602
 
 
603
609
        hProfile = cmsCreateRGBProfile(WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL);
 
610
        if (hProfile == NULL) return NULL;
604
611
 
605
612
        cmsSetProfileICCversion(hProfile, 0x4000000);
606
613
 
615
622
 
616
623
       // An empty LUTs is all we need
617
624
       Lut = Create3x3EmptyLUT();
618
 
       if (Lut == NULL) return NULL;
 
625
       if (Lut == NULL) {
 
626
           cmsCloseProfile(hProfile);
 
627
           return NULL;
 
628
           }
619
629
 
620
630
       Lut -> wFlags |= LUT_V4_INPUT_EMULATE_V2;
621
631
       cmsAddTag(hProfile, icSigAToB0Tag,    (LPVOID) Lut);
637
647
        LPLUT Lut;
638
648
 
639
649
        hProfile = cmsCreateRGBProfile(cmsD50_xyY(), NULL, NULL);
 
650
        if (hProfile == NULL) return NULL;
640
651
 
641
652
        cmsSetDeviceClass(hProfile, icSigAbstractClass);
642
653
        cmsSetColorSpace(hProfile, icSigXYZData);
648
659
 
649
660
       // An empty LUTs is all we need
650
661
       Lut = Create3x3EmptyLUT();
651
 
       if (Lut == NULL) return NULL;
 
662
       if (Lut == NULL) {
 
663
           cmsCloseProfile(hProfile);
 
664
           return NULL;
 
665
           }
652
666
 
653
667
       cmsAddTag(hProfile, icSigAToB0Tag,    (LPVOID) Lut);
654
668
       cmsAddTag(hProfile, icSigBToA0Tag,    (LPVOID) Lut);
655
669
       cmsAddTag(hProfile, icSigPreview0Tag, (LPVOID) Lut);
656
670
 
657
 
       cmsFreeLUT(Lut);
658
 
 
659
 
    
 
671
       cmsFreeLUT(Lut);    
660
672
       return hProfile;
661
673
}
662
674
 
694
706
    return cmsBuildParametricGamma(1024, 4, Parameters);
695
707
}
696
708
 
 
709
// Create the ICC virtual profile for sRGB space 
697
710
cmsHPROFILE LCMSEXPORT cmsCreate_sRGBProfile(void)
698
711
{
699
712
       cmsCIExyY       D65;
710
723
           
711
724
       hsRGB = cmsCreateRGBProfile(&D65, &Rec709Primaries, Gamma22);
712
725
       cmsFreeGamma(Gamma22[0]);
 
726
       if (hsRGB == NULL) return NULL;
713
727
 
714
728
      
715
729
       cmsAddTag(hsRGB, icSigDeviceMfgDescTag,      (LPVOID) "(lcms internal)");
721
735
 
722
736
 
723
737
 
724
 
 
725
738
typedef struct {
726
739
                double Brightness;
727
740
                double Contrast;
764
777
 
765
778
    cmsFloat2LabEncoded(Out, &LabOut);
766
779
    
767
 
 
768
780
    return TRUE;
769
781
}
770
782
 
810
822
      
811
823
       // Creates a LUT with 3D grid only
812
824
       Lut = cmsAllocLUT();
813
 
 
 
825
       if (Lut == NULL) {
 
826
           cmsCloseProfile(hICC);
 
827
           return NULL;
 
828
           }
814
829
 
815
830
       cmsAlloc3DGrid(Lut, nLUTPoints, 3, 3);
816
831
 
861
876
 
862
877
       // An empty LUTs is all we need
863
878
       Lut = cmsAllocLUT();
864
 
       if (Lut == NULL) return NULL;
 
879
       if (Lut == NULL) {
 
880
           cmsCloseProfile(hProfile);
 
881
           return NULL;
 
882
           }
865
883
 
866
884
       Lut -> InputChan = 3;
867
885
       Lut -> OutputChan = 1;