% PPPP AAA N N GGGG OOO %
% P P A A NN N G O O %
% PPPP AAAAA N N N G GGG O O %
-% P M A A N NN G G O O %
+% P A A N NN G G O O %
% P A A N N GGGG OOO %
% %
% %
% Read Pango Markup Language Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% March 2012 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 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 %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
PangoContext
*context;
+ PangoFontDescription
+ *description;
+
PangoFontMap
*fontmap;
Initialize Image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
- assert(exception->signature == MagickSignature);
+ assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
(void) ResetImagePage(image,"0x0+0+0");
/*
pango_layout_set_ellipsize(layout,PANGO_ELLIPSIZE_START);
}
option=GetImageOption(image_info,"pango:justify");
- if (IfMagickTrue(IsStringTrue(option)))
+ if (IsStringTrue(option) != MagickFalse)
pango_layout_set_justify(layout,1);
option=GetImageOption(image_info,"pango:single-paragraph");
- if (IfMagickTrue(IsStringTrue(option)))
+ if (IsStringTrue(option) != MagickFalse)
pango_layout_set_single_paragraph_mode(layout,1);
option=GetImageOption(image_info,"pango:wrap");
if (option != (const char *) NULL)
(draw_info->direction == RightToLeftDirection))
align=(PangoAlignment) (PANGO_ALIGN_LEFT+PANGO_ALIGN_RIGHT-align);
pango_layout_set_alignment(layout,align);
- if (draw_info->font != (char *) NULL)
- {
- PangoFontDescription
- *description;
-
- /*
- Set font.
- */
- description=pango_font_description_from_string(draw_info->font);
- pango_font_description_set_size(description,(int) (PANGO_SCALE*
- draw_info->pointsize+0.5));
- pango_layout_set_font_description(layout,description);
- pango_font_description_free(description);
- }
+ if (draw_info->font == (char *) NULL)
+ description=pango_font_description_new();
+ else
+ description=pango_font_description_from_string(draw_info->font);
+ pango_font_description_set_size(description,(int) (PANGO_SCALE*
+ draw_info->pointsize+0.5));
+ pango_layout_set_font_description(layout,description);
+ pango_font_description_free(description);
option=GetImageOption(image_info,"pango:markup");
if ((option != (const char *) NULL) && (IsStringTrue(option) == MagickFalse))
pango_layout_set_text(layout,caption,-1);
(image->resolution.y == 0.0 ? 90.0 : image->resolution.y)+45.0)/90.0+
0.5));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Render markup.
*/
stride=(size_t) cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,
- image->columns);
+ (int) image->columns);
pixel_info=AcquireVirtualMemory(image->rows,stride*sizeof(*pixels));
if (pixel_info == (MemoryInfo *) NULL)
{
}
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
surface=cairo_image_surface_create_for_data(pixels,CAIRO_FORMAT_ARGB32,
- image->columns,image->rows,stride);
+ (int) image->columns,(int) image->rows,(int) stride);
cairo_image=cairo_create(surface);
cairo_set_operator(cairo_image,CAIRO_OPERATOR_CLEAR);
cairo_paint(cairo_image);
cairo_set_operator(cairo_image,CAIRO_OPERATOR_OVER);
cairo_translate(cairo_image,page.x,page.y);
+ cairo_set_source_rgba(cairo_image,QuantumScale*draw_info->fill.red,
+ QuantumScale*draw_info->fill.green,QuantumScale*draw_info->fill.blue,
+ QuantumScale*draw_info->fill.alpha);
pango_cairo_show_layout(cairo_image,layout);
cairo_destroy(cairo_image);
cairo_surface_destroy(surface);
/*
Disassociate alpha.
*/
- gamma=1.0-QuantumScale*fill_color.alpha;
+ gamma=QuantumScale*fill_color.alpha;
gamma=PerceptibleReciprocal(gamma);
fill_color.blue*=gamma;
fill_color.green*=gamma;
ModuleExport size_t RegisterPANGOImage(void)
{
char
- version[MaxTextExtent];
+ version[MagickPathExtent];
MagickInfo
*entry;
*version='\0';
#if defined(PANGO_VERSION_STRING)
- (void) FormatLocaleString(version,MaxTextExtent,"Pangocairo %s",
+ (void) FormatLocaleString(version,MagickPathExtent,"Pangocairo %s",
PANGO_VERSION_STRING);
#endif
- entry=SetMagickInfo("PANGO");
+ entry=AcquireMagickInfo("PANGO","PANGO","Pango Markup Language");
#if defined(MAGICKCORE_PANGOCAIRO_DELEGATE)
entry->decoder=(DecodeImageHandler *) ReadPANGOImage;
#endif
- entry->description=ConstantString("Pango Markup Language");
if (*version != '\0')
entry->version=ConstantString(version);
- entry->adjoin=MagickFalse;
- entry->module=ConstantString("PANGO");
+ entry->flags^=CoderAdjoinFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}