本文整理汇总了C++中ParseGeometry函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseGeometry函数的具体用法?C++ ParseGeometry怎么用?C++ ParseGeometry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseGeometry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dims_brightness_operation
apr_status_t
dims_brightness_operation (dims_request_rec *d, char *args, char **err) {
MagickStatusType flags;
GeometryInfo geometry;
flags = ParseGeometry(args, &geometry);
//MAGICK_CHECK(MagickBrightnessContrastImage(d->wand,
// geometry.rho, geometry.sigma), d);
return DIMS_SUCCESS;
}
示例2: IsGeometry
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ I s G e o m e t r y %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% IsGeometry() returns MagickTrue if the geometry specification is valid.
% Examples are 100, 100x200, x200, 100x200+10+20, +10+20, 200%, 200x200!, etc.
%
% The format of the IsGeometry method is:
%
% MagickBooleanType IsGeometry(const char *geometry)
%
% A description of each parameter follows:
%
% o geometry: This string is the geometry specification.
%
*/
MagickExport MagickBooleanType IsGeometry(const char *geometry)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
if (geometry == (const char *) NULL)
return(MagickFalse);
flags=ParseGeometry(geometry,&geometry_info);
return(flags != NoValue ? MagickTrue : MagickFalse);
}
示例3: dims_sharpen_operation
apr_status_t
dims_sharpen_operation (dims_request_rec *d, char *args, char **err) {
MagickStatusType flags;
GeometryInfo geometry;
flags = ParseGeometry(args, &geometry);
if ((flags & SigmaValue) == 0) {
geometry.sigma=1.0;
}
MAGICK_CHECK(MagickSharpenImage(d->wand, geometry.rho, geometry.sigma), d);
return DIMS_SUCCESS;
}
示例4: ForEachPoint
void ForEachPoint(Functor && f, int scale)
{
ParseGeometry(scale);
if (m_points.empty())
{
// it's a point feature
if (GetFeatureType() == feature::GEOM_POINT)
f(m_center);
}
else
{
for (size_t i = 0; i < m_points.size(); ++i)
f(m_points[i]);
}
}
示例5: small_light_filter_imagemagick_output_data
//.........这里部分代码省略.........
PixelSetBlue(canvas_color, sz.cc.b / 255.0);
PixelSetAlpha(canvas_color, sz.cc.a / 255.0);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"MagickNewImage(canvas_wand, %f, %f, bgcolor)", sz.cw, sz.ch);
status = MagickNewImage(canvas_wand, sz.cw, sz.ch, canvas_color);
DestroyPixelWand(canvas_color);
if (status == MagickFalse) {
small_light_filter_imagemagick_output_data_fini(ctx);
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"MagickNewImage(canvas_wand, %f, %f, bgcolor) failed", sz.cw, sz.ch);
r->status = HTTP_INTERNAL_SERVER_ERROR;
return APR_EGENERAL;
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"MagickCompositeImage(canvas_wand, wand, AtopCompositeOp, %f, %f)",
sz.dx, sz.dy);
status = MagickCompositeImage(canvas_wand, lctx->wand, AtopCompositeOp, sz.dx, sz.dy);
if (status == MagickFalse) {
small_light_filter_imagemagick_output_data_fini(ctx);
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"MagickCompositeImage(canvas_wand, wand, AtopCompositeOp, %f, %f) failed",
sz.dx, sz.dy);
r->status = HTTP_INTERNAL_SERVER_ERROR;
return APR_EGENERAL;
}
DestroyMagickWand(lctx->wand);
lctx->wand = canvas_wand;
}
// effects.
char *unsharp = (char *)apr_table_get(ctx->prm, "unsharp");
if (unsharp) {
GeometryInfo geo;
ParseGeometry(unsharp, &geo);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"MagickUnsharpMaskImage(wand, %f, %f, %f, %f)",
geo.rho, geo.sigma, geo.xi, geo.psi);
status = MagickUnsharpMaskImage(lctx->wand, geo.rho, geo.sigma, geo.xi, geo.psi);
if (status == MagickFalse) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "unsharp failed");
}
}
char *sharpen = (char *)apr_table_get(ctx->prm, "sharpen");
if (sharpen) {
GeometryInfo geo;
ParseGeometry(sharpen, &geo);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"MagickSharpenImage(wand, %f, %f)",
geo.rho, geo.sigma);
status = MagickSharpenImage(lctx->wand, geo.rho, geo.sigma);
if (status == MagickFalse) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "sharpen failed");
}
}
char *blur = (char *)apr_table_get(ctx->prm, "blur");
if (blur) {
GeometryInfo geo;
ParseGeometry(blur, &geo);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"MagickBlurImage(wand, %f, %f)",
geo.rho, geo.sigma);
status = MagickBlurImage(lctx->wand, geo.rho, geo.sigma);
if (status == MagickFalse) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "blur failed");
示例6: WritePS2Image
//.........这里部分代码省略.........
return(status);
compression=image->compression;
if (image_info->compression != UndefinedCompression)
compression=image_info->compression;
switch (compression)
{
#if !defined(MAGICKCORE_JPEG_DELEGATE)
case JPEGCompression:
{
compression=RLECompression;
(void) ThrowMagickException(&image->exception,GetMagickModule(),
MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (JPEG)",
image->filename);
break;
}
#endif
default:
break;
}
(void) ResetMagickMemory(&bounds,0,sizeof(bounds));
page=1;
scene=0;
do
{
/*
Scale relative to dots-per-inch.
*/
delta.x=DefaultResolution;
delta.y=DefaultResolution;
resolution.x=image->x_resolution;
resolution.y=image->y_resolution;
if ((resolution.x == 0.0) || (resolution.y == 0.0))
{
flags=ParseGeometry(PSDensityGeometry,&geometry_info);
resolution.x=geometry_info.rho;
resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
resolution.y=resolution.x;
}
if (image_info->density != (char *) NULL)
{
flags=ParseGeometry(image_info->density,&geometry_info);
resolution.x=geometry_info.rho;
resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
resolution.y=resolution.x;
}
if (image->units == PixelsPerCentimeterResolution)
{
resolution.x=(size_t) (100.0*2.54*resolution.x+0.5)/100.0;
resolution.y=(size_t) (100.0*2.54*resolution.y+0.5)/100.0;
}
SetGeometry(image,&geometry);
(void) FormatLocaleString(page_geometry,MaxTextExtent,"%.20gx%.20g",
(double) image->columns,(double) image->rows);
if (image_info->page != (char *) NULL)
(void) CopyMagickString(page_geometry,image_info->page,MaxTextExtent);
else
if ((image->page.width != 0) && (image->page.height != 0))
(void) FormatLocaleString(page_geometry,MaxTextExtent,
"%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double)
image->page.height,(double) image->page.x,(double) image->page.y);
else
if ((image->gravity != UndefinedGravity) &&
(LocaleCompare(image_info->magick,"PS") == 0))
(void) CopyMagickString(page_geometry,PSPageGeometry,MaxTextExtent);
示例7: assert
static Image *ReadEMFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Gdiplus::Bitmap
*bitmap;
Gdiplus::BitmapData
bitmap_data;
Gdiplus::GdiplusStartupInput
startup_input;
Gdiplus::Graphics
*graphics;
Gdiplus::Image
*source;
Gdiplus::Rect
rect;
GeometryInfo
geometry_info;
Image
*image;
MagickStatusType
flags;
register Quantum
*q;
register ssize_t
x;
ssize_t
y;
ULONG_PTR
token;
unsigned char
*p;
wchar_t
fileName[MagickPathExtent];
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
image=AcquireImage(image_info,exception);
if (Gdiplus::GdiplusStartup(&token,&startup_input,NULL) !=
Gdiplus::Status::Ok)
ThrowReaderException(CoderError, "GdiplusStartupFailed");
MultiByteToWideChar(CP_UTF8,0,image->filename,-1,fileName,MagickPathExtent);
source=Gdiplus::Image::FromFile(fileName);
if (source == (Gdiplus::Image *) NULL)
{
Gdiplus::GdiplusShutdown(token);
ThrowReaderException(FileOpenError,"UnableToOpenFile");
}
image->resolution.x=source->GetHorizontalResolution();
image->resolution.y=source->GetVerticalResolution();
image->columns=(size_t) source->GetWidth();
image->rows=(size_t) source->GetHeight();
if (image_info->density != (char *) NULL)
{
flags=ParseGeometry(image_info->density,&geometry_info);
image->resolution.x=geometry_info.rho;
image->resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
image->resolution.y=image->resolution.x;
if ((image->resolution.x > 0.0) && (image->resolution.y > 0.0))
{
image->columns=(size_t) floor((Gdiplus::REAL) source->GetWidth() /
source->GetHorizontalResolution() * image->resolution.x + 0.5);
image->rows=(size_t)floor((Gdiplus::REAL) source->GetHeight() /
source->GetVerticalResolution() * image->resolution.y + 0.5);
}
}
bitmap=new Gdiplus::Bitmap((INT) image->columns,(INT) image->rows,
PixelFormat32bppARGB);
graphics=Gdiplus::Graphics::FromImage(bitmap);
graphics->SetInterpolationMode(Gdiplus::InterpolationModeHighQualityBicubic);
graphics->SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
graphics->SetTextRenderingHint(Gdiplus::TextRenderingHintClearTypeGridFit);
graphics->Clear(Gdiplus::Color((BYTE) ScaleQuantumToChar(
image->background_color.alpha),(BYTE) ScaleQuantumToChar(
image->background_color.red),(BYTE) ScaleQuantumToChar(
image->background_color.green),(BYTE) ScaleQuantumToChar(
image->background_color.blue)));
graphics->DrawImage(source,0,0,(INT) image->columns,(INT) image->rows);
delete graphics;
//.........这里部分代码省略.........
示例8: WriteHTMLImage
//.........这里部分代码省略.........
Write the HTML image file.
*/
(void) strcpy(buffer,"<html version=\"2.0\">\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(buffer,"<head>\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) sprintf(buffer,"<title>%.1024s</title>\n",
image->label ? image->label : BaseFilename(image->filename));
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(buffer,"</head>\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(buffer,"<body>\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(buffer,"<center>\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) sprintf(buffer,"<h1>%.1024s</h1>\n",image->filename);
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(buffer,"<br><br>\n");
(void) WriteBlob(image,strlen(buffer),buffer);
(void) strcpy(filename,image->filename);
AppendImageFormat("gif",filename);
(void) sprintf(buffer,
"<img ismap usemap=#%.1024s src=\"%.1024s\" border=0>\n",
mapname,filename);
(void) WriteBlob(image,strlen(buffer),buffer);
/*
Determine the size and location of each image tile.
*/
width=image->columns;
height=image->rows;
x=0;
y=0;
if (image->montage != (char *) NULL)
(void) ParseGeometry(image->montage,&x,&y,&width,&height);
/*
Write an image map.
*/
(void) sprintf(buffer,"<map name=%.1024s>\n",mapname);
(void) WriteBlob(image,strlen(buffer),buffer);
(void) sprintf(buffer," <area href=""%.1024s""",url);
(void) WriteBlob(image,strlen(buffer),buffer);
if (image->directory == (char *) NULL)
{
(void) sprintf(buffer,"%.1024s shape=rect coords=0,0,%u,%u>\n",
image->filename,width-1,height-1);
(void) WriteBlob(image,strlen(buffer),buffer);
}
else
for (p=image->directory; *p != '\0'; p++)
if (*p != '\n')
(void) WriteByte(image,*p);
else
{
(void) sprintf(buffer," shape=rect coords=%d,%d,%d,%d>\n",
x,y,x+(int) width-1,y+(int) height-1);
(void) WriteBlob(image,strlen(buffer),buffer);
if (*(p+1) != '\0')
{
(void) sprintf(buffer," <area href=""%.1024s""",url);
(void) WriteBlob(image,strlen(buffer),buffer);
}
x+=width;
if (x >= (int) image->columns)
{
x=0;
y+=height;
示例9: ReadYUVImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d Y U V I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadYUVImage() reads an image with digital YUV (CCIR 601 4:1:1, plane
% or partition interlaced, or 4:2:2 plane, partition interlaced or
% noninterlaced) bytes and returns it. It allocates the memory necessary
% for the new Image structure and returns a pointer to the new image.
%
% The format of the ReadYUVImage method is:
%
% Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*chroma_image,
*image,
*resize_image;
InterlaceType
interlace;
MagickBooleanType
status;
register const PixelPacket
*chroma_pixels;
register ssize_t
x;
register PixelPacket
*q;
register unsigned char
*p;
ssize_t
count,
horizontal_factor,
vertical_factor,
y;
size_t
quantum;
unsigned char
*scanline;
/*
Allocate image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage(image_info);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
quantum=(size_t) (image->depth <= 8 ? 1 : 2);
interlace=image_info->interlace;
horizontal_factor=2;
vertical_factor=2;
if (image_info->sampling_factor != (char *) NULL)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(image_info->sampling_factor,&geometry_info);
horizontal_factor=(ssize_t) geometry_info.rho;
vertical_factor=(ssize_t) geometry_info.sigma;
if ((flags & SigmaValue) == 0)
vertical_factor=horizontal_factor;
//.........这里部分代码省略.........
示例10: ParseMetaGeometry
MagickExport MagickStatusType ParseMetaGeometry(const char *geometry,ssize_t *x,
ssize_t *y,size_t *width,size_t *height)
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
size_t
former_height,
former_width;
/*
Ensure the image geometry is valid.
*/
assert(x != (ssize_t *) NULL);
assert(y != (ssize_t *) NULL);
assert(width != (size_t *) NULL);
assert(height != (size_t *) NULL);
if ((geometry == (char *) NULL) || (*geometry == '\0'))
return(NoValue);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",geometry);
/*
Parse geometry using GetGeometry.
*/
SetGeometryInfo(&geometry_info);
former_width=(*width);
former_height=(*height);
flags=GetGeometry(geometry,x,y,width,height);
if ((flags & PercentValue) != 0)
{
MagickStatusType
flags;
PointInfo
scale;
/*
Geometry is a percentage of the image size.
*/
flags=ParseGeometry(geometry,&geometry_info);
scale.x=geometry_info.rho;
if ((flags & RhoValue) == 0)
scale.x=100.0;
scale.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
scale.y=scale.x;
*width=(size_t) floor(scale.x*former_width/100.0+0.5);
if (*width == 0)
*width=1;
*height=(size_t) floor(scale.y*former_height/100.0+0.5);
if (*height == 0)
*height=1;
former_width=(*width);
former_height=(*height);
}
if (((flags & AspectValue) == 0) && ((*width != former_width) ||
(*height != former_height)))
{
MagickRealType
scale_factor;
/*
Respect aspect ratio of the image.
*/
if ((former_width == 0) || (former_height == 0))
scale_factor=1.0;
else
if (((flags & RhoValue) != 0) && (flags & SigmaValue) != 0)
{
scale_factor=(MagickRealType) *width/(MagickRealType) former_width;
if ((flags & MinimumValue) == 0)
{
if (scale_factor > ((MagickRealType) *height/
(MagickRealType) former_height))
scale_factor=(MagickRealType) *height/(MagickRealType)
former_height;
}
else
if (scale_factor < ((MagickRealType) *height/
(MagickRealType) former_height))
scale_factor=(MagickRealType) *height/(MagickRealType)
former_height;
}
else
if ((flags & RhoValue) != 0)
{
scale_factor=(MagickRealType) *width/(MagickRealType)
former_width;
if (((flags & MinimumValue) != 0) &&
(scale_factor < ((MagickRealType) *width/
(MagickRealType) former_height)))
scale_factor=(MagickRealType) *width/(MagickRealType)
former_height;
}
else
{
scale_factor=(MagickRealType) *height/(MagickRealType)
former_height;
//.........这里部分代码省略.........
示例11: ReadTEXTImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d T E X T I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadTEXTImage() reads a text file and returns it as an image. It
% allocates the memory necessary for the new Image structure and returns a
% pointer to the new image.
%
% The format of the ReadTEXTImage method is:
%
% Image *ReadTEXTImage(const ImageInfo *image_info,Image *image,
% char *text,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o image: the image.
%
% o text: the text storage buffer.
%
% o exception: return any errors or warnings in this structure.
%
*/
static Image *ReadTEXTImage(const ImageInfo *image_info,Image *image,
char *text,ExceptionInfo *exception)
{
char
filename[MaxTextExtent],
geometry[MaxTextExtent],
*p;
DrawInfo
*draw_info;
Image
*texture;
MagickBooleanType
status;
PointInfo
delta;
RectangleInfo
page;
ssize_t
offset;
TypeMetric
metrics;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
/*
Set the page geometry.
*/
delta.x=DefaultResolution;
delta.y=DefaultResolution;
if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(PSDensityGeometry,&geometry_info);
image->x_resolution=geometry_info.rho;
image->y_resolution=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
image->y_resolution=image->x_resolution;
}
page.width=612;
page.height=792;
page.x=43;
page.y=43;
if (image_info->page != (char *) NULL)
(void) ParseAbsoluteGeometry(image_info->page,&page);
/*
Initialize Image structure.
*/
image->columns=(size_t) floor((((double) page.width*image->x_resolution)/
delta.x)+0.5);
//.........这里部分代码省略.........
示例12: SyncImageSettings
/*
Extern: rm_sync_image_options
Purpose: Propagate ImageInfo values to the Image
Ref: SyncImageSettings (in mogrify.c)
*/
void rm_sync_image_options(Image *image, Info *info)
{
MagickStatusType flags;
GeometryInfo geometry_info;
const char *option;
// The option strings will be set only when their attribute values were
// set in the optional argument block.
option = GetImageOption(info,"background");
if (option)
{
image->background_color = info->background_color;
}
option = GetImageOption(info,"bordercolor");
if (option)
{
image->border_color = info->border_color;
}
if (info->colorspace != UndefinedColorspace)
{
image->colorspace = info->colorspace;
}
if (info->compression != UndefinedCompression)
{
image->compression = info->compression;
}
option = GetImageOption(info, "delay");
if (option)
{
image->delay = strtoul(option, NULL, 0);
}
if (info->density)
{
flags = ParseGeometry(info->density, &geometry_info);
image->x_resolution = geometry_info.rho;
image->y_resolution = geometry_info.sigma;
if ((flags & SigmaValue) == 0)
{
image->y_resolution = image->x_resolution;
}
}
if (info->depth != 0)
{
image->depth = info->depth;
}
option = GetImageOption(info, "dispose");
if (option)
{
image->dispose = rm_dispose_to_enum(option);
}
if (info->extract)
{
ParseAbsoluteGeometry(info->extract, &image->extract_info);
}
if (info->fuzz != 0.0)
{
image->fuzz = info->fuzz;
}
option = GetImageOption(info, "gravity");
if (option)
{
image->gravity = rm_gravity_to_enum(option);
}
if (info->interlace != NoInterlace)
{
image->interlace = info->interlace;
}
option = GetImageOption(info,"mattecolor");
if (option)
{
image->matte_color = info->matte_color;
}
if (info->orientation != UndefinedOrientation)
{
image->orientation = info->orientation;
}
if (info->page)
{
(void)ParseAbsoluteGeometry(info->page, &image->page);
}
//.........这里部分代码省略.........
示例13: StringToLower
void CMiniMap::ConfigCommand(const std::string& line)
{
const vector<string> words = CSimpleParser::Tokenize(line, 1);
if (words.empty()) {
return;
}
const string command = StringToLower(words[0]);
if (command == "fullproxy") {
if (words.size() >= 2) {
fullProxy = !!atoi(words[1].c_str());
} else {
fullProxy = !fullProxy;
}
}
else if (command == "icons") {
if (words.size() >= 2) {
useIcons = !!atoi(words[1].c_str());
} else {
useIcons = !useIcons;
}
}
else if (command == "unitexp") {
if (words.size() >= 2) {
unitExponent = atof(words[1].c_str());
}
UpdateGeometry();
}
else if (command == "unitsize") {
if (words.size() >= 2) {
unitBaseSize = atof(words[1].c_str());
}
unitBaseSize = std::max(0.0f, unitBaseSize);
UpdateGeometry();
}
else if (command == "drawcommands") {
if (words.size() >= 2) {
drawCommands = std::max(0, atoi(words[1].c_str()));
} else {
drawCommands = (drawCommands > 0) ? 0 : 1;
}
}
else if (command == "drawprojectiles") {
if (words.size() >= 2) {
drawProjectiles = !!atoi(words[1].c_str());
} else {
drawProjectiles = !drawProjectiles;
}
}
else if (command == "simplecolors") {
if (words.size() >= 2) {
simpleColors = !!atoi(words[1].c_str());
} else {
simpleColors = !simpleColors;
}
}
// the following commands can not be used in dualscreen mode
if (gu->dualScreenMode) {
return;
}
if ((command == "geo") || (command == "geometry")) {
if (words.size() < 2) {
return;
}
ParseGeometry(words[1]);
UpdateGeometry();
}
else if ((command == "min") || (command == "minimize")) {
if (words.size() >= 2) {
minimized = !!atoi(words[1].c_str());
} else {
minimized = !minimized;
}
}
else if ((command == "max") ||
(command == "maximize") || (command == "maxspect")) {
bool newMax = maximized;
if (words.size() >= 2) {
newMax = !!atoi(words[1].c_str());
} else {
newMax = !newMax;
}
if (newMax != maximized) {
ToggleMaximized(command == "maxspect");
}
}
}
示例14: MagickGeometry_Initialize
MAGICK_NET_EXPORT MagickStatusType MagickGeometry_Initialize(GeometryInfo *instance, const char *geometry)
{
return ParseGeometry(geometry, instance);
}
示例15: WritePCLImage
static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
char
buffer[MaxTextExtent];
const char
*option;
MagickBooleanType
status;
MagickOffsetType
scene;
register const Quantum *p;
register ssize_t i, x;
register unsigned char *q;
size_t
density,
length,
one,
packets;
ssize_t
y;
unsigned char
bits_per_pixel,
*compress_pixels,
*pixels,
*previous_pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
density=75;
if (image_info->density != (char *) NULL)
{
GeometryInfo
geometry;
(void) ParseGeometry(image_info->density,&geometry);
density=(size_t) geometry.rho;
}
scene=0;
one=1;
do
{
if (IsRGBColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,RGBColorspace,exception);
/*
Initialize the printer.
*/
(void) WriteBlobString(image,"\033E"); /* printer reset */
(void) WriteBlobString(image,"\033*r3F"); /* set presentation mode */
(void) FormatLocaleString(buffer,MaxTextExtent,"\033*r%.20gs%.20gT",
(double) image->columns,(double) image->rows);
(void) WriteBlobString(image,buffer);
(void) FormatLocaleString(buffer,MaxTextExtent,"\033*t%.20gR",(double)
density);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,"\033&l0E"); /* top margin 0 */
if (IsImageMonochrome(image,exception) != MagickFalse)
{
/*
Monochrome image: use default printer monochrome setup.
*/
bits_per_pixel=1;
}
else
if (image->storage_class == DirectClass)
{
/*
DirectClass image.
*/
bits_per_pixel=24;
(void) WriteBlobString(image,"\033*v6W"); /* set color mode */
(void) WriteBlobByte(image,0); /* RGB */
(void) WriteBlobByte(image,3); /* direct by pixel */
(void) WriteBlobByte(image,0); /* bits per index (ignored) */
(void) WriteBlobByte(image,8); /* bits per red component */
(void) WriteBlobByte(image,8); /* bits per green component */
(void) WriteBlobByte(image,8); /* bits per blue component */
}
else
//.........这里部分代码省略.........