My problem is I already have a complex method (with sub-methods) that paints beautifully on a canvas. When I try to convert that set of methods into a picture, I lose the vectored text. In my method(s) I use DrawObject and DrawText with stringshapes.
So really all I want to do is save the results of my canvas paint into a picture which I can use on another window, or save. I can easily save it but only as a bitmap graphic.
When I try what you suggest – drawing into this new picture, it breaks on a Nil object … the graphics object. It’s all very confusing to me: a house of mirrors.
That is correct. You can either do Vector or Bitmap. Object2D objects will work with both, but if you’re drawing into a bitmap image, they convert to bitmap. To create a vector image, you must only use Object2D. There is no Graphics or RGBSurface available. You can only use DrawObject commands, which work for both, but is the only way to create a vector image.
I see. Well tell me, is there any way I can save as a picture what I’m drawing into a canvas and keep the vectored (I guess that’s the word) text? As it is now, I can paint my original canvas, get smooth text, and output it to a PDF file. But I can’t save the whole process except as a bitmap.
Have two pictures, one with vector content and one bitmap. Draw bitmap first then draw vector picture into the drawn bitmap?
Or just use a group2D with a PixMapShape (or whatever it is called now) for the bitmap drawing and your text as StringShapes (or whatever they are called in API 2)
It looks a bit overwhelming at this point. I have fairly complex drawing routines (it’s for anacrostic puzzle creation which involves a lot of lines in a grid, in answer blanks, etc. as well as a lot of stringshapes in clues, indexes, etc.) I’ve used my software for 20+ years to create puzzles for our local paper. Now I want to add a feature where I could create two puzzles on one page. Thought it’d be fairly easy – and it is if I use bitmaps – but I’m starting to look for other options, maybe some third-party PDF deal that could stitch two PDFs together.
I guess we traversed this territory already. Sigh. I’m giving up on this whole concept. I don’t want to rewrite the drawing routines that go into painting on a canvas. Guess I’ll just use PDF editing software to paste together two pages (though even that appears to be a bit hard to come by).
But while I still have you on the line, Tim, why is it a canvas can handle both bitmaps and vectors? It seems anyway like it is for me. Plus I can print just fine with my present methods. I didn’t define an Object2D anywhere, I don’t think.
RoundRectShape is an Object2D. It can draw into both a bitmap and a vector image. If you create a bitmap Picture, it will have a Graphics property and will allow you to draw vector objects into it, but the result will be a bitmap, not a vector image. If you want to create a vector image that can be saved as a vector and not a bitmap, you need to create a vector Picture, but it won’t have a Graphics property - it will be Nil.
Btw, I just did a search and found a thread related to this issue … a thread I started. Ay-yi-yi. I forgot I went down this whole path a couple years ago. I remember doing it now but don’t remember what my final resolution was (probably there was no resolution). At any rate, sorry to all who may think I keep banging the same drum.
I’m going to pester you one last time, Tim. Can you show me – since I can’t find an example in the docs anywhere – how to create a vector picture and draw a single object into it.
Start with a Group2D object.
Add vector items to that, such as stringshapes and figureshapes
Test that it works by having a canvas on screen, and in the paint event of the canvas, do
g.drawobject MyGroup2d, 100,100
(if you see the graphics, your Group is fine.)
Now, create a new picture with 0 depth
Mypic = newpicture (1000,1000,0)
Set the Objects property of that to be your group.
Save the picture.
(The Objects property can be considered a Group2D in it’s own right… you can add your vector shapes directly to that if you like, you can omit the canvas step when you are happy)
Instead of looking for vector drawing, you can refactor your drawing code to accept parameters for width and heigh so you can draw the bitmap with the size needed.