[prev in list] [next in list] [prev in thread] [next in thread] 

List:       imagemagick
Subject:    Regarding AnnotateImage to place a text at an angle.
From:       vishwas goel <vishwasg () yahoo ! com>
Date:       2000-03-31 2:22:11
[Download RAW message or body]

Hi all

I am using libmagick.a, and am on Sun Solaris.
Attached is the Code I have in place.

In this piece of code, I am trying to draw a line
and write text at an angle.
But Neither, am I able to draw a line nor the text
at an angle.
Text does appear, but horizontally.

Any help shall be greatly appreciated.
Thanks in advance.
Vish.


=====


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
["try.c" (application/x-unknown)]

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <math.h>
#include "../../libgd/ImageMagic/api.h"

int main()
{
	int		i;
	char		*pixel_data, *ann_data;
	Image		*img, *ann_img;
	ImageInfo	img_info, ann_img_info;
	AnnotateInfo	ann_info;

	pixel_data = (char*) calloc( 480000, sizeof( char ));
	ann_data = (char*) calloc( 6, sizeof( char ));
	if (( pixel_data == NULL ) || ( ann_data == NULL ))
	{
		printf( "Error in allocating the Memory.\n" );
		return 0;
	}
	
	for ( i = 0; i < 160000; i++ )
	{
		pixel_data[i* 3 ] = 255;
		pixel_data[i* 3 + 1 ] = 255;
		pixel_data[i* 3 + 2 ] = 170;
	}	

	img = CreateImage( 400, 400, "RGB", 0, (const void*) pixel_data ); 
	if ( img == NULL ) 
	{
		printf("NULL Image.\n" );
		return 0;
	}

	strcpy( img->magick, "gif" );
	strcpy( img->filename, "new.gif" );

	GetImageInfo( &img_info );
//	SetImage( img );
	GetAnnotateInfo( &ann_img_info, &ann_info );
	ann_info.font_name = calloc( 100, sizeof( char ));
	strcpy( ann_info.font_name, "cordiab.ttf" );
	ann_info.geometry = calloc( 100, sizeof( char )); 
	strcpy( ann_info.geometry, "24x24+100+100" );
	ann_info.gravity = NorthWestGravity;
	ann_info.text = calloc( 100, sizeof( char ));
	strcpy( ann_info.text , "Hi, Just trying out." );
	ann_info.degrees = M_PI / 7.;

	AnnotateImage( img, &ann_info );

	GetAnnotateInfo( &ann_img_info, &ann_info );
	ann_info.tile = CreateImage( 1, 1, "RGB", 0, (const void*) ann_data ); 
	ann_info.primitive = calloc( 100, sizeof( char ));
	strcpy( ann_info.primitive , "line 100,100 10,10" );
	DrawImage( img, &ann_info );

	WriteImage ( &img_info, img ); 
	return 0;

}


***********************************************************************
To remove yourself from this mailing list, send mail to:
	majordomo@wizards.dupont.com

Include the following command in the body of your message:
	unsubscribe magick
***********************************************************************


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic