Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,43 @@
include resources "Flowersfb.jpg"
_window = 1
begin enum output 1
_imageviewColor
_imageviewGray
end enum
void local fn BuildWindow
CGRect r = fn CGRectMake( 0, 0, 580, 300 )
window _window, @"Color to Grayscale", r
r = fn CGRectMake( 20, 20, 260, 260 )
imageview _imageviewColor, YES, @"Flowersfb.jpg", r, NSImageScaleAxesIndependently, NSImageAlignCenter, NSImageFramePhoto
r = fn CGRectMake( 300, 20, 260, 260 )
imageview _imageviewGray, YES, @"Flowersfb.jpg", r, NSImageScaleAxesIndependently, NSImageAlignCenter, NSImageFramePhoto
end fn
local fn GrayscaleImage( image as ImageRef ) as ImageRef
CGSize size = fn ImageSize( image )
CGRect bounds = fn CGRectMake( 0, 0, size.width, size.height )
ImageRef finalImage = fn ImageWithSize( size )
CFDataRef dta = fn ImageTIFFRepresentationUsingCompression( image, NSTIFFCompressionNone, 0.0 )
CIImageRef inputImage = fn CIImageWithData( dta )
ImageLockFocus( finalImage )
CIFilterRef filter = fn CIFilterWithNameAndInputParameters( @"CIPhotoEffectMono", @{kCIInputImageKey:inputImage} )
CIImageRef outputCIImage = fn CIFilterOutputImage( filter )
CIImageDrawAtPoint( outputCIImage, CGPointZero, bounds, NSCompositeCopy, 1.0 )
ImageUnlockFocus( finalImage )
end fn = finalImage
fn BuildWindow
ImageRef colorFlowers
ImageRef grayflowers
colorFlowers = fn ImageNamed( @"Flowersfb.jpg" )
grayflowers = fn GrayscaleImage( colorFlowers )
ImageViewSetImage( _imageviewGray, grayFlowers )
HandleEvents