Преглед на файлове

* Added preliminary support of CoreImage (Cocoa/Mac OS X)

Changed default hidden unicode glyph to 'x' in The Pimp to fix a compilation problem  


git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2897 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
jylam преди 16 години
родител
ревизия
b222945a6e
променени са 7 файла, в които са добавени 144 реда и са изтрити 5 реда
  1. +2
    -2
      ThePimp/gtk-gui/ThePimp.NewFile.cs
  2. +2
    -2
      configure.ac
  3. +5
    -0
      pipi/Makefile.am
  4. +4
    -1
      pipi/codec.c
  5. +34
    -0
      pipi/codec/coreimage.h
  6. +91
    -0
      pipi/codec/coreimage.m
  7. +6
    -0
      pipi/pipi_internals.h

+ 2
- 2
ThePimp/gtk-gui/ThePimp.NewFile.cs Целия файл

@@ -75,7 +75,7 @@ namespace ThePimp {
this.entry1.Text = Mono.Unix.Catalog.GetString("1024");
this.entry1.IsEditable = true;
this.entry1.WidthChars = 6;
this.entry1.InvisibleChar = '';
this.entry1.InvisibleChar = 'x';
this.entry1.Xalign = 1F;
this.table1.Add(this.entry1);
Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.entry1]));
@@ -90,7 +90,7 @@ namespace ThePimp {
this.entry2.Text = Mono.Unix.Catalog.GetString("768");
this.entry2.IsEditable = true;
this.entry2.WidthChars = 6;
this.entry2.InvisibleChar = '';
this.entry2.InvisibleChar = 'x';
this.entry2.Xalign = 1F;
this.table1.Add(this.entry2);
Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.entry2]));


+ 2
- 2
configure.ac Целия файл

@@ -136,8 +136,8 @@ ac_cv_my_have_cocoa="no"
AC_CHECK_HEADERS(/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h,
[
MACOSX_SDK_FRAMEWORKS="-F${MACOSX_SDK}/System/Library/Frameworks"
CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS} -I/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"


+ 5
- 0
pipi/Makefile.am Целия файл

@@ -110,3 +110,8 @@ codec_libs += -lgdi32
codec_sources += codec/gdi.c
endif

if USE_COCOA
codec_objcflags = -I"/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
codec_libs += -framework Cocoa -framework IOKit -framework CoreFoundation -framework QuartzCore
codec_sources += codec/coreimage.m
endif

+ 4
- 1
pipi/codec.c Целия файл

@@ -55,7 +55,10 @@ pipi_image_t *pipi_load(char const *name)
if(!ret)
ret = pipi_load_gdi(name);
#endif

#if USE_COCOA
if(!ret)
ret = pipi_load_coreimage(name);
#endif
return ret;
}



+ 34
- 0
pipi/codec/coreimage.h Целия файл

@@ -0,0 +1,34 @@
/*
* libpipi Proper image processing implementation library
* Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
* 2008 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved
*
* $Id$
*
* This library is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

/*
* coreimage.m: CoreImage (OSX) I/O functions
*/

#include "config.h"
#ifdef USE_COCOA

#include "common.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#import <Cocoa/Cocoa.h>

#include "pipi.h"
#include "pipi_internals.h"

#endif

+ 91
- 0
pipi/codec/coreimage.m Целия файл

@@ -0,0 +1,91 @@
/*
* libpipi Proper image processing implementation library
* Copyright (c) 2004-2008 Sam Hocevar <sam@zoy.org>
* 2008 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved
*
* $Id$
*
* This library is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

/*
* coreimage.m: CoreImage (OSX) I/O functions
*/

#import "coreimage.h"

#ifdef USE_COCOA

#import <CIImage.h>

pipi_image_t *pipi_load_coreimage(const char *name)
{
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
NSString *n = [NSString stringWithCString: name];
CIImage *source;
NSURL *url = [NSURL fileURLWithPath:n];
source = [CIImage imageWithContentsOfURL:url];
CGRect extent = [source extent];
size_t w = (size_t)extent.size.width;
size_t h = (size_t)extent.size.height;


NSBitmapImageRep * myImage;
myImage = [[NSBitmapImageRep alloc] initWithCIImage:source];
pipi_image_t *img;
img = pipi_new(w, h);
img->p[PIPI_PIXELS_RGBA_C].pixels = [myImage bitmapData];
img->p[PIPI_PIXELS_RGBA_C].w = w;
img->p[PIPI_PIXELS_RGBA_C].h = h;
img->p[PIPI_PIXELS_RGBA_C].pitch = ([myImage bytesPerRow]/8) * img->w;
img->p[PIPI_PIXELS_RGBA_C].bpp = [myImage bitsPerPixel];
img->p[PIPI_PIXELS_RGBA_C].bytes = ([myImage bitsPerPixel]/8) * img->w * img->h;
img->last_modified = PIPI_PIXELS_RGBA_C;

img->codec_priv = (void*)[myImage bitmapFormat];
pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C);
[autoreleasepool release];
return img;
}


int pipi_save_coreimage(pipi_image_t *img, const char *name)
{
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
printf("%d\n", img->last_modified);
pipi_pixels_t *p = pipi_getpixels(img, PIPI_PIXELS_RGBA_C);
NSString *n = [NSString stringWithCString: name];
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:p->w
pixelsHigh:p->h
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bitmapFormat: 0//(NSBitmapFormat)img->codec_priv
bytesPerRow:p->w*4
bitsPerPixel:32
];
if(bitmap == nil) return -1;
memcpy([bitmap bitmapData], p->pixels, p->w*p->h*4);
[[bitmap representationUsingType:NSPNGFileType properties:nil] writeToFile:n atomically:YES];
[autoreleasepool release];

return 1;
}


#endif

+ 6
- 0
pipi/pipi_internals.h Целия файл

@@ -85,6 +85,12 @@ pipi_image_t *pipi_load_gdi(const char *name);
int pipi_save_gdi(pipi_image_t *img, const char *name);
#endif

#ifdef USE_COCOA
pipi_image_t *pipi_load_coreimage(const char *name);
int pipi_save_coreimage(pipi_image_t *img, const char *name);
#endif


pipi_image_t *pipi_load_oric(const char *name);
int pipi_save_oric(pipi_image_t *img, const char *name);



Зареждане…
Отказ
Запис