A fairly recent project of mine makes the exact same context call in drawRect. 
I just ran it again without a problem. My MacRuby is one of the nightlies from 
2-3 weeks ago.

Jim


On Oct 18, 2012, at 12:30 AM, Robert Carl Rice <rice.au...@pobox.com> wrote:

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

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/macruby-devel

Reply via email to