mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
parent
f210dfd570
commit
caeb2c0412
2 changed files with 57 additions and 1 deletions
|
|
@ -332,7 +332,7 @@ end;"/>
|
|||
<PackageName Value="Image32"/>
|
||||
</Item13>
|
||||
</RequiredPackages>
|
||||
<Units Count="293">
|
||||
<Units Count="294">
|
||||
<Unit0>
|
||||
<Filename Value="doublecmd.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
|
@ -2129,6 +2129,11 @@ end;"/>
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="uDarwinFileUtil"/>
|
||||
</Unit292>
|
||||
<Unit293>
|
||||
<Filename Value="platform\unix\darwin\udarwinimageutil.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="uDarwinImageUtil"/>
|
||||
</Unit293>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
|||
51
src/platform/unix/darwin/udarwinimageutil.pas
Normal file
51
src/platform/unix/darwin/udarwinimageutil.pas
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
unit uDarwinImageUtil;
|
||||
|
||||
{$mode delphi}
|
||||
{$modeswitch objectivec2}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
CocoaAll, CocoaUtils;
|
||||
|
||||
type
|
||||
|
||||
{ TDarwinImageUtil }
|
||||
|
||||
TDarwinImageUtil = class
|
||||
public
|
||||
class function filt( const filterName: NSString; const sourceImage: NSImage ): NSImage;
|
||||
class function invertColor( const sourceImage: NSImage ): NSImage;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
class function TDarwinImageUtil.filt(
|
||||
const filterName: NSString;
|
||||
const sourceImage: NSImage ): NSImage;
|
||||
var
|
||||
tiffData: NSData;
|
||||
inputImage: CIImage;
|
||||
outputImage: CIImage;
|
||||
filter: CIFilter;
|
||||
rep: NSCIImageRep;
|
||||
begin
|
||||
tiffData:= sourceImage.TIFFRepresentation;
|
||||
inputImage:= CIImage.imageWithData( tiffData );
|
||||
filter:= CIFilter.filterWithName( filterName );
|
||||
filter.setValue_forKey( inputImage, kCIInputImageKey );
|
||||
outputImage:= filter.valueForKey( kCIOutputImageKey );
|
||||
rep:= NSCIImageRep.imageRepWithCIImage( outputImage );
|
||||
Result:= NSImage.alloc.initWithSize( sourceImage.size );
|
||||
Result.addRepresentation( rep );
|
||||
Result.autorelease;
|
||||
end;
|
||||
|
||||
class function TDarwinImageUtil.invertColor( const sourceImage: NSImage ): NSImage;
|
||||
begin
|
||||
Result:= filt( NSSTR('CIColorInvert'), sourceImage );
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue