A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: ActionScript 3 Bitmap Drawing Library

  1. #1
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79

    ActionScript 3 Bitmap Drawing Library

    I've just released a new creative commons library. The Graffiti AS3 Bitmap Drawing Library is designed for developers to easily integrate drawing functionality into their ActionScript 3 application. It is free to use and modify for noncommercial projects.

    Visit the Project Site

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Moved to open source forum
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79

    AS3 Bitmap Drawing Library 1.1 update

    I have just updated the Graffiti Drawing Library adding:
    • Line and Shape Tools
    • Resizable Canvas
    • Event notification of History Level change.
    • Flood Fill Access
    • Get color at point on Canvas
    • Various Bug Fixes


    I've also added another example application and an intro tutorial to the site.

    http://www.nocircleno.com/graffiti/

  4. #4
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79

    ActionScript 3 Bitmap Drawing Library 1.2 update

    I've updated this library to version 1.2. The big new feature is transparency support for all the tool.

    http://www.nocircleno.com/graffiti/

  5. #5
    Member
    Join Date
    Apr 2009
    Posts
    41
    can u tell me how to make undo redo functionality and how to find the child of canvas

  6. #6
    Member
    Join Date
    Apr 2009
    Posts
    41
    how to select each object individually which i draw on canvas

  7. #7
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79

    Graffiti Library 2.5 is out

    Version 2.5 is out. I've added two new tools:
    • Fill Bucket Tool
    • Text Tool


    With the addition of the text tool comes an object layer in the library. This will be expanded in the future to include more editable objects.

  8. #8
    Member
    Join Date
    Oct 2000
    Location
    Lansing, Michigan
    Posts
    79
    Quote Originally Posted by ransi1201 View Post
    can u tell me how to make undo redo functionality and how to find the child of canvas
    If you specified to keep a drawing history when you create a GraffitiCanvas instance, then you can use the various public properties to manage that history.

    Refer to the online documentation:
    http://www.nocircleno.com/graffiti/d...itiCanvas.html

  9. #9
    Junior Member
    Join Date
    Nov 2009
    Posts
    2
    Ben,

    Thanks for the awesome drawing library. I have a feature request that I'd like to help you build. It looks like you've had to implement a basic method for detecting whether or not the user is selecting an object in order to be able to draw text. I would like to extend that to include selecting & editing shapes and lines. So if you click on a rectangle you just made, handles appear on the sides and corners that allow you to drag the rectangle's dimensions. Also, while we're at it, why not allow the user to change the fill color, or stroke properties when an object is selected?

    objectEventHandler() looks like a good place to put this functionality, but since it's your library and I'm not completely familiar with it yet, I thought it may be best to get your opinion before I go mangling things too much. ;)

    Possible updated handler:
    PHP Code:
            /**************************************************************************
                Method    : objectEventHandler()
                
                Purpose    : This method will handle graffiti object events.
                          
                Params    : e - GraffitiObjectEvent Object
            ***************************************************************************/
            
    private function objectEventHandler(e:GraffitiObjectEvent):void {
            
                var 
    dispatch:Boolean true;
                
                if (
    e.type == GraffitiObjectEvent.DESELECT) {
                    
                    if (
    e.graffitiObject is Text) {
                        
                        
    // if the text field has no text, then kill it
                        
    if (Text(e.graffitiObject).text == "") {
                            
                            if (
    object_layer.contains(e.graffitiObject)) {
                                
    object_layer.removeChild(e.graffitiObject);
                            }
                            
                            
    dispatch false;
                        }
                        
                    }
                    
                    
            
                } else if (
    e.type == GraffitiObjectEvent.DELETE) {
                    
                    
    object_layer.removeChild(e.graffitiObject);
                    
                } else if(
    e.type == GraffitiObjectEvent.SELECT) {
                    
                    
    //Don't know why there isn't a SELECT already, but it's a perfect place for it.

                    //check what type of object is selected
                    
    if(e.graffitiObject is Linear) {
                        
                        
    //show a handle for each end point of the line
                        
                    
    } else if(e.graffitiObject is Rectangular) {
                        
                        
    //show the appropiate side/rectangular handles
                        
                    
    } else if(e.graffitiObject is Circular) {
                        
                        
    //you get the point
                        
                    
    }
                    
                }
                
                
    // stop event from rocking
                
    e.stopPropagation();
                
                
    // dispatch event if ok
                
    if (dispatch) {
                    
    dispatchEvent(e.clone());
                }
                
            } 

  10. #10
    Junior Member
    Join Date
    Nov 2009
    Posts
    2
    Whoops. I just saw your roadmap. It was tiny and under some huge buttons so I didn't see it before hehe.

    Well it looks like you are already planning to do some sort of Transforms, which would require every drawing object to be fully selectable and it's own entity.

    So. How can I help?

  11. #11
    Junior Member
    Join Date
    Apr 2006
    Posts
    1
    Ben,

    I'll be using the library for an annotation tool. Where I have an image as background and use the library to draw and comment onto the image.

    Then I'll save the annotations as a separate transparent png to the server and any textboxes as an array to maintain editability.

    The thing I'm not certain about is keeping the annotations editable. So once I load an annotation image I can use the eraser tool on it etc. And then resave it as a new image. Can you give me some tips on how I can load the image in and make it editable(like a breakapart at runtime)?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center