⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert.c

📁 这是符合Linux操作系统标准的POIXS 的pixops-2.0.5源程序
💻 C
字号:
/* Copyright (C) 2004 VMware, Inc. * This file is part of the Pixops Library. * * The pixops library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * The pixops library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public * License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* * convert.c -- * *      Implement some leaf functions for pixel format conversion. */#include "pixops.h"#include "pixops-internal.h"#include "convert.h"inline static booleansupport_scale_bppdepth(int bppdepth){   return bppdepth == 8 ||          bppdepth == 15 ||          bppdepth == 16 ||          bppdepth == 24 ||          bppdepth == 32;}PixopsStatuspixops_support_scale_formats (int dest_bytes_per_pixel,                              int dest_depth,                              boolean dest_has_alpha,                              int src_bytes_per_pixel,                              int src_depth,                              unsigned int *src_colormap,                              boolean src_has_alpha){   if ((!dest_has_alpha && src_has_alpha) ||       (dest_has_alpha && dest_bytes_per_pixel != 4) ||       (src_has_alpha && src_bytes_per_pixel != 4)) {      goto bad;   }   /*    * XXX We don't support 8BGR source, for no good reason.    */   if (src_bytes_per_pixel == 1 && !src_colormap) {      goto bad;   }   if ((src_bytes_per_pixel << 3) < src_depth ||       (dest_bytes_per_pixel << 3) < dest_depth) {      goto bad;   }   if (!(support_scale_bppdepth (BPPDEPTH(src_bytes_per_pixel << 3, src_depth)) &&         support_scale_bppdepth (BPPDEPTH(dest_bytes_per_pixel << 3, dest_depth)))) {      goto bad;   }   return PIXOPS_STATUS_SUCCESS;bad:   return PIXOPS_STATUS_UNSUPPORTED_FORMAT;}PixopsStatuspixops_support_scale_composite_formats (int dest_channels,                                        boolean dest_has_alpha,                                        int src_channels,                                        boolean src_has_alpha){   /*    * Only 24-bit depth compositing is supported    */   if ((src_channels != 3 && src_channels != 4) ||       (dest_channels != 3 && dest_channels != 4)) {      goto bad;   }   if (dest_has_alpha && dest_channels != 4 ||       src_has_alpha && src_channels != 4) {      goto bad;   }   return PIXOPS_STATUS_SUCCESS;bad:   return PIXOPS_STATUS_UNSUPPORTED_FORMAT;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -