[futurebasic] Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT vector graphics

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2010 : Group Archive : Group : All Groups

From: PZ <pierrezippi@...>
Date: Fri, 15 Jan 2010 11:05:20 -0600
Deep,  Thanks this is exactly the kind of one-step-at-a-time that will help
me transition to CoreGraphics and ultimately to FBtoC.

I will start with the clipboard.


> From: Deep <Info@...>
> Reply-To: <futurebasic@...>
> Date: Fri, 15 Jan 2010 16:12:00 +0000
> To: <futurebasic@...>
> Conversation: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
> vector graphics
> Subject: Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
> vector graphics
> 
> 
> The Clipboard functions you are using will still work, but I suspect that
> something else must be converting it to bitmap. I have been unable to save
> vector images in vector PICT format to the clipboard, they become bitmaps as
> you have discovered. To retain them in vector format, you need to save them
> in PDF format, using newer Clipboard routines. See the Example in FB5 for
> Pasteboard which shows PDF to clipboard (via CoreGraphics!).
> 
> Regarding the CoreGraphics functions reference that you mention, would
> suggest:
> 
> http://developer.apple.com/mac/library/documentation/GraphicsImaging/Referen
> ce/CGContext/Reference/reference.html
> 
> This can also be found from navigating:
> 
> http://developer.apple.com/mac/library/navigation/
>    - Choose "Graphics & Animation" on left side menu,
>      - Scroll down right side to "CGContext Reference".
> 
> Another one on the same list is "Quartz 2D Programming Guide"
> 
> With your experience of PostScript, you will notice that many of the
> CoreGraphic functions take their name from PostScript functions, and the
> coordinate drawing space is the same as PostScript. In its early days,
> CoreGraphics was often referred to as "Display PostScript" unofficially.
> This is how CoreGraphics seamlessly integrates into screen display, print
> output, PDF files, vector Clipboard, etc, it is all vector resolution
> independent at all stages until final output, just like PostScript. Your
> experience in PostScript will help you transition more easily!
> 
> 
>> From: PZ <pierrezippi@...>
>> Reply-To: <futurebasic@...>
>> Date: Fri, 15 Jan 2010 08:18:00 -0600
>> To: <futurebasic@...>
>> Subject: Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
>> vector graphics
>> 
>> I have the saved vector PICT working (sort of, the postscript text rotation
>> is messed up - buffer?). Now I am trying to get the clipboard working. It
>> used to work, but now it copies a bitmap instead of vectors. Here is the
>> code I use to copy the PICT to the clipboard.
>> 
>> 
>> local mode
>> local fn PutClipBoard( clipHndl as Handle, clipFlav as ScrapFlavorType )
>> dim as ScrapRef @ theScrap
>> dim as long byteCount
>> dim as OSStatus ignore, err : err = _paramErr
>> long if ( clipHndl != 0 and clipFlav != 0 )
>> ignore = fn ClearCurrentScrap
>> byteCount = fn GetHandleSize( clipHndl )
>> ignore = fn GetCurrentScrap( @theScrap )
>> err = fn PutScrapFlavor( theScrap, clipFlav, _kScrapFlavorMaskNone,
>> byteCount, #[ClipHndl] )
>> end if
>> end fn = err
>> 
>> I agree with your philosophy below. I am willing, albeit not readily able,
>> to adapt to CoreGraphics. Being a full-time scientist and part-time
>> programmer, I must make my changes one at a time, usually dictated by by a
>> machine/system upgrade (caused by an old machine dying).
>> 
>> Where do I find definitions for CoreGraphics operations such as:
>> fn  CGContextBeginPath( ctx )
>> fn CGContextMoveToPoint( ctx, 1.0, 0.0 )
>> fn CGContextAddLineToPoint( ctx, cos( nextPointIndex*starAngle ), sin(
>> nextPointIndex*starAngle ) )
>> fn CGContextClosePath( ctx )
>> fn CGContextFillPath( ctx )
>> 
>> 
>>> From: Deep <Info@...>
>>> Reply-To: <futurebasic@...>
>>> Date: Fri, 15 Jan 2010 13:19:53 +0000
>>> To: <futurebasic@...>
>>> Conversation: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
>>> vector graphics
>>> Subject: Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
>>> vector graphics
>>> 
>>> 
>>> Clipboard also needs tweaking due to the way the clipboard has changed in
>>> 10.5, but older functionality still exists. Again, there is a demo in the
>>> FB5 Examples. There is no reason why PICT as a type of data will not work on
>>> the clipboard, because it only knows the type (PICT) and the quantity of
>>> data (the PictHandle). However, the number of apps where you can then paste
>>> that data will gradually disappear, some will call it "Unrecognised Data".
>>> In 10.5/10.6, when you have a PICT on the clipboard, switch to the Finder
>>> and use Show Clipboard from the Edit menu. You will get a black screen with
>>> the label "Unrecognised data" or something similar. You can still paste it
>>> into Intaglio, but this should be the hint that it is on its way out...!
>>> 
>>> Moving from FBII to FB4 may have taken time, but moving from FB4 to
>>> FB5/FBtoC is a lot easier as most of it is still the same. You will need to
>>> make a few minor tweaks to your source (like I did with RC's older demo).
>>> 
>>> From my own experience, I would advise you to think as follows:
>>> 
>>> 1) Do not think in terms of "I use PICTs and QuickDraw, how do I support
>>> that in FB5/FBtoC?"
>>> 
>>> 2) Ask yourself "What does my program achieve?"
>>> 
>>> 3) Answer: "It produces vector PICT images, so would another more modern
>>> format be better"? In this case, PDF would be better.
>>> 
>>> 4) How do I use the MacOS to do all the hard work? Use CoreGraphics, short
>>> apps exist in the Examples folder which makes graphics and saves to PDF.
>>> 
>>> From your description of your app, creating some vector images and
>>> compositing them together, this seems like an ideal job for CoreGraphics.
>>> 
>>> The way CoreGraphics operate, you open a CGContext (similar to an old
>>> QuickDraw GWorld) where you then draw your graphics using lines, circles,
>>> fills, etc. Then, you tell it what to do with that CGContext, such as
>>> display on screen, send to a printer, save as a file such as
>>> PDF/TIFF/JPG/etc, completed in a few lines of code. Unlike QuickDraw, there
>>> is automatic antialiasing, transparency support, and so much flexibility.
>>> Look at the examples in the FB5 folder for some inspiration on its
>>> possibilities. If you look at the Intaglio special effects, many are done
>>> using CoreGraphics and completed in a few lines of source code, and if you
>>> have seen Apple Keynote (iWork) style presentations, again a lot is
>>> dependent on CoreGraphics.
>>> 
>>> OpenGL is where the MacOS talks to the video card and harnesses the
>>> graphical processing power of the video hardware to perform special
>>> computations, but often used for things like transparency, or 3D rendering
>>> or special effects like you see in iChat or some Widgets which is
>>> computationally intensive. CoreGraphics is the MacOS graphical engine, and
>>> it invisibly harnesses the power of the video card (sometimes via OpenGL)
>>> but does it invisibly in the background for you, you just tell CoreGraphics
>>> to place a circle and a half transparent square on top, it uses the hardware
>>> and software available to do it as quickly as possible.
>>> 
>>> 
>>>> From: PZ <pierrezippi@...>
>>>> Reply-To: <futurebasic@...>
>>>> Date: Fri, 15 Jan 2010 06:44:35 -0600
>>>> To: <futurebasic@...>
>>>> Subject: Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
>>>> vector graphics
>>>> 
>>>> OK - Deep and Roberts demo proves to me that PICT is not yet broken. The
>>>> demo indeed does create a vector pict file that is editable in Intaglio. I
>>>> will try to implement the RECORD for pict params. My code only DIMs the
>>>> pictHandle. 
>>>> 
>>>> What about the clipboard? Will it also function once the pict params are
>>>> defined?
>>>> 
>>>> Yes, I know that I need to move away from PICT. What is the difference
>>>> between CoreGraphics and OpenGL? Are there any FB4 examples? OK, OK! I know
>>>> I need to move to FBtoC as well - but one step at a time. I just finished
>>>> moving all my apps from FBII to FB4 - and the PICT problem shows I'm not
>>>> yet
>>>> finished with that task.
>>>> 
>>>> Thanks for the help and direction. I hope the PICT problem resolves as
>>>> easily as the example looks.
>>>> 
>>>> 
>>>>> From: Deep <Info@...>
>>>>> Reply-To: <futurebasic@...>
>>>>> Date: Fri, 15 Jan 2010 09:55:27 +0000
>>>>> To: <futurebasic@...>
>>>>> Conversation: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw
>>>>> PICT
>>>>> vector graphics
>>>>> Subject: Re: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw
>>>>> PICT
>>>>> vector graphics
>>>>> 
>>>>> 
>>>>> Pierre,
>>>>> 
>>>>> Five years ago, Robert Covington posted a demo to the list. Have tweaked
>>>>> it
>>>>> slightly for FB5/FBtoC compatibility and shown it below. It happily
>>>>> generates vector PICT on MacOS X 10.6.2 MacBook Pro (Intel) so it would
>>>>> appear that vector PICT has not broken inside QuickDraw yet, but bear in
>>>>> mind that it relies on techniques which are not encouraged.
>>>>> 
>>>>> You really should reconsider if PICT is the best option for your app for
>>>>> the
>>>>> long term? Strongly recommend that you move to CoreGraphics which does a
>>>>> lot
>>>>> of the hard work for you and is for 10.4 onwards. However, it does not
>>>>> support vector PICT, so when telling CoreGraphics to save an image to PICT
>>>>> it will save it only as a bitmap. CoreGraphics will happily output vector
>>>>> formats such as PDF. Vector PICT and vector PDF will both import into
>>>>> Intaglio as editable vector formats so if you are planning to use the
>>>>> vector
>>>>> file with Intalgio, it should make little difference. There are examples
>>>>> in
>>>>> the FB5 Examples folder.
>>>>> 
>>>>> Hope it helps,
>>>>> 
>>>>> Deep
>>>>> 
>>>>> 
>>>>> 'Demo follow:
>>>>> 
>>>>> BEGIN RECORD MyOpenCPicParams
>>>>> DIM srcRect as Rect
>>>>> DIM hRes as Fixed
>>>>> DIM vRes as Fixed
>>>>> DIM version as short
>>>>> DIM reserved1 as short
>>>>> DIM reserved2 as long
>>>>> END RECORD
>>>>> 
>>>>> DIM myPic as MyOpenCPicParams
>>>>> 
>>>>> dim ThePictHandle as handle
>>>>> 
>>>>> end globals
>>>>> 
>>>>> 
>>>>> CLEAR LOCAL
>>>>> DIM buff.512
>>>>> LOCAL FN SaveThatPictFile(MypictHandle as handle)
>>>>> DIM @myfilename$
>>>>> DIM bytes&
>>>>> DIM @outSpec as FSSpec
>>>>> LONG IF MypictHandle
>>>>> DEF OPEN "PICTGKON"
>>>>> myfilename$ = FILES$(_FSSpecSave,"Save PICT asŠ","Untitled",outSpec)
>>>>> LONG IF myfilename$ <> ""
>>>>> OPEN "O",1,@outSpec
>>>>> WRITE FILE #1, @buff,512
>>>>> bytes& = FN GETHANDLESIZE(MypictHandle)
>>>>> WRITE FILE #1, [MypictHandle], bytes&
>>>>> CLOSE #1
>>>>> END IF
>>>>> END IF
>>>>> END FN
>>>>> 
>>>>> 
>>>>> Local FN GetPictHandle as handle
>>>>> dim DrawRect as RECT
>>>>> DIM @PictH as handle
>>>>> PictH = 0
>>>>> SETRECT(DrawRect,0,0,200,200)
>>>>> myPic.srcRect;8 = @DrawRect
>>>>> myPic.hRes = FN LONG2FIX(72)
>>>>> myPic.vRes = FN LONG2FIX(72)
>>>>> myPic.version=-2
>>>>> PictH = FN OpenCPicture(@myPic)
>>>>> SETRECT(DrawRect,25,25,175,175)
>>>>> FRAMERECT(DrawRect)
>>>>> SETRECT(DrawRect,50,50,150,150)
>>>>> PAINTRECT(DrawRect)
>>>>> MOVETO(15,15)
>>>>> DRAWSTRING("Demo Drawing")
>>>>> ClosePicture
>>>>> Long if PictH
>>>>> HLock(PictH)
>>>>> End If
>>>>> End FN = PictH
>>>>> 
>>>>> 
>>>>> ThePictHandle = FN GetPictHandle
>>>>> FN SaveThatPictFile(ThePictHandle)
>>>>> 
>>>>> 
>>>>> 
>>>>>> From: PZ <pierrezippi@...>
>>>>>> Reply-To: <futurebasic@...>
>>>>>> Date: Thu, 14 Jan 2010 19:58:51 -0600
>>>>>> To: <futurebasic@...>
>>>>>> Subject: [FB] [X-FB sort of] Last Mac/OS that will write Quickdraw PICT
>>>>>> vector
>>>>>> graphics
>>>>>> 
>>>>>> This is the most important question I have ever asked this list.
>>>>>> 
>>>>>> What is the last Mac processor and OS that will write QuickDraw PICT
>>>>>> vector
>>>>>> graphics?
>>>>>> 
>>>>>> My world revolves around several FB apps I wrote (with the help of the FB
>>>>>> list) that create specialized charts as vector pict. I then need to
>>>>>> edit/montage multiple charts into a final composite chart using a pict
>>>>>> vector editor such as Intaglio (previously MacDraw, Canvas, ClarisDraw,
>>>>>> etc).
>>>>>> 
>>>>>> It seems as if the ability of my FB apps to write vector QuickDraw fails
>>>>>> at
>>>>>> some point. What is the latest processor/OS combo that will allow me to
>>>>>> create vector QuickDraw clipboard or docs?
>>>>>> 
>>>>>> I can write QuickDraw vector picts with:
>>>>>> iMac G5 with OS 10.4.8
>>>>>> iMac 2 GHz Intel Core 2 Duo with OS 10.5.8
>>>>>> 
>>>>>> I cannot write vector picts with:
>>>>>> iMac 3 GHz Intel Core 2 Duo with OS 10.5.6
>>>>>> iMac 3 GHz Intel Core 2 Duo with OS 10.6.2
>>>>>> 
>>>>>> - Pierre
>>>>>> 
>>>>>> --
>>>>>> To unsubscribe, send ANY message to:
>>>>>> futurebasic-unsubscribe@...
>>>>> 
>>>>> --
>>>>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>>>> 
>>>> 
>>>> --
>>>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>>> 
>>> 
>>> --
>>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>> 
>> 
>> --
>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>> 
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>