Skip to content

Commit 7f0cec6

Browse files
committed
Updated libvips plugin
1 parent 4c34455 commit 7f0cec6

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

libvips/README.md

+57-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Look up an unbuilt @operation in the cache. If we get a hit, ref and return the
7171

7272
## Extending VIPS
7373

74-
* 自定义操作 `operation`
74+
* 编写插件 `negative`
7575

7676
```c
7777
typedef struct _Negative {
@@ -192,4 +192,60 @@ static int negative_generate( VipsRegion *or, void *vseq, void *a, void *b, gboo
192192

193193
return( 0 );
194194
}
195+
```
196+
197+
Makefile:
198+
```Makefile
199+
# Makefile for vips plugin
200+
201+
# Object files
202+
OBJS = negative.o
203+
204+
# Source files
205+
SRC = $(OBJS:.o=.c)
206+
207+
# Headers
208+
HEADERS =
209+
210+
# All
211+
TAGS = $(SRC) $(HEADERS)
212+
213+
#linux
214+
CFLAGS += -shared -fPIC
215+
#solaris
216+
#CXXFLAGS += -Xa -Kpic
217+
CPPFLAGS += `pkg-config vips --cflags`
218+
LDFLAGS += `pkg-config vips --libs`
219+
OUT = vips-negative.plg
220+
221+
release: $(OUT)
222+
debug: $(OUT)
223+
224+
.PHONY: debug
225+
debug: CFLAGS += -g
226+
227+
.PHONY: release
228+
release: CFLAGS += -O3
229+
230+
$(OUT): $(OBJS)
231+
$(CC) -o $(OUT) -shared $(OBJS)
232+
#solaris
233+
# ld -o $(OUT) -G $(OBJS)
234+
# vips -plugin ./$(OUT) resample in.v in2.v out.v 0.1 20 1 1 0
235+
# vips -plugin ./$(OUT) scale_par matrix.mat out.mat 2.0
236+
237+
clean:
238+
$(RM) $(OBJS)
239+
240+
tags: $(TAGS)
241+
ctags $(TAGS)
242+
243+
# version as MAJOR.MINOR
244+
VIPS_VERSION = $(shell pkg-config vips --modversion | \
245+
awk '{split($$1,a,"."); print a[1]"."a[2]}')
246+
PLUGIN_DIR = $(VIPSHOME)/lib/vips-plugins-$(VIPS_VERSION)
247+
248+
install: $(OUT)
249+
-mkdir -p $(PLUGIN_DIR)
250+
-cp $(OUT) $(PLUGIN_DIR)
195251
```

0 commit comments

Comments
 (0)