| 1 | /* B.c |
| 2 | * Copyright (C) 2007 Richard Spindler ([email protected]) |
| 3 | * This file is a Frei0r plugin. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 | */ |
| 19 | |
| 20 | #include <stdlib.h> |
| 21 | #include <assert.h> |
| 22 | |
| 23 | #include "frei0r.h"cxx . . $ `<file>/include/frei0r.h`/ |
| 24 | |
| 25 | typedef struct rgb_instancecxx . . $ rgb_instance# |
| 26 | { |
| 27 | unsigned int widthcxx . . $ rgb_instance#width.; |
| 28 | unsigned int heightcxx . . $ rgb_instance#height.; |
| 29 | } rgb_instance_tcxx . . $ rgb_instance_t#; |
| 30 | |
| 31 | int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).() |
| 32 | { |
| 33 | return 1; |
| 34 | } |
| 35 | |
| 36 | void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).() |
| 37 | { /* no initialization required */ } |
| 38 | |
| 39 | void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* rgbInfo) |
| 40 | { |
| 41 | rgbInfo->namecxx . . $ f0r_plugin_info#name. = "B"; |
| 42 | rgbInfo->authorcxx . . $ f0r_plugin_info#author. = "Richard Spindler"; |
| 43 | rgbInfo->plugin_typecxx . . $ f0r_plugin_info#plugin_type. = F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!; |
| 44 | rgbInfo->color_modelcxx . . $ f0r_plugin_info#color_model. = F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!; |
| 45 | rgbInfo->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version. = FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!; |
| 46 | rgbInfo->major_versioncxx . . $ f0r_plugin_info#major_version. = 0; |
| 47 | rgbInfo->minor_versioncxx . . $ f0r_plugin_info#minor_version. = 9; |
| 48 | rgbInfo->num_paramscxx . . $ f0r_plugin_info#num_params. = 0; |
| 49 | rgbInfo->explanationcxx . . $ f0r_plugin_info#explanation. = "Extracts Blue from Image"; |
| 50 | } |
| 51 | |
| 52 | void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index) |
| 53 | { |
| 54 | /* no params */ |
| 55 | } |
| 56 | |
| 57 | f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height) |
| 58 | { |
| 59 | rgb_instance_tcxx . . $ rgb_instance_t#* inst = (rgb_instance_tcxx . . $ rgb_instance_t#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*inst)); |
| 60 | inst->widthcxx . . $ rgb_instance#width. = width; inst->heightcxx . . $ rgb_instance#height. = height; |
| 61 | return (f0r_instance_tcxx . . $ f0r_instance_t#)inst; |
| 62 | } |
| 63 | |
| 64 | void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance) |
| 65 | { |
| 66 | freecxx . . $ free(5d22bdacc48458e8).(instance); |
| 67 | } |
| 68 | |
| 69 | void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, |
| 70 | f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 71 | { /* no params */ } |
| 72 | |
| 73 | void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, |
| 74 | f0r_param_tcxx . . $ f0r_param_t# param, int param_index) |
| 75 | { /* no params */ } |
| 76 | |
| 77 | void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time, |
| 78 | const uint32_tcxx . . $ uint32_t#* inframe, uint32_tcxx . . $ uint32_t#* outframe) |
| 79 | { |
| 80 | assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance); |
| 81 | rgb_instance_tcxx . . $ rgb_instance_t#* inst = (rgb_instance_tcxx . . $ rgb_instance_t#*)instance; |
| 82 | unsigned int w = inst->widthcxx . . $ rgb_instance#width.; |
| 83 | unsigned int h = inst->heightcxx . . $ rgb_instance#height.; |
| 84 | unsigned int x,y; |
| 85 | |
| 86 | uint32_tcxx . . $ uint32_t#* dst = outframe; |
| 87 | const uint32_tcxx . . $ uint32_t#* src = inframe; |
| 88 | for(y=0;y<h;++y) |
| 89 | for(x=0;x<w;++x,++src) { |
| 90 | *dst++ = ( 0xffff0000 & (*src) ) | ( (0x00ff0000 & (*src)) >> 8 ) | ((0x00ff0000 & (*src)) >> 16 ) ; |
| 91 | } |
| 92 | } |
| 93 |