FAQ

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to create a Mac picture clip file?

Answer: You can use code like this one.
Example
dim f As FolderItem
dim p As Picture

f=SpecialFolder.Desktop.Child("Test.pictClipping")
if f=nil then Return

p=new Picture(300,200,32) 'Make a sample picture
p.Graphics.ForeColor=RGB(0,255,255)
p.Graphics.FillOval 0,0,99,99
p.Graphics.ForeColor=RGB(255,0,0)
p.Graphics.DrawOval 0,0,99,99

dim r As ResourceFork 'ResourceFork is needed for a clip file

// Please define a file type Any
r=f.CreateResourceFork("Any")

// get PICT data using plugin function
dim pictdata as string = p.PicHandleDataMBS
r.AddResource(pictdata,"PICT",256,"Picture")

dim m as new MemoryBlock(8)

m.LittleEndian = false
m.Int16Value(0) = 0
m.Int16Value(2) = 0
m.Int16Value(4) = p.Width
m.Int16Value(6) = p.Height

r.AddResource(m,"RECT",256,"")

'Values taken from a sample file and irrelevant to the problem
dim data as string = DecodeBase64("AQAAAAAAAAAAAAAAAAACAFRDRVIAAAABAAAAAAAAAABUQ0lQAAAAAQAAAAAAAAAA")
r.AddResource(data,"drag",128,"") 'ditto
r.Close

In general Apple has deprecated this, but a few application still support clippings.


💬 Ask a question or report a problem