[MacRuby-devel] Quartz 2D Graphics problem

Robert Carl Rice rice.audio at pobox.com
Wed Oct 17 21:30:10 PDT 2012


Hi,

I went back to working on an old project that uses core graphics and I'm having problems getting it to run again.

The following code gives me an error with the graphics context:

	def drawRect( rect )
		return unless @controller
		
		begin
			@context = NSGraphicsContext.currentContext.graphicsPort
		
			# Scale 15 min intervals to chart area
			@xscale = bounds.size.width / 25.0
			height = bounds.size.height
			@yscale = height / 2.0
			CGContextScaleCTM( @context, @xscale, @yscale )
			CGContextTranslateCTM( @context, 0.5, 0.5 ) # Indent from bounds
			
			# restore text size 
			CGContextSetTextMatrix( @context, CGAffineTransformMakeScale( 1 / @xscale, 1 / @yscale ))
			show_index( height )
			
			rescue => e
			ErrorLog.instance.rescue_error( e )
		end
	end

unrecognized runtime type `{CGContext=}'
/Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Main_Window.bundle/Contents/Resources/RemarksIndexView.rb:55:in `drawRect'
/Users/robertrice/Library/Developer/Xcode/DerivedData/MacDriverLog-ebberjlfoqoqdzenjgqkdbkehuoj/Build/Products/Debug/MacDriverLog.app/Contents/Resources/rb_main.rb:69:in `<main>'

line 55 is the first line:
@context = NSGraphicsContext.currentContext.graphicsPort

Has anything changed with regard to Quartz 2D drawing?

Thanks,
Bob Rice

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20121018/30bf3622/attachment.html>


More information about the MacRuby-devel mailing list