~ubuntu-branches/ubuntu/karmic/photoprint/karmic

« back to all changes in this revision

Viewing changes to imagesource/pixbuf_from_imagesource.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Milan Zamazal
  • Date: 2007-05-01 16:32:13 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20070501163213-k0gaendx7grjlmk5
Tags: upstream-0.3.5
ImportĀ upstreamĀ versionĀ 0.3.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
using namespace std;
16
16
 
17
 
GdkPixbuf *pixbuf_from_imagesource(ImageSource *is)
 
17
GdkPixbuf *pixbuf_from_imagesource(ImageSource *is,int redbg8,int greenbg8,int bluebg8)
18
18
{
19
19
        if(!is)
20
20
                return(NULL);
49
49
                                        for(int x=0;x<is->width;++x)
50
50
                                        {
51
51
                                                int a=255-ISTOEIGHT(src[x*4+3]);
52
 
                                                pixels[x*3]=(ISTOEIGHT(src[x*4])*a+255*(255-a))/255;
53
 
                                                pixels[x*3+1]=(ISTOEIGHT(src[x*4+1])*a+255*(255-a))/255;
54
 
                                                pixels[x*3+2]=(ISTOEIGHT(src[x*4+2])*a+255*(255-a))/255;
 
52
                                                pixels[x*3]=(ISTOEIGHT(src[x*4])*a+redbg8*(255-a))/255;
 
53
                                                pixels[x*3+1]=(ISTOEIGHT(src[x*4+1])*a+greenbg8*(255-a))/255;
 
54
                                                pixels[x*3+2]=(ISTOEIGHT(src[x*4+2])*a+bluebg8*(255-a))/255;
55
55
                                        }               
56
56
                                        pixels+=rowstride;      
57
57
                                }
63
63
                                        for(int x=0;x<is->width;++x)
64
64
                                        {
65
65
                                                int a=255-ISTOEIGHT(src[x*2+3]);
66
 
                                                pixels[x*3]=(ISTOEIGHT(src[x*2])*a+255*(255-a))/255;
67
 
                                                pixels[x*3+1]=(ISTOEIGHT(src[x*2])*a+255*(255-a))/255;
68
 
                                                pixels[x*3+2]=(ISTOEIGHT(src[x*2])*a+255*(255-a))/255;
 
66
                                                pixels[x*3]=(ISTOEIGHT(IS_SAMPLEMAX-src[x*2])*a+redbg8*(255-a))/255;
 
67
                                                pixels[x*3+1]=(ISTOEIGHT(IS_SAMPLEMAX-src[x*2])*a+greenbg8*(255-a))/255;
 
68
                                                pixels[x*3+2]=(ISTOEIGHT(IS_SAMPLEMAX-src[x*2])*a+bluebg8*(255-a))/255;
69
69
                                        }               
70
70
                                        pixels+=rowstride;      
71
71
                                }
110
110
                                        ISDataType *src=is->GetRow(y);
111
111
                                        for(int x=0;x<is->width*is->samplesperpixel;++x)
112
112
                                        {
113
 
                                                pixels[x*3]=ISTOEIGHT(src[x]);
114
 
                                                pixels[x*3+1]=ISTOEIGHT(src[x]);
115
 
                                                pixels[x*3+2]=ISTOEIGHT(src[x]);
 
113
                                                pixels[x*3]=ISTOEIGHT(IS_SAMPLEMAX-src[x]);
 
114
                                                pixels[x*3+1]=ISTOEIGHT(IS_SAMPLEMAX-src[x]);
 
115
                                                pixels[x*3+2]=ISTOEIGHT(IS_SAMPLEMAX-src[x]);
116
116
                                        }               
117
117
                                        pixels+=rowstride;      
118
118
                                }