]> granicus.if.org Git - imagemagick/blobdiff - coders/clipboard.c
(no commit message)
[imagemagick] / coders / clipboard.c
index 3fcd52de51b067609cfdab88217f99e7e154fa89..40bfbbfa66980a372d1f595536facef4bc4e6458 100644 (file)
@@ -3,6 +3,11 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%        CCCC  L      IIIII  PPPP   BBBB    OOO    AAA   RRRR   DDDD          %
+%       C      L        I    P   P  B   B  O   O  A   A  R   R  D   D         %
+%       C      L        I    PPP    BBBB   O   O  AAAAA  RRRR   D   D         %
+%       C      L        I    P      B   B  O   O  A   A  R R    D   D         %
+%        CCCC  LLLLL  IIIII  P      BBBB    OOO   A   A  R  R   DDDD          %
 %                                                                             %
 %                                                                             %
 %                        Read/Write Windows Clipboard.                        %
@@ -12,7 +17,7 @@
 %                                 May 2002                                    %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -101,15 +106,15 @@ static Image *ReadCLIPBOARDImage(const ImageInfo *image_info,
   Image
     *image;
 
-  long
-    y;
-
-  register long
+  register ssize_t
     x;
 
   register PixelPacket
     *q;
 
+  ssize_t
+    y;
+
   assert(image_info != (const ImageInfo *) NULL);
   assert(image_info->signature == MagickSignature);
   if (image_info->debug != MagickFalse)
@@ -164,8 +169,8 @@ static Image *ReadCLIPBOARDImage(const ImageInfo *image_info,
       */
       (void) ResetMagickMemory(&DIBinfo,0,sizeof(BITMAPINFO));
       DIBinfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
-      DIBinfo.bmiHeader.biWidth=image->columns;
-      DIBinfo.bmiHeader.biHeight=(-1)*image->rows;
+      DIBinfo.bmiHeader.biWidth=(LONG) image->columns;
+      DIBinfo.bmiHeader.biHeight=(-1)*(LONG) image->rows;
       DIBinfo.bmiHeader.biPlanes=1;
       DIBinfo.bmiHeader.biBitCount=32;
       DIBinfo.bmiHeader.biCompression=BI_RGB;
@@ -198,20 +203,20 @@ static Image *ReadCLIPBOARDImage(const ImageInfo *image_info,
         RealizePalette(hDC);
       }
       /* bitblt from the memory to the DIB-based one */
-      BitBlt(hDC,0,0,image->columns,image->rows,hMemDC,0,0,SRCCOPY);
+      BitBlt(hDC,0,0,(int) image->columns,(int) image->rows,hMemDC,0,0,SRCCOPY);
       /* finally copy the pixels! */
       pBits=ppBits;
-      for (y=0; y < (long) image->rows; y++)
+      for (y=0; y < (ssize_t) image->rows; y++)
       {
         q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
         if (q == (PixelPacket *) NULL)
           break;
-        for (x=0; x < (long) image->columns; x++)
+        for (x=0; x < (ssize_t) image->columns; x++)
         {
-          q->red=ScaleCharToQuantum(pBits->rgbRed);
-          q->green=ScaleCharToQuantum(pBits->rgbGreen);
-          q->blue=ScaleCharToQuantum(pBits->rgbBlue);
-          q->opacity=OpaqueOpacity;
+          SetRedPixelComponent(q,ScaleCharToQuantum(pBits->rgbRed));
+          SetGreenPixelComponent(q,ScaleCharToQuantum(pBits->rgbGreen));
+          SetBluePixelComponent(q,ScaleCharToQuantum(pBits->rgbBlue));
+          SetOpacityPixelComponent(q,OpaqueOpacity);
           pBits++;
           q++;
         }
@@ -247,10 +252,10 @@ static Image *ReadCLIPBOARDImage(const ImageInfo *image_info,
 %
 %  The format of the RegisterCLIPBOARDImage method is:
 %
-%      unsigned long RegisterCLIPBOARDImage(void)
+%      size_t RegisterCLIPBOARDImage(void)
 %
 */
-ModuleExport unsigned long RegisterCLIPBOARDImage(void)
+ModuleExport size_t RegisterCLIPBOARDImage(void)
 {
   MagickInfo
     *entry;
@@ -261,7 +266,7 @@ ModuleExport unsigned long RegisterCLIPBOARDImage(void)
   entry->encoder=(EncodeImageHandler *) WriteCLIPBOARDImage;
 #endif
   entry->adjoin=MagickFalse;
-  entry->format_type=ExplicitFormatType;
+  entry->format_type=ImplicitFormatType;
   entry->description=ConstantString("The system clipboard");
   entry->module=ConstantString("CLIPBOARD");
   (void) RegisterMagickInfo(entry);
@@ -334,7 +339,7 @@ static MagickBooleanType WriteCLIPBOARDImage(const ImageInfo *image_info,
     HBITMAP
       bitmapH;
 
-    OpenClipboard( NULL );
+    OpenClipboard(NULL);
     EmptyClipboard();
     bitmapH=(HBITMAP) ImageToHBITMAP(image);
     SetClipboardData(CF_BITMAP,bitmapH);