PB to COCOA

Mac OSX specific forum
Wolfram
Enthusiast
Enthusiast
Posts: 568
Joined: Thu May 30, 2013 4:39 pm

PB to COCOA

Post by Wolfram »

Hello,

can some one translate this to COCOA?

Code: Select all

MyImage = CreateImage(#PB_Any, 200, 100, 24, RGB(255, 255, 255))

StartDrawing(ImageOutput(MyImage))
 DrawingMode(#PB_2DDrawing_Transparent)
 DrawText(20, 40, "Hello World!", RGB(0,0,100))

StopDrawing()
macOS Catalina 10.15.7
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: PB to COCOA

Post by wilbert »

There is no exact translation.
PB does a lot of things behind the scenes.
You can draw a text onto an image using cocoa but the output will be similar to the PB Vector library.
In short, what you do with cocoa is create a NSImage object, lock focus on it, draw what you want, unlock focus.
Maybe it helps if you can explain more what you are trying to do.
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply