• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.graphics.pdf.component;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.NonNull;
21 import android.graphics.Bitmap;
22 import android.graphics.pdf.flags.Flags;
23 
24 /**
25  * Represents an image object on a PDF page. This class extends
26  * {@link PdfPageObject} and provides methods to access and modify the
27  * image content.
28  */
29 @FlaggedApi(Flags.FLAG_ENABLE_EDIT_PDF_PAGE_OBJECTS)
30 public final class PdfPageImageObject extends PdfPageObject {
31     private Bitmap mImage;
32 
33     /**
34      * Constructor for the PdfPageImageObject. Sets the object type
35      * to IMAGE.
36      */
PdfPageImageObject(@onNull Bitmap image)37     public PdfPageImageObject(@NonNull Bitmap image) {
38         super(PdfPageObjectType.IMAGE);
39         this.mImage = image;
40     }
41 
42     /**
43      * Returns the bitmap image of the object.
44      *
45      * @return The bitmap image of the object.
46      */
47     @NonNull
getBitmap()48     public Bitmap getBitmap() {
49         return mImage;
50     }
51 
52     /**
53      * Sets the bitmap image of the object.
54      *
55      * @param image The bitmap image to set.
56      */
setBitmap(@onNull Bitmap image)57     public void setBitmap(@NonNull Bitmap image) {
58         this.mImage = image;
59     }
60 
61 }
62