summaryrefslogtreecommitdiff
path: root/gif
diff options
context:
space:
mode:
authorAaron M. Ucko <ucko@debian.org>2005-03-23 17:39:07 +0000
committerAaron M. Ucko <ucko@debian.org>2005-03-23 17:39:07 +0000
commita7c5bff619aa4850d09825888b5f46c7cd086f11 (patch)
tree2ab2dd2ff2977a5e0bcfdd90a17ca4f1a73181fc /gif
parentbfbecafe8b6142e8356e8447f0822b43e94b64b7 (diff)
Load ncbi (6.1.20010709) into ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'gif')
-rw-r--r--gif/ncbigif.h26
-rw-r--r--gif/pictogif.c78
2 files changed, 82 insertions, 22 deletions
diff --git a/gif/ncbigif.h b/gif/ncbigif.h
index 20269c78..7fb5ebe3 100644
--- a/gif/ncbigif.h
+++ b/gif/ncbigif.h
@@ -29,7 +29,7 @@
*
* Version Creation Date: 10/20/95
*
-* $Revision: 6.1 $
+* $Revision: 6.2 $
*
* File Description:
* GIF generator header file
@@ -37,6 +37,11 @@
* Modifications:
* --------------------------------------------------------------------------
* $Log: ncbigif.h,v $
+* Revision 6.2 1999/10/20 23:13:59 vakatov
+* + Nlm_Picture2gdImage() -- to draw in gdImage.
+* Nlm_PictureToGIF() -- restore current GIF image (if any) when the
+* dump is complete.
+*
* Revision 6.1 1998/07/02 18:19:28 vakatov
* Cleaned the code & made it pass through the C++ compilation
*
@@ -60,20 +65,26 @@
extern "C" {
#endif
-NLM_EXTERN Nlm_Boolean Nlm_PictureToGIF
+/* Dump a picture to GIF file
+ */
+NLM_EXTERN Boolean Nlm_PictureToGIF
(FILE* out, Int2 gifWidth, Int2 gifHeight,
SegmenT picture, Int4 pntX, Int4 pntY,
Int2 align, Int4 scaleX, Int4 scaleY,
Boolean transparent);
-NLM_EXTERN Nlm_SegmenT Nlm_FindPrimGIF
+NLM_EXTERN Boolean Nlm_Picture2gdImage
+(struct gdImageStruct* im, SegmenT picture,
+ Int4 pntX, Int4 pntY, Int2 align, Int4 scaleX, Int4 scaleY);
+
+NLM_EXTERN SegmenT Nlm_FindPrimGIF
(SegmenT picture, PoinT pt, Int2 gifWidth,
Int2 gifHeight, Int4 pntX, Int4 pntY,
Int2 align, Int4 scaleX, Int4 scaleY,
Uint2Ptr segIDPtr, Uint2Ptr primIDPtr,
PrimitivE PNTR primPtr);
-NLM_EXTERN Nlm_SegmenT Nlm_FindSegGIF
+NLM_EXTERN SegmenT Nlm_FindSegGIF
(SegmenT picture, PoinT pt, Int2 gifWidth,
Int2 gifHeight, Int4 pntX, Int4 pntY,
Int2 align, Int4 scaleX, Int4 scaleY,
@@ -81,9 +92,10 @@ NLM_EXTERN Nlm_SegmenT Nlm_FindSegGIF
Uint2Ptr primCtPtr);
-#define PictureToGIF Nlm_PictureToGIF
-#define FindPrimGIF Nlm_FindPrimGIF
-#define FindSegGIF Nlm_FindSegGIF
+#define PictureToGIF Nlm_PictureToGIF
+#define Picture2gdImage Nlm_Picture2gdImage
+#define FindPrimGIF Nlm_FindPrimGIF
+#define FindSegGIF Nlm_FindSegGIF
#ifdef __cplusplus
}
diff --git a/gif/pictogif.c b/gif/pictogif.c
index 852c5950..564cac95 100644
--- a/gif/pictogif.c
+++ b/gif/pictogif.c
@@ -29,13 +29,18 @@
*
* Version Creation Date: 11/23/95
*
-* $Revision: 6.1 $
+* $Revision: 6.2 $
*
* File Description:
*
* Modifications:
* --------------------------------------------------------------------------
* $Log: pictogif.c,v $
+* Revision 6.2 1999/10/20 23:14:00 vakatov
+* + Nlm_Picture2gdImage() -- to draw in gdImage.
+* Nlm_PictureToGIF() -- restore current GIF image (if any) when the
+* dump is complete.
+*
* Revision 6.1 1998/07/02 18:19:29 vakatov
* Cleaned the code & made it pass through the C++ compilation
*
@@ -47,12 +52,15 @@
#include <mappingp.h>
#include <drawingp.h>
#include <ncbigif.h>
+#include <gifgen.h>
+
/****************************************************************************/
/* DEFINES */
/****************************************************************************/
#define PROXIMITY 2
+
/****************************************************************************/
/* STATIC FUNCTIONS */
/****************************************************************************/
@@ -133,23 +141,63 @@ NLM_EXTERN Boolean Nlm_PictureToGIF
Int2 align, Int4 scaleX, Int4 scaleY,
Boolean transparent)
{
- PicPPtr pic;
Nlm_DrawInfo dInfo;
- if ( out != NULL && picture != NULL && gifWidth > 0 && gifHeight > 0
- && scaleX != 0 && scaleY != 0 ) {
- pic = (PicPPtr) picture;
- if (pic->base.code == PICTURE) {
- if ( !Nlm_CreateGIF ( gifWidth, gifHeight, transparent )) return FALSE;
- if ( !Nlm_MakeScaleGIF ( picture, gifWidth, gifHeight, pntX, pntY,
- align, scaleX, scaleY, &(dInfo.scale) )) return FALSE;
- dInfo.checked = FALSE;
- dInfo.curattrib = blackAttPData;
- dInfo.highlight = 0;
- Nlm_DrawSegment ( (SegPPtr)picture, &dInfo );
- Nlm_SaveGIF ( out );
+ if (!out || !picture || !scaleX || !scaleY ||
+ gifWidth <= 0 || gifHeight <= 0 ||
+ ((PicPPtr) picture)->base.code != PICTURE)
+ return FALSE;
+
+ if ( !Nlm_MakeScaleGIF(picture, gifWidth, gifHeight, pntX, pntY,
+ align, scaleX, scaleY, &dInfo.scale) )
+ return FALSE;
+
+ {{ /* Draw */
+ gdImage* im_prev = Nlm_SetCurrentGIF(0);
+ if ( !Nlm_CreateGIF(gifWidth, gifHeight, transparent) ) {
+ Nlm_SetCurrentGIF(im_prev);
+ return FALSE;
}
- }
+ dInfo.checked = FALSE;
+ dInfo.curattrib = blackAttPData;
+ dInfo.highlight = 0;
+ Nlm_DrawSegment((SegPPtr)picture, &dInfo);
+ Nlm_SaveGIF(out);
+ Nlm_DestroyGIF();
+ Nlm_SetCurrentGIF(im_prev);
+ }}
+
+ return TRUE;
+}
+
+
+NLM_EXTERN Boolean Nlm_Picture2gdImage
+(struct gdImageStruct* im, SegmenT picture,
+ Int4 pntX, Int4 pntY, Int2 align, Int4 scaleX, Int4 scaleY)
+{
+ Nlm_DrawInfo dInfo;
+
+ if (!im || !picture || !scaleX || !scaleY ||
+ ((PicPPtr) picture)->base.code != PICTURE)
+ return FALSE;
+
+ {{ /* Scale and position of the picture in the GD image */
+ int width, height;
+ gdImageGetDimensions(im, &width, &height);
+ if ( !Nlm_MakeScaleGIF(picture, (Int2)width, (Int2)height, pntX, pntY,
+ align, scaleX, scaleY, &dInfo.scale) )
+ return FALSE;
+ }}
+
+ dInfo.checked = FALSE;
+ dInfo.curattrib = blackAttPData;
+ dInfo.highlight = 0;
+
+ {{ /* Draw */
+ gdImage* im_prev = Nlm_SetCurrentGIF(im);
+ Nlm_DrawSegment((SegPPtr) picture, &dInfo);
+ Nlm_SetCurrentGIF(im_prev);
+ }}
return TRUE;
}