here are some I just snipped out of my paint code… so they are slightly out of context
MyDrawPicture
#If TargetMacOS Then
Dim Interpolation_Mode As Integer
// provided by Sam Rowlands
Const kCGInterpolationDefault = 0
Const kCGInterpolationNone = 1 // equiv to Cocoa Default Mode
Const kCGInterpolationLow = 2
Const kCGInterpolationMedium = 4
Const kCGInterpolationHigh = 3 // Cocoa Default Mode
//
Interpolation_Mode=kCGInterpolationNone
If w2>w1 Or h2>h1 Then Interpolation_Mode=kCGInterpolationMedium ' reduced images
//
Declare Sub CGContextSetInterpolationQuality Lib "Cocoa" ( context As Integer, quality As Integer )
CGContextSetInterpolationQuality( g.handle( g.HandleTypeCGContextRef ), Interpolation_Mode )
//
#EndIf
g.drawpicture p,x,y,w1,h1,sx,sy,w2,h2
In Cocoa if you do nothing, and expand a picture using DRAWPICTURE, it “smears” the pixels (regardless of the AntiAlias setting), by setting mode to NONE, it draws crisp clean maginified pixels (which for this app was what I needed)
Dotted Lines
Dim lengths(-1) As Double
Dim x As Integer
Dim lengthArray As MemoryBlock
Declare Sub CGContextSetLineDash Lib "Cocoa" ( context As Integer, phase As Single, lengths As Ptr, count As UInt32)
x=g.penwidth
Select Case pattern_id
Case -1 ' for lasso
lengths=Array(x*4.,x*4.) '
Case 1
lengths=Array(Ceil(x/2.),x*2.) ' dotted line [.......]
Case 2
lengths=Array(x*8.,x*4.) ' dashed line [- - - -]
Case 3
lengths=Array(x*6.,x*3.,Ceil(x/2.),x*3.) ' dashed dot dash line [- . -]
Case 4
lengths=Array(x*6.,x*3.,Ceil(x/2.),x*3.,Ceil(x/2.),x*3.) ' dashed dot dot line [-..-..]
Case Else
pattern_id=0
End Select
//
If pattern_id<>0 Then
lengthArray= CFloatArray(lengths)
If lengthArray Is Nil Then Return
CGContextSetLineDash g.handle( g.HandleTypeCGContextRef ),start_at,lengthArray,lengths.Ubound+1
Else
CGContextSetLineDash g.handle( g.HandleTypeCGContextRef ),0,Nil,0 ' solid line
End If