180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2006 The Android Open Source Project 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkImageView_DEFINED 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkImageView_DEFINED 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkView.h" 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkString.h" 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkAnimator; 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkBitmap; 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkMatrix; 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkImageView : public SkView { 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkImageView(); 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual ~SkImageView(); 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void getUri(SkString*) const; 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void setUri(const char []); 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void setUri(const SkString&); 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru enum ScaleType { 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru kMatrix_ScaleType, 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru kFitXY_ScaleType, 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru kFitStart_ScaleType, 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru kFitCenter_ScaleType, 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru kFitEnd_ScaleType 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ScaleType getScaleType() const { return (ScaleType)fScaleType; } 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void setScaleType(ScaleType); 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool getImageMatrix(SkMatrix*) const; 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void setImageMatrix(const SkMatrix*); 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected: 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // overrides 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual bool onEvent(const SkEvent&); 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void onDraw(SkCanvas*); 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void onInflate(const SkDOM&, const SkDOMNode*); 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate: 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkString fUri; 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkMatrix* fMatrix; // null or copy of caller's matrix ,,,,, 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru union { 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkAnimator* fAnim; 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkBitmap* fBitmap; 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } fData; 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru uint8_t fScaleType; 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkBool8 fDataIsAnim; // as opposed to bitmap 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkBool8 fUriIsValid; 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void onUriChange(); 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool getDataBounds(SkRect* bounds); 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool freeData(); 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool ensureUriIsLoaded(); 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru typedef SkView INHERITED; 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}; 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 69